iryna-kondr/scikit-llm

Unable to use gpt4all

AnchitGupta22 opened this issue · 8 comments

I followed all the steps as mentioned in the readme but I couldn't use gpt4all in my colab notebook. It keeps prompting me to install it (error: gpt4all is not installed, try 'pip install sckit-llm[gpt4all]') even though I added the installation code before running my code snippet.

It's happening just with gpt4all as gpt 3.5 turbo atleast loads and works.

OKUA1 commented

Does it work if you install gpt4all separately?

Does it work if you install gpt4all separately?

Nope. The model weights never load when I create the classifier using gpt4all.

I even built the gpt4all model using the installation guide for linux (ubuntu). The build was successful but it still didn't work.

OKUA1 commented

Could you share your code snippet and the exact error message/trace ?

from skllm.config import SKLLMConfig

SKLLMConfig.set_openai_key("my-api-key")
SKLLMConfig.set_openai_org("my-org")

from skllm import ZeroShotGPTClassifier

clf = ZeroShotGPTClassifier(openai_model="gpt4all::ggml-gpt4all-j-v1.3-groovy")
clf = clf.fit(X_train, y_train)

from sklearn.metrics import classification_report

for split_name, dataset in zip(['train', 'validation'], datasets):
X_i, y_i = dataset
y_pred = clf.predict(X_i)
print(f'\nSplit: {split_name}')
print(classification_report(y_i, y_pred))

ImportError: gpt4all is not installed, try pip install scikit-llm[gpt4all]

OKUA1 commented

Did you try to restart the runtime after installing the package ? Otherwise, it might be reusing gpt4all = None as it was set during the failed import attempt.

I tried that too. Still got the error.

OKUA1 commented

We could not reproduce this issue in colab. Maybe you could try to create a fresh instance and check whether the problem is still present.

For some reason, I had to put the installation line for gpt4all above all other installs/imports in my project in order to make it work.

Thankyou for the help though.