Langchain-Chatchat
Langchain-Chatchat copied to clipboard
[BUG] 简洁阐述问题 / Concise description of the issue
问题描述 / Problem Description 用简洁明了的语言描述这个问题 / Describe the problem in a clear and concise manner.
复现问题的步骤 / Steps to Reproduce 部署执行 inti_database.py --recreate-vs
预期的结果 / Expected Result 描述应该出现的结果 / Describe the expected result.
实际结果 / Actual Result 描述实际发生的结果 / Describe the actual result.
环境信息 / Environment Information
- langchain-ChatGLM 版本/commit 号:0.2.10
- 是否使用 Docker 部署(是/否):否
- 使用的模型(ChatGLM2-6B / Qwen-7B 等):ChatGLM-6B
- 使用的 Embedding 模型(moka-ai/m3e-base 等):moka-ai
- 使用的向量库类型 (faiss / milvus / pg_vector 等): faiss
- 操作系统及版本 / Operating system and version: Ubuntu20.04
- Python 版本 / Python version: 3.11.0
- 其他相关环境信息 / Other relevant environment information:
附加信息 / Additional Information 添加与问题相关的任何其他信息 / Add any other information related to the issue. 2024-02-23 16:26:51,451 - embeddings_api.py[line:39] - ERROR: (MaxRetryError("HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /api/models/BAAI/bge-large-zh-v1.5 (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x7f1f440c3350>, 'Connection to huggingface.co timed out. (connect timeout=None)'))"), '(Request ID: 9a6415b5-5272-405b-9d62-3853e1023fcb)') AttributeError: 'NoneType' object has no attribute 'conjugate'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/apps/svr/Langchain/Langchain-Chatchat/init_database.py", line 107, in
🤖
嗨,@RaspberrySun!很高兴再次看到你。希望你一切都好!
根据您提供的错误信息,问题可能出现在 normalize 函数中,该函数在 base.py 文件中定义。这个函数的作用是对文档的嵌入进行归一化,它接收一个浮点数的列表(代表文档的嵌入)作为输入,并返回一个相同形状的 numpy 数组,其中每个嵌入向量都被归一化为单位范数。
这个错误信息表明 normalize 函数接收到了一个 NoneType 参数,这是不被支持的。这可能是因为在调用 normalize 函数之前,embeddings 参数没有正确地初始化或赋值。
我建议您检查调用 normalize 函数的代码,确保在将 embeddings 参数传入函数之前,它已经被正确地初始化并赋值为一个浮点数的列表。
此外,我在 Langchain-Chatchat 仓库中找到了几个类似的已解决问题,可能对您有所帮助:
这些问题的解决方案包括确保 sentence-transformers 包正确安装,手动下载 bge-large-zh 模型,修改 model_config.py 文件以更新 EMBEDDING_MODEL 和 MODEL_PATH,以及检查网络连接等。
如果问题仍然存在,可能需要更多的上下文信息来提供更好的解决方案。
Sources
- [BUG] 3. 初始化知识库和配置文件 报错 python init_database.py --recreate-vs
- 初始化不成功,请指导
- 创建知识库出错
- init_database.py
- server/knowledge_base/kb_service/base.py
About Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.
Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.
If you want to continue the conversation, start your reply with @dosu-bot.
两种解决方案,一个是降级langchain- community,严格按照req装,另一个检查自己文件有没有全,大概率问题是后者,模型文件少了