Langchain-Chatchat icon indicating copy to clipboard operation
Langchain-Chatchat copied to clipboard

[BUG] 简洁阐述问题 / python init_database.py --recreate-vs

Open cq134cq opened this issue 1 year ago • 7 comments

问题描述 / Problem Description 用简洁明了的语言描述这个问题 / Describe the problem in a clear and concise manner.

复现问题的步骤 / Steps to Reproduce

  1. 执行 '...' / Run '...'
  2. 点击 '...' / Click '...'
  3. 滚动到 '...' / Scroll to '...'
  4. 问题出现 / Problem occurs

预期的结果 / Expected Result 描述应该出现的结果 / Describe the expected result.

实际结果 / Actual Result 描述实际发生的结果 / Describe the actual result.

环境信息 / Environment Information

  • langchain-ChatGLM 版本/commit 号:0.2.10

  • 是否使用 Docker 部署(是/否):no

  • 使用的模型(ChatGLM2-6B / Qwen-7B 等):ChatGLM3-6B

  • 使用的 Embedding 模型(moka-ai/m3e-base 等):bge-large-zh

  • 使用的向量库类型 (faiss / milvus / pg_vector 等): faiss / Vector library used (faiss, milvus, pg_vector, etc.): faiss

  • 操作系统及版本 / Operating system and version:win11

  • Python 版本 / Python version:3.10

  • 其他相关环境信息 / Other relevant environment information:

附加信息 / Additional Information 添加与问题相关的任何其他信息 / >python init_database.py --recreate-vs Traceback (most recent call last): File "C:\soft\lc\init_database.py", line 3, in from server.knowledge_base.migrate import (create_tables, reset_tables, import_from_db, File "C:\soft\lc\server\knowledge_base\migrate.py", line 6, in from server.knowledge_base.utils import ( File "C:\soft\lc\server\knowledge_base\utils.py", line 15, in import langchain.document_loaders File "C:\soft\lc\lib\site-packages\langchain\document_loaders_init_.py", line 18, in from langchain_community.document_loaders.acreom import AcreomLoader File "C:\soft\lc\lib\site-packages\langchain_community\document_loaders_init_.py", line 163, in from langchain_community.document_loaders.pebblo import PebbloSafeLoader File "C:\soft\lc\lib\site-packages\langchain_community\document_loaders\pebblo.py", line 5, in import pwd ModuleNotFoundError: No module named 'pwd' 请问这个如何解决 我安装全部依赖 $ pip install -r requirements.txt $ pip install -r requirements_api.txt $ pip install -r requirements_webui.txt

cq134cq avatar Feb 22 '24 05:02 cq134cq

🤖

哈喽,@cq134cq!很高兴再次遇见你。希望你今天过得不错!

根据我在Langchain-Chatchat仓库中找到的相关问题,这个问题可能是由于'pwd'模块是Unix特定的服务,而在Windows上并不可用导致的。'pwd'模块用于密码数据库,用于存储和访问用户信息。

解决这个问题,你需要找到在你的项目中哪里导入了'pwd'模块,并用Windows兼容的替代方案替换它。

然而,根据提供的上下文,'pwd'模块并没有在'init_database.py'文件中被导入。因此,错误必须发生在另一个文件或模块中,'init_database.py'依赖于这个文件或模块。

没有完整的代码库或导入'pwd'的具体文件,我无法提供具体的解决方案。

请提供导入'pwd'的文件或模块,以便我提供更准确的解决方案。

此外,我还找到了一些可能有用的解决方案:

  1. 你可以尝试降级langchain-community到0.0.19版本,因为在这个问题中,有用户提到0.0.20版本存在问题,他们将在修复后再发布新版本。你可以通过执行pip install langchain-community==0.0.19来降级。

  2. 这个问题中,有用户提到需要手动下载bge-large-zh模型,并修改model_config.py文件中的EMBEDDING_MODELMODEL_PATH为模型存储的正确路径。然后运行python copy_config_example.py来应用更改。

  3. 这个问题中,有用户提到需要卸载并重新安装pydantic。你可以通过执行pip uninstall pydanticpip install pydantic来完成。

希望这些信息对你有所帮助。如果你有更多的信息或问题,请随时提问。

Sources

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.

dosubot[bot] avatar Feb 22 '24 05:02 dosubot[bot]

pip install langchain-community==0.0.19 使用这个命令可以了,谢谢

cq134cq avatar Feb 22 '24 05:02 cq134cq

(c:\soft\lc) C:\soft\lc>python init_database.py --recreate-vs recreating all vector stores 2024-02-22 13:57:09,547 - faiss_cache.py[line:92] - INFO: loading vector store in 'samples/vector_store/bge-large-zh' from disk. 2024-02-22 13:57:09,901 - SentenceTransformer.py[line:66] - INFO: Load pretrained SentenceTransformer: BAAI\bge-large-zh 2024-02-22 13:57:10,973 - embeddings_api.py[line:39] - ERROR: Torch not compiled with CUDA enabled AttributeError: 'NoneType' object has no attribute 'conjugate'

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "C:\soft\lc\init_database.py", line 107, in folder2db(kb_names=args.kb_name, mode="recreate_vs", embed_model=args.embed_model) File "C:\soft\lc\server\knowledge_base\migrate.py", line 126, in folder2db kb.create_kb() File "C:\soft\lc\server\knowledge_base\kb_service\base.py", line 80, in create_kb self.do_create_kb() File "C:\soft\lc\server\knowledge_base\kb_service\faiss_kb_service.py", line 51, in do_create_kb self.load_vector_store() File "C:\soft\lc\server\knowledge_base\kb_service\faiss_kb_service.py", line 28, in load_vector_store return kb_faiss_pool.load_vector_store(kb_name=self.kb_name, File "C:\soft\lc\server\knowledge_base\kb_cache\faiss_cache.py", line 102, in load_vector_store vector_store = self.new_vector_store(embed_model=embed_model, embed_device=embed_device) File "C:\soft\lc\server\knowledge_base\kb_cache\faiss_cache.py", line 60, in new_vector_store vector_store = FAISS.from_documents([doc], embeddings, normalize_L2=True,distance_strategy="METRIC_INNER_PRODUCT") File "C:\soft\lc\lib\site-packages\langchain_core\vectorstores.py", line 508, in from_documents return cls.from_texts(texts, embedding, metadatas=metadatas, **kwargs) File "C:\soft\lc\lib\site-packages\langchain_community\vectorstores\faiss.py", line 959, in from_texts embeddings = embedding.embed_documents(texts) File "C:\soft\lc\server\knowledge_base\kb_service\base.py", line 420, in embed_documents return normalize(embeddings).tolist() File "C:\soft\lc\server\knowledge_base\kb_service\base.py", line 37, in normalize norm = np.linalg.norm(embeddings, axis=1) File "<array_function internals>", line 200, in norm File "C:\soft\lc\lib\site-packages\numpy\linalg\linalg.py", line 2541, in norm s = (x.conj() * x).real TypeError: loop of ufunc does not support argument 0 of type NoneType which has no callable conjugate method 请问这个如何解决,我以安装了,可以还是有问题 pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118

cq134cq avatar Feb 22 '24 05:02 cq134cq

pip install langchain-community==0.0.19 使用这个命令可以了,谢谢

我还是会报loop of ufunc does not support argument 0 of type Nodetype which has no callable conjugate method的错误。。。。

Nancy-wangxixi avatar Feb 22 '24 07:02 Nancy-wangxixi

pip install langchain-community==0.0.19 使用这个命令可以了,谢谢

我也是用这个命令以后,开始报TypeError: loop of ufunc does not support argument 0 of type NoneType which has no callable conjugate method

kevinchi8781 avatar Feb 22 '24 22:02 kevinchi8781

你们的版本是0.2.10 langchain-ChatGLM 版本/commit 号:0.2.10

cq134cq avatar Feb 23 '24 00:02 cq134cq

pip install langchain-community==0.0.19 使用这个命令可以了,谢谢

我也是用这个命令以后,开始报TypeError: loop of ufunc does not support argument 0 of type NoneType which has no callable conjugate method

请问你们这个怎么解决的呀

cackako avatar Feb 23 '24 01:02 cackako

这个是embedding模型没全吧,我又一次遇到了这个问题后检查模型文件发现是没全,一个embed模型都是几个G,少了就是文件没全

zRzRzRzRzRzRzR avatar Feb 24 '24 02:02 zRzRzRzRzRzRzR

同问

chunshengding avatar Mar 15 '24 08:03 chunshengding