关于Graphrag调用阿里云embedding API出错的解决办法分享
·
其实在本地部署Graphrag按照官方的教程:https://microsoft.github.io/graphrag/get_started/一步一步执行便可。但是在运行命令执行之后:
graphrag index --root ./christmas
会莫名的中断,我在查看了日志之后发现,是因为我调用的是阿里云的embedding API然后与settings.yaml文件里面的初始设置冲突有关系:
14:08:34,572 graphrag.index.operations.embed_text.strategies.openai INFO embedding 25 inputs via 25 snippets using 2 batches. max_batch_size=16, batch_max_tokens=8191
14:08:37,135 httpx INFO HTTP Request: POST
因为阿里云DashScope的embedding API限制批处理大小不能超过10,但默认设置的是16,所以在settings.yaml文件里面更改:
models:
default_chat_model:
...(前面不变)
max_batch_size: 8
default_embedding_model:
...(前面不变)
max_batch_size: 8
embed_text:
model_id: default_embedding_model
vector_store_id: default_vector_store
batch_size: 8
batch_max_tokens: 8191
然后还需要在graphrag/index/operations/embed_text/strategies/openai.py这个文件里面对应地方进行改成8:

更多推荐

所有评论(0)