Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.2.10 docker image init error #3849

Closed
wyfSunflower opened this issue Apr 23, 2024 · 2 comments
Closed

0.2.10 docker image init error #3849

wyfSunflower opened this issue Apr 23, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@wyfSunflower
Copy link

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

复现问题的步骤 / Steps to Reproduce

  1. 执行 '...' / Run '...'
    docker run -itd --network=host -v /home/g/Desktop:/home -v /etc/localtime:/etc/localtime:ro -e TZ=Asia/Shanghai -p 80:8501 registry.cn-beijing.aliyuncs.com/chatchat/chatchat:0.2.10
    docker exec -it container_id bash
    root@localhost:/data/model/langchain-chatchat# python3 copy_config_example.py
    root@localhost:/data/model/langchain-chatchat# python3 init_database.py --recreate-vs
    recreating all vector stores
    2024-04-23 13:50:03,311 - faiss_cache.py[line:92] - INFO: loading vector store in 'samples/vector_store/bge-large-zh-v1.5' from disk.
    2024-04-23 13:50:10,034 - SentenceTransformer.py[line:66] - INFO: Load pretrained SentenceTransformer: BAAI/bge-large-zh-v1.5
    2024-04-23 13:50:31,199 - 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 NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f5b201174d0>: Failed to establish a new connection: [Errno 101] Network is unreachable'))"), '(Request ID: c980c1ab-b4fe-4b25-8cc2-ec1b9c9b3a31)')
    AttributeError: 'NoneType' object has no attribute 'conjugate'

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

Traceback (most recent call last):
File "/data/model/langchain-chatchat/init_database.py", line 107, in
folder2db(kb_names=args.kb_name, mode="recreate_vs", embed_model=args.embed_model)
File "/data/model/langchain-chatchat/server/knowledge_base/migrate.py", line 126, in folder2db
kb.create_kb()
File "/data/model/langchain-chatchat/server/knowledge_base/kb_service/base.py", line 81, in create_kb
self.do_create_kb()
File "/data/model/langchain-chatchat/server/knowledge_base/kb_service/faiss_kb_service.py", line 51, in do_create_kb
self.load_vector_store()
File "/data/model/langchain-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 "/data/model/langchain-chatchat/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 "/data/model/langchain-chatchat/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 "/usr/local/lib/python3.11/dist-packages/langchain_core/vectorstores.py", line 508, in from_documents
return cls.from_texts(texts, embedding, metadatas=metadatas, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/langchain_community/vectorstores/faiss.py", line 965, in from_texts
embeddings = embedding.embed_documents(texts)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/model/langchain-chatchat/server/knowledge_base/kb_service/base.py", line 439, in embed_documents
return normalize(embeddings).tolist()
^^^^^^^^^^^^^^^^^^^^^
File "/data/model/langchain-chatchat/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 "/usr/local/lib/python3.11/dist-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
root@localhost:/data/model/langchain-chatchat# python3 startup.py -a

python3 startup.py -a

==============================Langchain-Chatchat Configuration==============================
操作系统:Linux-3.10.0-1160.114.2.el7.x86_64-x86_64-with-glibc2.35.
python版本:3.11.0rc1 (main, Aug 12 2022, 10:02:14) [GCC 11.2.0]
项目版本:v0.2.10
langchain版本:0.0.354. fastchat版本:0.2.35

当前使用的分词器:ChineseRecursiveTextSplitter
当前启动的LLM模型:['chatglm3-6b', 'zhipu-api', 'openai-api'] @ cpu
{'device': 'cuda',
'host': '0.0.0.0',
'infer_turbo': False,
'model_path': 'THUDM/chatglm3-6b',
'port': 20002}
{'api_key': '',
'device': 'auto',
'host': '0.0.0.0',
'infer_turbo': False,
'online_api': True,
'port': 21001,
'provider': 'ChatGLMWorker',
'version': 'glm-4',
'worker_class': <class 'server.model_workers.zhipu.ChatGLMWorker'>}
{'api_base_url': 'https://api.openai.com/v1',
'api_key': '',
'device': 'auto',
'host': '0.0.0.0',
'infer_turbo': False,
'model_name': 'gpt-4',
'online_api': True,
'openai_proxy': '',
'port': 20002}
当前Embbedings模型: bge-large-zh-v1.5 @ cpu
==============================Langchain-Chatchat Configuration==============================

2024-04-23 13:53:10,436 - startup.py[line:655] - INFO: 正在启动服务:
2024-04-23 13:53:10,436 - startup.py[line:656] - INFO: 如需查看 llm_api 日志,请前往 /data/model/langchain-chatchat/logs
/usr/local/lib/python3.11/dist-packages/langchain_core/_api/deprecation.py:117: LangChainDeprecationWarning: 模型启动功能将于 Langchain-Chatchat 0.3.x重写,支持更多模式和加速启动,0.2.x中相关功能将废弃
warn_deprecated(
ERROR: [Errno 98] error while attempting to bind on address ('0.0.0.0', 20001): address already in use

@wyfSunflower wyfSunflower added the bug Something isn't working label Apr 23, 2024
Copy link

dosubot bot commented Apr 23, 2024

The errors you're encountering stem from two primary issues:

  1. Network Error with Hugging Face Model Hub: The script is unable to download the BAAI/bge-large-zh-v1.5 model due to a network connection issue. This could be because of network restrictions, firewall settings, or the Hugging Face Model Hub being temporarily inaccessible. To resolve this, ensure your network connection is stable, check your firewall settings, or consider manually downloading the model and placing it in the expected directory.

  2. TypeError Due to None Embeddings: The error indicating that the embeddings parameter is None likely results from the failure to download the model, leading to None embeddings. Successfully downloading and loading the model should resolve this issue.

Additionally, the error address already in use suggests that port 20001 is already occupied by another process. You'll need to either stop the process using this port or configure your application to use a different port.

For the network error, if direct access remains an issue, using a VPN or proxy might be necessary to access the Hugging Face Model Hub. For the port conflict, check for any running processes on port 20001 and terminate them or choose an alternative port for your application.

Details

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.

To continue the conversation, mention @dosu.

@zhange1990
Copy link

ERROR: [Errno 98] error while attempting to bind on address ('0.0.0.0', 20001): address already in use
It occurred to me, and I checked by lsof -i :20001 but found nothing.
Is there something else caused the problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants