localGPT icon indicating copy to clipboard operation
localGPT copied to clipboard

How to solve ValueError: Dependencies for InstructorEmbedding not found. Error

Open ayush20501 opened this issue 1 year ago • 5 comments

from huggingface_hub import HfApi, hf_hub_url, cached_download, HfFolder ImportError: cannot import name 'cached_download' from 'huggingface_hub' (C:\Users\ayush\anaconda3\envs\env_localGPT\lib\site-packages\huggingface_hub_init_.py)

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "C:\Users\ayush\OneDrive\Documents\localGPT\ingest.py", line 185, in main() File "C:\Users\ayush\anaconda3\envs\env_localGPT\lib\site-packages\click\core.py", line 1157, in call return self.main(*args, **kwargs) File "C:\Users\ayush\anaconda3\envs\env_localGPT\lib\site-packages\click\core.py", line 1078, in main rv = self.invoke(ctx) File "C:\Users\ayush\anaconda3\envs\env_localGPT\lib\site-packages\click\core.py", line 1434, in invoke return ctx.invoke(self.callback, **ctx.params) File "C:\Users\ayush\anaconda3\envs\env_localGPT\lib\site-packages\click\core.py", line 783, in invoke return __callback(*args, **kwargs) File "C:\Users\ayush\OneDrive\Documents\localGPT\ingest.py", line 169, in main embeddings = get_embeddings(device_type) File "C:\Users\ayush\OneDrive\Documents\localGPT\utils.py", line 35, in get_embeddings return HuggingFaceInstructEmbeddings( File "C:\Users\ayush\anaconda3\envs\env_localGPT\lib\site-packages\langchain\embeddings\huggingface.py", line 152, in init raise ValueError("Dependencies for InstructorEmbedding not found.") from e ValueError: Dependencies for InstructorEmbedding not found.

ayush20501 avatar Nov 10 '24 14:11 ayush20501

I am facing the same problem. Did someone find a solution for this? I tried several things like changing transformers version to 2.2.2 it didn't solve the problem.

TinoCoda avatar Nov 11 '24 16:11 TinoCoda

I was able to solve this issue by installing the huggingface-hub package.

pip install huggingface-hub===0.24.0

nvsreerag avatar Nov 12 '24 04:11 nvsreerag

yes, it solved the problem, but I think we need to remove it "cached_download" since it is deprecated and will be replaced by "hf_hub_download". @sreeragnv-intel thank you very much for your valuable contribution 👍

image

TinoCoda avatar Nov 12 '24 09:11 TinoCoda

@TinoCoda

Are you able to the run the whole code??

ayush20501 avatar Nov 12 '24 11:11 ayush20501

@ayush20501 no. I can run the following command python ingest.py --device_type cpu, then DB folder is created with a chroma.sqlite3 file inside of it and a subfolder with an ID like name f60fb72d-bbda-4982-bb2b-804501036dcf. But I haven't yet successfuly executed python run_localGPT --device_type cpu. I am working in two different computers (private computer and work computer). I'll keep you updated if I make it.

TinoCoda avatar Nov 12 '24 11:11 TinoCoda