问题记录: (chat) root@dsw-372547-597b6db8d7-sn86f:/mnt/workspace/langchain-ChatGLM# python init_database.py --recreate-vs recreating all vector stores 2024-05-10 10:06:10,715 - faiss_cache.py[line:92] - INFO: loading vector store in 'samples/vector_store/bge-large-zh-v1.5' from disk. 2024-05-10 10:06:11,000 - SentenceTransformer.py[line:66] - INFO: Load pretrained SentenceTransformer: BAAI/bge-large-zh-v1.5 2024-05-10 10:08:22,688 - 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 0x7f15f110e230>: Failed to establish a new connection: [Errno 101] Network is unreachable'))"), '(Request ID: 89f6b84d-f385-45ab-b998-4290bfe078e7)') AttributeError: 'NoneType' object has no attribute 'conjugate' The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/mnt/workspace/langchain-ChatGLM/init_database.py", line 107, in <module> folder2db(kb_names=args.kb_name, mode="recreate_vs", embed_model=args.embed_model) File "/mnt/workspace/langchain-ChatGLM/server/knowledge_base/migrate.py", line 121, in folder2db kb.create_kb() File "/mnt/workspace/langchain-ChatGLM/server/knowledge_base/kb_service/base.py", line 81, in create_kb self.do_create_kb() File "/mnt/workspace/langchain-ChatGLM/server/knowledge_base/kb_service/faiss_kb_service.py", line 51, in do_create_kb self.load_vector_store() File "/mnt/workspace/langchain-ChatGLM/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 "/mnt/workspace/langchain-ChatGLM/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 "/mnt/workspace/langchain-ChatGLM/server/knowledge_base/kb_cache/faiss_cache.py", line 60, in new_vector_store vector_store = FAISS.from_documents([doc], embeddings, distance_strategy="METRIC_INNER_PRODUCT") File "/mnt/workspace/ChatGLM3/chat/lib/python3.10/site-packages/langchain_core/vectorstores.py", line 508, in from_documents return cls.from_texts(texts, embedding, metadatas=metadatas, **kwargs) File "/mnt/workspace/ChatGLM3/chat/lib/python3.10/site-packages/langchain_community/vectorstores/faiss.py", line 959, in from_texts embeddings = embedding.embed_documents(texts) File "/mnt/workspace/langchain-ChatGLM/server/knowledge_base/kb_service/base.py", line 439, in embed_documents return normalize(embeddings).tolist() File "/mnt/workspace/langchain-ChatGLM/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 "/mnt/workspace/ChatGLM3/chat/lib/python3.10/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 (chat) root@dsw-372547-597b6db8d7-sn86f:/mnt/workspace/langchain-ChatGLM# (chat) root@dsw-372547-597b6db8d7-sn86f:/mnt/workspace/langchain-ChatGLM# (chat) root@dsw-372547-597b6db8d7-sn86f:/mnt/workspace/langchain-ChatGLM# 地址不通: (chat) root@dsw-372547-597b6db8d7-sn86f:/mnt/workspace/langchain-ChatGLM# (chat) root@dsw-372547-597b6db8d7-sn86f:/mnt/workspace/langchain-ChatGLM# ping huggingface.co 解决办法: 向量模型库下载更新接口 https://www.modelscope.cn/models/Xorbits/bge-large-zh-v1.5/files
标签:kb,HTTPSConnectionPool,py,MaxRetryError,mnt,langchain,host,workspace,line From: https://www.cnblogs.com/notonlydba/p/18183959