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.28k stars 5.6k forks source link

重建向量库时报错,WARNING: Retrying chatchat.server.localai_embeddings.embed_with_retry.<locals>._embed_with_retry in 8.0 seconds as it raised APIConnectionError: Connection error.. #4288

Closed binxuan98 closed 5 months ago

binxuan98 commented 5 months ago

(chatchat) user@a100:~/chatchat-data$ chatchat-kb -r --embed-model=bge-large-zh-v1.5-local None of PyTorch, TensorFlow >= 2.0, or Flax have been found. Models won't be available and only tokenizers, configuration and file/data utilities can be used. 2024-06-23 18:01:46,290 uvicorn.error 109633 INFO Started server process [109633] 2024-06-23 18:01:46,290 uvicorn.error 109633 INFO Waiting for application startup. 2024-06-23 18:01:46,291 uvicorn.error 109633 INFO Application startup complete. 2024-06-23 18:01:46,292 uvicorn.error 109633 INFO Uvicorn running on http://0.0.0.0:21004 (Press CTRL+C to quit) recreating all vector stores /env/anaconda3/envs/chatchat/lib/python3.10/site-packages/langchain/_api/module_import.py:87: LangChainDeprecationWarning: Importing GuardrailsOutputParser from langchain.output_parsers is deprecated. Please replace the import with the following: from langchain_community.output_parsers.rail_parser import GuardrailsOutputParser warnings.warn( 2024-06-23 18:02:15,295 - before_sleep.py[line:65] - WARNING: Retrying chatchat.server.localai_embeddings.embed_with_retry.._embed_with_retry in 4.0 seconds as it raised APIConnectionError: Connection error.. 2024-06-23 18:02:45,693 - before_sleep.py[line:65] - WARNING: Retrying chatchat.server.localai_embeddings.embed_with_retry.._embed_with_retry in 4.0 seconds as it raised APIConnectionError: Connection error.. 2024-06-23 18:03:15,027 - before_sleep.py[line:65] - WARNING: Retrying chatchat.server.localai_embeddings.embed_with_retry.._embed_with_retry in 4.0 seconds as it raised APIConnectionError: Connection error.. 2024-06-23 18:03:45,975 - before_sleep.py[line:65] - WARNING: Retrying chatchat.server.localai_embeddings.embed_with_retry.._embed_with_retry in 8.0 seconds as it raised APIConnectionError: Connection error..

2024-06-23 18:04:20,181 - before_sleep.py[line:65] - WARNING: Retrying chatchat.server.localai_embeddings.embed_with_retry.._embed_with_retry in 10.0 seconds as it raised APIConnectionError: Connection error.. 2024-06-23 18:04:57,504 - utils.py[line:614] - ERROR: error in sub thread: Connection error. Traceback (most recent call last): File "/env/anaconda3/envs/chatchat/lib/python3.10/site-packages/httpx/_transports/default.py", line 69, in map_httpcore_exceptions yield File "/env/anaconda3/envs/chatchat/lib/python3.10/site-packages/httpx/_transports/default.py", line 233, in handle_request resp = self._pool.handle_request(req) File "/env/anaconda3/envs/chatchat/lib/python3.10/site-packages/httpcore/_sync/connection_pool.py", line 216, in handle_request raise exc from None File "/env/anaconda3/envs/chatchat/lib/python3.10/site-packages/httpcore/_sync/connection_pool.py", line 196, in handle_request response = connection.handle_request( File "/env/anaconda3/envs/chatchat/lib/python3.10/site-packages/httpcore/_sync/connection.py", line 99, in handle_request raise exc File "/env/anaconda3/envs/chatchat/lib/python3.10/site-packages/httpcore/_sync/connection.py", line 76, in handle_request stream = self._connect(request) File "/env/anaconda3/envs/chatchat/lib/python3.10/site-packages/httpcore/_sync/connection.py", line 122, in _connect stream = self._network_backend.connect_tcp(**kwargs) File "/env/anaconda3/envs/chatchat/lib/python3.10/site-packages/httpcore/_backends/sync.py", line 205, in connect_tcp with map_exceptions(exc_map): File "/env/anaconda3/envs/chatchat/lib/python3.10/contextlib.py", line 153, in exit self.gen.throw(typ, value, traceback) File "/env/anaconda3/envs/chatchat/lib/python3.10/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions raise to_exc(exc) from exc httpcore.ConnectError: [Errno 111] Connection refused

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

Traceback (most recent call last): File "/env/anaconda3/envs/chatchat/lib/python3.10/site-packages/openai/_base_client.py", line 926, in _request response = self._client.send( File "/env/anaconda3/envs/chatchat/lib/python3.10/site-packages/httpx/_client.py", line 914, in send response = self._send_handling_auth( File "/env/anaconda3/envs/chatchat/lib/python3.10/site-packages/httpx/_client.py", line 942, in _send_handling_auth response = self._send_handling_redirects( File "/env/anaconda3/envs/chatchat/lib/python3.10/site-packages/httpx/_client.py", line 979, in _send_handling_redirects response = self._send_single_request(request) File "/env/anaconda3/envs/chatchat/lib/python3.10/site-packages/httpx/_client.py", line 1015, in _send_single_request response = transport.handle_request(request) File "/env/anaconda3/envs/chatchat/lib/python3.10/site-packages/httpx/_transports/default.py", line 232, in handle_request with map_httpcore_exceptions(): File "/env/anaconda3/envs/chatchat/lib/python3.10/contextlib.py", line 153, in exit self.gen.throw(typ, value, traceback) File "/env/anaconda3/envs/chatchat/lib/python3.10/site-packages/httpx/_transports/default.py", line 86, in map_httpcore_exceptions raise mapped_exc(message) from exc httpx.ConnectError: [Errno 111] Connection refused

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

Traceback (most recent call last): File "/env/anaconda3/envs/chatchat/lib/python3.10/site-packages/chatchat/server/utils.py", line 612, in run_in_thread_pool yield obj.result() File "/env/anaconda3/envs/chatchat/lib/python3.10/concurrent/futures/_base.py", line 451, in result return self.get_result() File "/env/anaconda3/envs/chatchat/lib/python3.10/concurrent/futures/_base.py", line 403, in get_result raise self._exception File "/env/anaconda3/envs/chatchat/lib/python3.10/concurrent/futures/thread.py", line 58, in run result = self.fn(self.args, self.kwargs) File "/env/anaconda3/envs/chatchat/lib/python3.10/site-packages/chatchat/server/localai_embeddings.py", line 323, in task return (seq, self._embedding_func(text, engine=self.deployment)) File "/env/anaconda3/envs/chatchat/lib/python3.10/site-packages/chatchat/server/localai_embeddings.py", line 287, in _embedding_func return embed_with_retry( File "/env/anaconda3/envs/chatchat/lib/python3.10/site-packages/chatchat/server/localai_embeddings.py", line 108, in embed_with_retry return _embed_with_retry(kwargs) File "/env/anaconda3/envs/chatchat/lib/python3.10/site-packages/tenacity/init.py", line 332, in wrapped_f return self(f, args, *kw) File "/env/anaconda3/envs/chatchat/lib/python3.10/site-packages/tenacity/init.py", line 469, in call do = self.iter(retry_state=retry_state) File "/env/anaconda3/envs/chatchat/lib/python3.10/site-packages/tenacity/init.py", line 370, in iter result = action(retry_state) File "/env/anaconda3/envs/chatchat/lib/python3.10/site-packages/tenacity/init.py", line 412, in exc_check raise retry_exc.reraise() File "/env/anaconda3/envs/chatchat/lib/python3.10/site-packages/tenacity/init.py", line 185, in reraise raise self.last_attempt.result() File "/env/anaconda3/envs/chatchat/lib/python3.10/concurrent/futures/_base.py", line 451, in result return self.get_result() File "/env/anaconda3/envs/chatchat/lib/python3.10/concurrent/futures/_base.py", line 403, in get_result raise self._exception File "/env/anaconda3/envs/chatchat/lib/python3.10/site-packages/tenacity/init.py", line 472, in call result = fn(args, kwargs) File "/env/anaconda3/envs/chatchat/lib/python3.10/site-packages/chatchat/server/localai_embeddings.py", line 105, in _embed_with_retry response = embeddings.client.create(kwargs) File "/env/anaconda3/envs/chatchat/lib/python3.10/site-packages/openai/resources/embeddings.py", line 113, in create return self._post( File "/env/anaconda3/envs/chatchat/lib/python3.10/site-packages/openai/_base_client.py", line 1208, in post return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls)) File "/env/anaconda3/envs/chatchat/lib/python3.10/site-packages/openai/_base_client.py", line 897, in request return self._request( File "/env/anaconda3/envs/chatchat/lib/python3.10/site-packages/openai/_base_client.py", line 950, in _request return self._retry_request( File "/env/anaconda3/envs/chatchat/lib/python3.10/site-packages/openai/_base_client.py", line 1021, in _retry_request return self._request( File "/env/anaconda3/envs/chatchat/lib/python3.10/site-packages/openai/_base_client.py", line 950, in _request return self._retry_request( File "/env/anaconda3/envs/chatchat/lib/python3.10/site-packages/openai/_base_client.py", line 1021, in _retry_request return self._request( File "/env/anaconda3/envs/chatchat/lib/python3.10/site-packages/openai/_base_client.py", line 950, in _request return self._retry_request( File "/env/anaconda3/envs/chatchat/lib/python3.10/site-packages/openai/_base_client.py", line 1021, in _retry_request return self._request( File "/env/anaconda3/envs/chatchat/lib/python3.10/site-packages/openai/_base_client.py", line 950, in _request return self._retry_request( File "/env/anaconda3/envs/chatchat/lib/python3.10/site-packages/openai/_base_client.py", line 1021, in _retry_request return self._request( File "/env/anaconda3/envs/chatchat/lib/python3.10/site-packages/openai/_base_client.py", line 950, in _request return self._retry_request( File "/env/anaconda3/envs/chatchat/lib/python3.10/site-packages/openai/_base_client.py", line 1021, in _retry_request return self._request( File "/env/anaconda3/envs/chatchat/lib/python3.10/site-packages/openai/_base_client.py", line 950, in _request return self._retry_request( File "/env/anaconda3/envs/chatchat/lib/python3.10/site-packages/openai/_base_client.py", line 1021, in _retry_request return self._request( File "/env/anaconda3/envs/chatchat/lib/python3.10/site-packages/openai/_base_client.py", line 960, in _request raise APIConnectionError(request=request) from err openai.APIConnectionError: Connection error. 2024-06-23 18:04:57,572 - faiss_cache.py[line:131] - ERROR: list index out of range Traceback (most recent call last): File "/env/anaconda3/envs/chatchat/lib/python3.10/site-packages/chatchat/server/knowledge_base/kb_cache/faiss_cache.py", line 119, in load_vector_store vector_store = self.new_vector_store(kb_name=kb_name, embed_model=embed_model) File "/env/anaconda3/envs/chatchat/lib/python3.10/site-packages/chatchat/server/knowledge_base/kb_cache/faiss_cache.py", line 61, in new_vector_store vector_store = FAISS.from_documents([doc], embeddings, normalize_L2=True) File "/env/anaconda3/envs/chatchat/lib/python3.10/site-packages/langchain_core/vectorstores.py", line 550, in from_documents return cls.from_texts(texts, embedding, metadatas=metadatas, kwargs) File "/env/anaconda3/envs/chatchat/lib/python3.10/site-packages/langchain_community/vectorstores/faiss.py", line 931, in from_texts return cls.__from( File "/env/anaconda3/envs/chatchat/lib/python3.10/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-23 18:04:57,573 - init_database.py[line:171] - ERROR: 向量库 samples 加载失败。 Traceback (most recent call last): File "/env/anaconda3/envs/chatchat/lib/python3.10/site-packages/chatchat/server/knowledge_base/kb_cache/faiss_cache.py", line 119, in load_vector_store vector_store = self.new_vector_store(kb_name=kb_name, embed_model=embed_model) File "/env/anaconda3/envs/chatchat/lib/python3.10/site-packages/chatchat/server/knowledge_base/kb_cache/faiss_cache.py", line 61, in new_vector_store vector_store = FAISS.from_documents([doc], embeddings, normalize_L2=True) File "/env/anaconda3/envs/chatchat/lib/python3.10/site-packages/langchain_core/vectorstores.py", line 550, in from_documents return cls.from_texts(texts, embedding, metadatas=metadatas, kwargs) File "/env/anaconda3/envs/chatchat/lib/python3.10/site-packages/langchain_community/vectorstores/faiss.py", line 931, in from_texts return cls.__from( File "/env/anaconda3/envs/chatchat/lib/python3.10/site-packages/langchain_community/vectorstores/faiss.py", line 888, in __from index = faiss.IndexFlatL2(len(embeddings[0])) IndexError: list index out of range

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/env/anaconda3/envs/chatchat/lib/python3.10/site-packages/chatchat/init_database.py", line 156, in main folder2db(kb_names=args.kb_name, mode="recreate_vs", embed_model=args.embed_model) File "/env/anaconda3/envs/chatchat/lib/python3.10/site-packages/chatchat/server/knowledge_base/migrate.py", line 130, in folder2db kb.create_kb() File "/env/anaconda3/envs/chatchat/lib/python3.10/site-packages/chatchat/server/knowledge_base/kb_service/base.py", line 80, in create_kb self.do_create_kb() File "/env/anaconda3/envs/chatchat/lib/python3.10/site-packages/chatchat/server/knowledge_base/kb_service/faiss_kb_service.py", line 51, in do_create_kb self.load_vector_store() File "/env/anaconda3/envs/chatchat/lib/python3.10/site-packages/chatchat/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 "/env/anaconda3/envs/chatchat/lib/python3.10/site-packages/chatchat/server/knowledge_base/kb_cache/faiss_cache.py", line 132, in load_vector_store raise RuntimeError(f"向量库 {kb_name} 加载失败。") RuntimeError: 向量库 samples 加载失败。 2024-06-23 18:04:57,574 - init_database.py[line:172] - WARNING: Caught KeyboardInterrupt! Setting stop event... 2024-06-23 18:04:57,574 - init_database.py[line:176] - WARNING: Sending SIGKILL to

freewily commented 5 months ago

same error。

zmh2000829 commented 5 months ago

same error。

Tang4109 commented 5 months ago

一样的错

AChao628 commented 5 months ago

same error

imClumsyPanda commented 5 months ago
  1. 请确认是否已配置 Embedding 模型信息
  2. 请确认 Embedding 模型是使用哪个模型推理平台部署的

开发组会尽快根据上述两项问题的结果进行问题排查

binxuan98 commented 5 months ago
  1. 请确认是否已配置 Embedding 模型信息
  2. 请确认 Embedding 模型是使用哪个模型推理平台部署的

开发组会尽快根据上述两项问题的结果进行问题排查

感谢回复, 1、已经在路径/env/anaconda3/envs/chatchat/lib/python3.10/site-packages/chatchat/configs/model_providers.yaml,下修改embedding模型信息如下图, image

2、embedding模型使用的xinference平台部署的,自定义部署和使用默认的都已经测试,同样报错,如下图, image

3、在上面的情况下,跳过chatchat-kb -r(初始化知识库这一步),直接运行chatchat -a(启动项目),都可以正常启动,但是对话的时候,会报错,如下图, image

4、个人猜测,问题是不是出在由于修改了监听地址为 0.0.0.0,之后导致的。

dggmhispra03364 commented 5 months ago

same error

huangyuanzhuo-coder commented 5 months ago

same error

binxuan98 commented 5 months ago

最新回复,在删掉环境以后,再次重新安装一遍,这个bug已经修复。

AChao628 commented 5 months ago

最新回复,在删掉环境以后,再次重新安装一遍,这个bug已经修复。

请问,删掉环境是指删掉整个repo吗