chatchat-space / Langchain-Chatchat

Langchain-Chatchat(原Langchain-ChatGLM)基于 Langchain 与 ChatGLM, Qwen 与 Llama 等语言模型的 RAG 与 Agent 应用 | Langchain-Chatchat (formerly langchain-ChatGLM), local knowledge based LLM (like ChatGLM, Qwen and Llama) RAG and Agent app with langchain
Apache License 2.0
32.04k stars 5.57k forks source link

AttributeError: module 'faiss' has no attribute 'read_index'2024-04-19 00:34:05,418 - utils.py[line:197] - ERROR: RemoteProtocolError: API通信遇到错误:peer closed connection without sending complete message body (incomplete chunked read) #3809

Closed zmwstu closed 6 months ago

zmwstu commented 7 months ago

所有报错信息如下: 在进行知识库对话的时候,就出现了这问题,之前从来没有过。 2024-04-19 00:34:05,408 - faiss_cache.py[line:92] - INFO: loading vector store in 'samples/vector_store/m3e-base' from disk. ERROR: Exception in ASGI application Traceback (most recent call last): File "/home/zwm/miniconda3/envs/Langchain-Chatchat2/lib/python3.11/site-packages/sse_starlette/sse.py", line 269, in call await wrap(partial(self.listen_for_disconnect, receive)) File "/home/zwm/miniconda3/envs/Langchain-Chatchat2/lib/python3.11/site-packages/sse_starlette/sse.py", line 258, in wrap await func() File "/home/zwm/miniconda3/envs/Langchain-Chatchat2/lib/python3.11/site-packages/sse_starlette/sse.py", line 215, in listen_for_disconnect message = await receive() ^^^^^^^^^^^^^^^ File "/home/zwm/miniconda3/envs/Langchain-Chatchat2/lib/python3.11/site-packages/uvicorn/protocols/http/httptools_impl.py", line 568, in receive await self.message_event.wait() File "/home/zwm/miniconda3/envs/Langchain-Chatchat2/lib/python3.11/asyncio/locks.py", line 213, in wait await fut asyncio.exceptions.CancelledError: Cancelled by cancel scope 7f78df4f43d0

During handling of the above exception, another exception occurred:

dosubot[bot] commented 7 months ago

The error AttributeError: module 'faiss' has no attribute 'read_index' suggests there's a mismatch between the FAISS library version and its usage in your code. The FAISS.load_local method is correctly used for loading a vector store from disk, which does not directly call a read_index method. This issue might be due to an incorrect expectation of the FAISS module's capabilities as extended by the langchain.vectorstores.faiss module or a version incompatibility.

Ensure that your environment is set up according to the langchain package requirements, specifically with the correct version of the FAISS library, which is 1.7.4 for the Langchain-Chatchat application. This setup is crucial for the FAISS.load_local method to function properly, as it's designed to load the vector store with specific parameters like normalize_L2 and distance_strategy.

For resolving this issue, verify the version of the FAISS library installed in your environment and ensure it matches the expected version by the langchain package. Adjustments to the environment or the code might be necessary to align with the correct FAISS library capabilities and the langchain package's expectations.

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.