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
31.43k stars 5.48k forks source link

[BUG] 初始化知识库报错 / WARNING: Retrying chatchat.server.localai_embeddings.embed_with_retry.<locals>._embed_with_retry in 4.0 seconds as it raised NotFoundError: Error code: 404 - {'detail': 'Not Found'} #4334

Closed huangyuanzhuo-coder closed 3 months ago

huangyuanzhuo-coder commented 3 months ago

问题描述 / Problem Description 貌似没有成功加载xinference上的bge-large-zh-v1.5,是配置哪里不太对吗? 企业微信截图_20240627091434 企业微信截图_20240627091539

实际结果 / Actual Result

2024-06-26 18:43:50,959 - before_sleep.py[line:65] - WARNING: Retrying chatchat.server.localai_embeddings.embed_with_retry.<locals>._embed_with_retry in 4.0 seconds as it raised NotFoundError: Error code: 404 - {'detail': 'Not Found'}.
2024-06-26 18:43:54,968 - before_sleep.py[line:65] - WARNING: Retrying chatchat.server.localai_embeddings.embed_with_retry.<locals>._embed_with_retry in 4.0 seconds as it raised NotFoundError: Error code: 404 - {'detail': 'Not Found'}.
2024-06-26 18:43:58,977 - before_sleep.py[line:65] - WARNING: Retrying chatchat.server.localai_embeddings.embed_with_retry.<locals>._embed_with_retry in 4.0 seconds as it raised NotFoundError: Error code: 404 - {'detail': 'Not Found'}.
2024-06-26 18:44:02,985 - before_sleep.py[line:65] - WARNING: Retrying chatchat.server.localai_embeddings.embed_with_retry.<locals>._embed_with_retry in 8.0 seconds as it raised NotFoundError: Error code: 404 - {'detail': 'Not Found'}.
2024-06-26 18:44:10,994 - before_sleep.py[line:65] - WARNING: Retrying chatchat.server.localai_embeddings.embed_with_retry.<locals>._embed_with_retry in 10.0 seconds as it raised NotFoundError: Error code: 404 - {'detail': 'Not Found'}.
2024-06-26 18:44:21,003 - utils.py[line:648] - ERROR: error in sub thread: Error code: 404 - {'detail': 'Not Found'}
Traceback (most recent call last):
  File "/home/hyz/Langchain-Chatchat/libs/chatchat-server/chatchat/server/utils.py", line 646, in run_in_thread_pool
    yield obj.result()
          ^^^^^^^^^^^^
  File "/opt/anaconda3/envs/Langchain_Chatchat_2/lib/python3.11/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/opt/anaconda3/envs/Langchain_Chatchat_2/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/opt/anaconda3/envs/Langchain_Chatchat_2/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/hyz/Langchain-Chatchat/libs/chatchat-server/chatchat/server/localai_embeddings.py", line 332, in task
    return (seq, self._embedding_func(text, engine=self.deployment))
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/hyz/Langchain-Chatchat/libs/chatchat-server/chatchat/server/localai_embeddings.py", line 288, in _embedding_func
    embed_with_retry(
  File "/home/hyz/Langchain-Chatchat/libs/chatchat-server/chatchat/server/localai_embeddings.py", line 108, in embed_with_retry
    return _embed_with_retry(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/anaconda3/envs/Langchain_Chatchat_2/lib/python3.11/site-packages/tenacity/__init__.py", line 336, in wrapped_f
    return copy(f, *args, **kw)
           ^^^^^^^^^^^^^^^^^^^^
  File "/opt/anaconda3/envs/Langchain_Chatchat_2/lib/python3.11/site-packages/tenacity/__init__.py", line 475, in __call__
    do = self.iter(retry_state=retry_state)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/anaconda3/envs/Langchain_Chatchat_2/lib/python3.11/site-packages/tenacity/__init__.py", line 376, in iter
    result = action(retry_state)
             ^^^^^^^^^^^^^^^^^^^
  File "/opt/anaconda3/envs/Langchain_Chatchat_2/lib/python3.11/site-packages/tenacity/__init__.py", line 418, in exc_check
    raise retry_exc.reraise()
          ^^^^^^^^^^^^^^^^^^^
  File "/opt/anaconda3/envs/Langchain_Chatchat_2/lib/python3.11/site-packages/tenacity/__init__.py", line 185, in reraise
    raise self.last_attempt.result()
          ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/anaconda3/envs/Langchain_Chatchat_2/lib/python3.11/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/opt/anaconda3/envs/Langchain_Chatchat_2/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/opt/anaconda3/envs/Langchain_Chatchat_2/lib/python3.11/site-packages/tenacity/__init__.py", line 478, in __call__
    result = fn(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^
  File "/home/hyz/Langchain-Chatchat/libs/chatchat-server/chatchat/server/localai_embeddings.py", line 105, in _embed_with_retry
    response = embeddings.client.create(**kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/anaconda3/envs/Langchain_Chatchat_2/lib/python3.11/site-packages/openai/resources/embeddings.py", line 114, in create
    return self._post(
           ^^^^^^^^^^^
  File "/opt/anaconda3/envs/Langchain_Chatchat_2/lib/python3.11/site-packages/openai/_base_client.py", line 1250, in post
    return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/anaconda3/envs/Langchain_Chatchat_2/lib/python3.11/site-packages/openai/_base_client.py", line 931, in request
    return self._request(
           ^^^^^^^^^^^^^^
  File "/opt/anaconda3/envs/Langchain_Chatchat_2/lib/python3.11/site-packages/openai/_base_client.py", line 1030, in _request
    raise self._make_status_error_from_response(err.response) from None
openai.NotFoundError: Error code: 404 - {'detail': 'Not Found'}
2024-06-26 18:44:21,215 - faiss_cache.py[line:147] - ERROR: list index out of range
Traceback (most recent call last):
  File "/home/hyz/Langchain-Chatchat/libs/chatchat-server/chatchat/server/knowledge_base/kb_cache/faiss_cache.py", line 133, in load_vector_store
    vector_store = self.new_vector_store(
                   ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/hyz/Langchain-Chatchat/libs/chatchat-server/chatchat/server/knowledge_base/kb_cache/faiss_cache.py", line 66, in new_vector_store
    vector_store = FAISS.from_documents([doc], embeddings, normalize_L2=True)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/anaconda3/envs/Langchain_Chatchat_2/lib/python3.11/site-packages/langchain_core/vectorstores.py", line 635, in from_documents
    return cls.from_texts(texts, embedding, metadatas=metadatas, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/anaconda3/envs/Langchain_Chatchat_2/lib/python3.11/site-packages/langchain_community/vectorstores/faiss.py", line 931, in from_texts
    return cls.__from(
           ^^^^^^^^^^^
  File "/opt/anaconda3/envs/Langchain_Chatchat_2/lib/python3.11/site-packages/langchain_community/vectorstores/faiss.py", line 888, in __from
    index = faiss.IndexFlatL2(len(embeddings[0]))
                                  ~~~~~~~~~~^^^
IndexError: list index out of range
2024-06-26 18:44:21,217 - init_database.py[line:152] - ERROR: 向量库 samples 加载失败。
Traceback (most recent call last):
  File "/home/hyz/Langchain-Chatchat/libs/chatchat-server/chatchat/server/knowledge_base/kb_cache/faiss_cache.py", line 133, in load_vector_store
    vector_store = self.new_vector_store(
                   ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/hyz/Langchain-Chatchat/libs/chatchat-server/chatchat/server/knowledge_base/kb_cache/faiss_cache.py", line 66, in new_vector_store
    vector_store = FAISS.from_documents([doc], embeddings, normalize_L2=True)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/anaconda3/envs/Langchain_Chatchat_2/lib/python3.11/site-packages/langchain_core/vectorstores.py", line 635, in from_documents
    return cls.from_texts(texts, embedding, metadatas=metadatas, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/anaconda3/envs/Langchain_Chatchat_2/lib/python3.11/site-packages/langchain_community/vectorstores/faiss.py", line 931, in from_texts
    return cls.__from(
           ^^^^^^^^^^^
  File "/opt/anaconda3/envs/Langchain_Chatchat_2/lib/python3.11/site-packages/langchain_community/vectorstores/faiss.py", line 888, in __from
    index = faiss.IndexFlatL2(len(embeddings[0]))
                                  ~~~~~~~~~~^^^
IndexError: list index out of range
`
![image](https://github.com/chatchat-space/Langchain-Chatchat/assets/61539382/ba3c2d16-3289-4179-b9a0-aca367818b39)
![image](https://github.com/chatchat-space/Langchain-Chatchat/assets/61539382/ba3c2d16-3289-4179-b9a0-aca367818b39)

![image](https://github.com/chatchat-space/Langchain-Chatchat/assets/61539382/69b382bd-ca1e-4b55-b0cf-266b48c338a0)
![image](https://github.com/chatchat-space/Langchain-Chatchat/assets/61539382/69b382bd-ca1e-4b55-b0cf-266b48c338a0)
![image](https://github.com/chatchat-space/Langchain-Chatchat/assets/61539382/69b382bd-ca1e-4b55-b0cf-266b48c338a0)

![image](https://github.com/chatchat-space/Langchain-Chatchat/assets/61539382/6d8de60f-39a2-4c89-bcc8-d48551983f27)
![image](https://github.com/chatchat-space/Langchain-Chatchat/assets/61539382/6d8de60f-39a2-4c89-bcc8-d48551983f27)
ixiami1314 commented 3 months ago

你的 faiss 库是咋装上的啊,我这边直接就提示 faiss 找不到模块。 如果直接安装的话,faiss 又不支持高版本的 python

ixiami1314 commented 3 months ago

我试了下,直接用指令升到最新版本就OK了 pip install --upgrade langchain-chatchat

huangyuanzhuo-coder commented 3 months ago

你的 faiss 库是咋装上的啊,我这边直接就提示 faiss 找不到模块。 如果直接安装的话,faiss 又不支持高版本的 python

我用源码配置的,没直接安langchain-chatchat,faiss就直接pip的faiss-cpu 但我看faiss好像用的是langchain里面的,可能是langchain版本不太对?

morego123 commented 3 months ago

你的 faiss 库是咋装上的啊,我这边直接就提示 faiss 找不到模块。 如果直接安装的话,faiss 又不支持高版本的 python

我用源码配置的,没直接安langchain-chatchat,faiss就直接pip的faiss-cpu 但我看faiss好像用的是langchain里面的,可能是langchain版本不太对?

想请教一下如何源码启动langchain-chatchat啊,xinference我已经配置好了

huangyuanzhuo-coder commented 3 months ago

你的 faiss 库是咋装上的啊,我这边直接就提示 faiss 找不到模块。 如果直接安装的话,faiss 又不支持高版本的 python

我用源码配置的,没直接安langchain-chatchat,faiss就直接pip的faiss-cpu 但我看faiss好像用的是langchain里面的,可能是langchain版本不太对?

想请教一下如何源码启动langchain-chatchat啊,xinference我已经配置好了

可以看看项目里./docs/contributing/README_dev.md

morego123 commented 3 months ago

你的 faiss 库是咋装上的啊,我这边直接就提示 faiss 找不到模块。 如果直接安装的话,faiss 又不支持高版本的 python

我用源码配置的,没直接安langchain-chatchat,faiss就直接pip的faiss-cpu 但我看faiss好像用的是langchain里面的,可能是langchain版本不太对?

想请教一下如何源码启动langchain-chatchat啊,xinference我已经配置好了

可以看看项目里./docs/contributing/README_dev.md

参考这个说明了,poetry都安装好了,启动的时候报这个错 https://github.com/chatchat-space/Langchain-Chatchat/issues/4340, 请问你是怎么启动项目的?

huangyuanzhuo-coder commented 3 months ago

你的 faiss 库是咋装上的啊,我这边直接就提示 faiss 找不到模块。 如果直接安装的话,faiss 又不支持高版本的 python

我用源码配置的,没直接安langchain-chatchat,faiss就直接pip的faiss-cpu 但我看faiss好像用的是langchain里面的,可能是langchain版本不太对?

想请教一下如何源码启动langchain-chatchat啊,xinference我已经配置好了

可以看看项目里./docs/contributing/README_dev.md

参考这个说明了,poetry都安装好了,启动的时候报这个错 https://github.com/chatchat-space/Langchain-Chatchat/issues/4340, 请问你是怎么启动项目的?

就直接 python startup.py -a, 他会报错有几个包没安,装上就行 这个错是包的版本不对吧