You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying out the repo with the same structure as the DeepSeek example with local llama 3.1 8B as both the best and cheap model. The problem is, I get empty dictionaries from the entity extraction results. I thought it was a token context problem, so I even reduced the max token size down to 4096 and even 1024 with the same outcome, so they were probably not the cause. I need your help to figure out why this is not working with llama 3.1 8B, so far I'm thinking the cause could be a combination of these:
Model capabilities: Llama 3.1 8B might not be as capable as GPT-4 in understanding and following complex instructions for entity extraction.
Prompt format: The entity extraction prompt might be optimized for GPT-4 and not suitable for Llama 3.1 8B.
I can confirm that this works with either GPT-4 or DeepSeek-v2 chat. Do we need some kind of prompt format specifically for smaller models?
Updates:
Simplifying the entity extraction prompt to something super simple for llama 3.1 8B did not work:
entity_extract_prompt="""Extract entities from the following text. For each entity, provide:1. Entity type (PERSON, LOCATION, ORGANIZATION, etc.)2. Entity name3. Brief descriptionText: {input_text}Entities:"""
Error output:
Below is the error that I got with llama 3.1 8B:
DEBUG:nano-graphrag:Entity extraction results: [({}, {}), ({}, {}), ({}, {}), ({}, {}), ({}, {}), ({}, {}), ({}, {}), ({}, {}), ({}, {}), ({}, {}), ({}, {}), ({}, {}), ({}, {}), ({}, {}), ({}, {}), ({}, {}), ({}, {}), ({}, {}), ({}, {}), ({}, {}), ({}, {}), ({}, {}), ({}, {}), ({}, {}), ({}, {}), ({}, {}), ({}, {}), ({}, {}), ({}, {}), ({}, {}), ({}, {}), ({}, {}), ({}, {}), ({}, {}), ({}, {}), ({}, {}), ({}, {}), ({}, {}), ({}, {}), ({}, {}), ({}, {}), ({}, {})]
INFO:nano-graphrag:Inserting 0 vectors to entities
Traceback (most recent call last):
File "/Users/tiliu/Documents/nano-graphrag/examples/using_ollama_as_llm.py", line 103, in<module>
insert(text=text)
File "/Users/tiliu/Documents/nano-graphrag/examples/using_ollama_as_llm.py", line 95, in insert
rag.insert(text)
File "/Users/tiliu/Documents/nano-graphrag/nano_graphrag/graphrag.py", line 145, in insert
return loop.run_until_complete(self.ainsert(string_or_strings))
File "/opt/homebrew/Caskroom/miniconda/base/envs/nano-graphrag/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
returnfuture.result()
File "/Users/tiliu/Documents/nano-graphrag/nano_graphrag/graphrag.py", line 226, in ainsert
self.chunk_entity_relation_graph = await extract_entities(
File "/Users/tiliu/Documents/nano-graphrag/nano_graphrag/_op.py", line 335, in extract_entities
await entity_vdb.upsert(data_for_vdb)
File "/Users/tiliu/Documents/nano-graphrag/nano_graphrag/_storage.py", line 108, in upsert
embeddings = np.concatenate(embeddings_list)
ValueError: need at least one array to concatenate
Yeah, I agree with you on the specific prompts for smaller models.
Many developers have said that smaller models like qwen2-7B have troubles on extracting entities and relations, I added a FAQ.md to claim this problem.
Description
Hey guys,
I'm trying out the repo with the same structure as the DeepSeek example with local llama 3.1 8B as both the best and cheap model. The problem is, I get empty dictionaries from the entity extraction results. I thought it was a token context problem, so I even reduced the max token size down to 4096 and even 1024 with the same outcome, so they were probably not the cause. I need your help to figure out why this is not working with llama 3.1 8B, so far I'm thinking the cause could be a combination of these:
I can confirm that this works with either GPT-4 or DeepSeek-v2 chat. Do we need some kind of prompt format specifically for smaller models?
Updates:
Simplifying the entity extraction prompt to something super simple for llama 3.1 8B did not work:
Error output:
Below is the error that I got with llama 3.1 8B:
Code to reproduce the error:
The text was updated successfully, but these errors were encountered: