PromtEngineer / localGPT

Chat with your documents on your local device using GPT models. No data leaves your device and 100% private.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"TypeError: 'HuggingFaceInstructEmbeddings' object is not callable" after enter a query

Serializ3r opened this issue · comments

After install everything and ingest a document i tried to call the run_localGPT.py, but when i enter a query, i get the error described in the tittle.

here's the log:

(localGPT) C:\Private-localGPT>python run_localGPT.py
2024-02-03 17:27:30,678 - INFO - run_localGPT.py:265 - Running on: cpu
2024-02-03 17:27:30,678 - INFO - run_localGPT.py:266 - Display Source Documents set to: False
2024-02-03 17:27:30,679 - INFO - run_localGPT.py:267 - Use history set to: False
2024-02-03 17:27:31,074 - INFO - SentenceTransformer.py:66 - Load pretrained SentenceTransformer: hkunlp/instructor-large
load INSTRUCTOR_Transformer
max_seq_length 512

Enter a query: hi
Traceback (most recent call last):
File "C:\Private-localGPT\run_localGPT.py", line 306, in
main()
File "C:\Users\patri\anaconda3\envs\localGPT\lib\site-packages\click\core.py", line 1157, in call
return self.main(*args, **kwargs)
File "C:\Users\patri\anaconda3\envs\localGPT\lib\site-packages\click\core.py", line 1078, in main
rv = self.invoke(ctx)
File "C:\Users\patri\anaconda3\envs\localGPT\lib\site-packages\click\core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "C:\Users\patri\anaconda3\envs\localGPT\lib\site-packages\click\core.py", line 783, in invoke
return __callback(*args, **kwargs)
File "C:\Private-localGPT\run_localGPT.py", line 280, in main
res = qa(query)
TypeError: 'HuggingFaceInstructEmbeddings' object is not callable

Any thoughts on this?

commented

I have the same !

I also have the same, fresh EC2 install. Ubuntu 20

Not the most elegant solution perhaps, but I had to explicitly set embeddings in both the ingest.py and run_localGPT.py to get around this issue.
workaround

This is probably a bit better:
better-workaround

I have same issue.
I try to add some import as below:

from langchain.embeddings import HuggingFaceBgeEmbeddings
from langchain.embeddings import HuggingFaceEmbeddings

but the issue still happen.

Should be fixed now. I think there was a bug in one of the recent PR. Somehow missed it.

So, what was the bug?

So, what was the bug?

@PromtEngineer which was introduced into the recent PR?