neo4j-labs / llm-graph-builder

Neo4j graph construction from unstructured data using LLMs
https://neo4j.com/labs/genai-ecosystem/llm-graph-builder/
Apache License 2.0
2.31k stars 372 forks source link

Backend is not working because of the huggingface file not found error !!! #616

Closed tanaydalmia closed 3 months ago

tanaydalmia commented 3 months ago

File "/code/src/QA_integration_new.py", line 39, in EMBEDDINGFUNCTION , = load_embedding_model(EMBEDDING_MODEL) File "/code/src/shared/common_fn.py", line 89, in load_embedding_model embeddings = SentenceTransformerEmbeddings( File "/usr/local/lib/python3.10/site-packages/langchain_core/_api/deprecation.py", line 203, in warn_if_direct_instance return wrapped(self, *args, kwargs) File "/usr/local/lib/python3.10/site-packages/langchain_community/embeddings/huggingface.py", line 79, in init self.client = sentence_transformers.SentenceTransformer( File "/usr/local/lib/python3.10/site-packages/sentence_transformers/SentenceTransformer.py", line 197, in init modules = self._load_sbert_model( File "/usr/local/lib/python3.10/site-packages/sentence_transformers/SentenceTransformer.py", line 1296, in _load_sbert_model module = Transformer(model_name_or_path, cache_dir=cache_folder, kwargs) File "/usr/local/lib/python3.10/site-packages/sentence_transformers/models/Transformer.py", line 36, in init self._load_model(model_name_or_path, config, cache_dir, **model_args) File "/usr/local/lib/python3.10/site-packages/sentence_transformers/models/Transformer.py", line 65, in _load_model self.auto_model = AutoModel.from_pretrained( File "/usr/local/lib/python3.10/site-packages/transformers/models/auto/auto_factory.py", line 564, in from_pretrained return model_class.from_pretrained( File "/usr/local/lib/python3.10/site-packages/transformers/modeling_utils.py", line 3638, in from_pretrained state_dict = load_state_dict(resolved_archive_file) File "/usr/local/lib/python3.10/site-packages/transformers/modeling_utils.py", line 523, in load_state_dict return safe_load_file(checkpoint_file) File "/usr/local/lib/python3.10/site-packages/safetensors/torch.py", line 308, in load_file with safe_open(filename, framework="pt", device=device) as f: RuntimeError: unable to open file </root/.cache/huggingface/hub/models--sentence-transformers--all-MiniLM-L6-v2/snapshots/8b3219a92973c328a8e22fadcfa821b5dc75636a/model.safetensors> in read-only mode: No such file or directory (2)

Currently using the dev branch, with all environment file. OS - windows, checked the .cache folder and it consists of the file.

kartikpersistent commented 3 months ago

@praveshkumar1988

aaroneden commented 3 months ago

I'm running into this too --- Mac Mini M1 system.

Did anyone find a workaround?

kartikpersistent commented 3 months ago

Hi @aaroneden and @tanaydalmia try adding this env in the backend env file. SENTENCE _TRANSFORMERS_HOME="/tmp/sentence_transformers"

tanaydalmia commented 3 months ago

@kartikpersistent Didn't work for me. Now it's saying directory /tmp/ not found. "FileNotFoundError: [Errno 2] No such file or directory: '/tmp/sentence_transformers/models--sentence-transformers--all-MiniLM-L6-v2/snapshots/8b3219a92973c328a8e22fadcfa821b5dc75636a/special_tokens_map.json'"

kartikpersistent commented 3 months ago

@praveshkumar1988

karanchellani commented 3 months ago

@tanaydalmia this issue is fixed in DEV now

tanaydalmia commented 3 months ago

It is working now, thanks.