localGPT icon indicating copy to clipboard operation
localGPT copied to clipboard

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

Open Serializ3r opened this issue 1 year ago • 8 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?

Serializ3r avatar Feb 03 '24 20:02 Serializ3r

I have the same !

g1ra avatar Feb 03 '24 20:02 g1ra

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

xXPhenomXx avatar Feb 03 '24 21:02 xXPhenomXx

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

tedcochran avatar Feb 04 '24 00:02 tedcochran

This is probably a bit better: better-workaround

tedcochran avatar Feb 04 '24 01:02 tedcochran

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.

kime541200 avatar Feb 04 '24 06:02 kime541200

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

PromtEngineer avatar Feb 05 '24 05:02 PromtEngineer

So, what was the bug?

NitkarshChourasia avatar Mar 31 '24 21:03 NitkarshChourasia

So, what was the bug?

@PromtEngineer which was introduced into the recent PR?

NitkarshChourasia avatar Mar 31 '24 21:03 NitkarshChourasia