HKUDS / LightRAG

"LightRAG: Simple and Fast Retrieval-Augmented Generation"
https://arxiv.org/abs/2410.05779
MIT License
9.78k stars 1.22k forks source link

IndexError: index 0 is out of bounds for dimension 0 with size 0 INFO:lightrag:Writing graph with 0 nodes, 0 edges #331

Open emt0re0 opened 23 hours ago

emt0re0 commented 23 hours ago

INFO:lightrag:Logger initialized for working directory: /e2e-data/users/lzh/code/LightRAG-main/workspace INFO:lightrag:Load KV llm_response_cache with 0 data INFO:lightrag:Load KV full_docs with 0 data INFO:lightrag:Load KV text_chunks with 0 data INFO:nano-vectordb:Init {'embedding_dim': 384, 'metric': 'cosine', 'storage_file': '/e2e-data/users/lzh/code/LightRAG-main/workspace/vdb_entities.json'} 0 data INFO:nano-vectordb:Init {'embedding_dim': 384, 'metric': 'cosine', 'storage_file': '/e2e-data/users/lzh/code/LightRAG-main/workspace/vdb_relationships.json'} 0 data INFO:nano-vectordb:Init {'embedding_dim': 384, 'metric': 'cosine', 'storage_file': '/e2e-data/users/lzh/code/LightRAG-main/workspace/vdb_chunks.json'} 0 data INFO:lightrag:[New Docs] inserting 1 docs INFO:lightrag:[New Chunks] inserting 42 chunks INFO:lightrag:Inserting 42 vectors to chunks INFO:lightrag:[Entity Extraction]... Special tokens have been added in the vocabulary, make sure the associated word embeddings are fine-tuned or trained. INFO:accelerate.utils.modeling:We will use 90% of the memory on device 0 for storing the model, and 10% for the buffer to avoid OOM. You can set max_memory in to a higher value to use more memory (at your own risk). Loading checkpoint shards: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 4/4 [00:21<00:00, 5.27s/it] /usr/local/lib/python3.10/dist-packages/transformers/generation/configuration_utils.py:588: UserWarning: num_beams is set to 1. However, early_stopping is set to True -- this flag is only used in beam-based generation modes. You should set num_beams>1 or unset early_stopping. warnings.warn( INFO:lightrag:Writing graph with 0 nodes, 0 edges Traceback (most recent call last): File "/e2e-data/users/lzh/code/LightRAG-main/examples/lightrag_hf_demo.py", line 40, in rag.insert(f.read()) File "/e2e-data/users/lzh/code/LightRAG-main/lightrag/lightrag.py", line 225, in insert return loop.run_until_complete(self.ainsert(string_or_strings)) File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete return future.result() File "/e2e-data/users/lzh/code/LightRAG-main/lightrag/lightrag.py", line 274, in ainsert maybe_new_kg = await extract_entities( File "/e2e-data/users/lzh/code/LightRAG-main/lightrag/operate.py", line 333, in extract_entities results = await asyncio.gather( File "/e2e-data/users/lzh/code/LightRAG-main/lightrag/operate.py", line 272, in _process_single_content final_result = await use_llm_func(hint_prompt) File "/e2e-data/users/lzh/code/LightRAG-main/lightrag/utils.py", line 89, in wait_func result = await func(*args, *kwargs) File "/e2e-data/users/lzh/code/LightRAG-main/lightrag/llm.py", line 510, in hf_model_complete return await hf_model_if_cache( File "/e2e-data/users/lzh/code/LightRAG-main/lightrag/llm.py", line 286, in hf_model_if_cache output = hf_model.generate( File "/usr/local/lib/python3.10/dist-packages/torch/utils/_contextlib.py", line 115, in decorate_context return func(args, kwargs) File "/usr/local/lib/python3.10/dist-packages/transformers/generation/utils.py", line 1914, in generate result = self._sample( File "/usr/local/lib/python3.10/dist-packages/transformers/generation/utils.py", line 2648, in _sample model_inputs = self.prepare_inputs_for_generation(input_ids, model_kwargs) File "/usr/local/lib/python3.10/dist-packages/transformers/models/qwen2/modeling_qwen2.py", line 1277, in prepare_inputs_for_generation past_length = cache_position[0] if cache_position is not None else past_key_values.get_seq_length() IndexError: index 0 is out of bounds for dimension 0 with size 0

emt0re0 commented 23 hours ago

rag = LightRAG( working_dir=WORKING_DIR, llm_model_func=hf_model_complete, llm_model_name="/e2e-data/users/lzh/model/qwen2.5-7B-Instruct", embedding_func=EmbeddingFunc( embedding_dim=384, max_token_size=5000, func=lambda texts: hf_embedding( texts, tokenizer=AutoTokenizer.from_pretrained( "/e2e-data/users/lzh/model/all-MiniLM-L6-v2" ), embed_model=AutoModel.from_pretrained( "/e2e-data/users/lzh/model/all-MiniLM-L6-v2" ), ), ), )