iryna-kondr / scikit-llm

Seamlessly integrate LLMs into scikit-learn.
https://beastbyte.ai/
MIT License
3.38k stars 275 forks source link

Unable to use gpt4all #32

Closed AnchitGupta22 closed 1 year ago

AnchitGupta22 commented 1 year ago

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 1 year ago

Does it work if you install gpt4all separately?

AnchitGupta22 commented 1 year ago

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 1 year ago

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

AnchitGupta22 commented 1 year ago

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 1 year ago

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.

AnchitGupta22 commented 1 year ago

I tried that too. Still got the error.

OKUA1 commented 1 year ago

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.

AnchitGupta22 commented 1 year ago

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.