niuwz / Ming-Dynasty-ChatBot

本项目基于LangChain和GLM-4搭建了一个明史知识问答小助手,收集了包括《明史简述》和《朱元璋传》等材料,利用RAG回答有关问题。
https://modelscope.cn/studios/sleep10h1d/History-Chat-Bot
Apache License 2.0
1 stars 0 forks source link

运行代码过程报错 #2

Closed Mliyifei closed 3 months ago

Mliyifei commented 3 months ago

"sentence_transformers"的版本是:"2.2.2" 代码执行过程中有如下报错: No sentence-transformers model found with name ./bge_embedding/. Creating a new one with MEAN pooling. Traceback (most recent call last): File "/Users/liyifei/anaconda3/lib/python3.11/site-packages/gradio/queueing.py", line 532, in process_events response = await route_utils.call_process_api( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/liyifei/anaconda3/lib/python3.11/site-packages/gradio/route_utils.py", line 276, in call_process_api output = await app.get_blocks().process_api( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/liyifei/anaconda3/lib/python3.11/site-packages/gradio/blocks.py", line 1928, in process_api result = await self.call_function( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/liyifei/anaconda3/lib/python3.11/site-packages/gradio/blocks.py", line 1514, in call_function prediction = await anyio.to_thread.run_sync( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/liyifei/anaconda3/lib/python3.11/site-packages/anyio/to_thread.py", line 33, in run_sync return await get_asynclib().run_sync_in_worker_thread( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/liyifei/anaconda3/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 877, in run_sync_in_worker_thread return await future ^^^^^^^^^^^^ File "/Users/liyifei/anaconda3/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 807, in run result = context.run(func, args) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/liyifei/anaconda3/lib/python3.11/site-packages/gradio/utils.py", line 832, in wrapper response = f(args, kwargs) ^^^^^^^^^^^^^^^^^^ File "/Users/liyifei/Documents/Ming-Dynasty-ChatBot-main/app.py", line 128, in predict vector_store = get_knowledge_vector_store() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/liyifei/Documents/Ming-Dynasty-ChatBot-main/app.py", line 54, in get_knowledge_vector_store vector_store = Chroma(embedding_function=embedding, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/liyifei/anaconda3/lib/python3.11/site-packages/langchain/vectorstores/chroma.py", line 125, in init self._collection = self._client.get_or_create_collection( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/liyifei/anaconda3/lib/python3.11/site-packages/chromadb/api/client.py", line 151, in get_or_create_collection return self._server.get_or_create_collection( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/liyifei/anaconda3/lib/python3.11/site-packages/chromadb/telemetry/opentelemetry/init.py", line 146, in wrapper return f(*args, *kwargs) ^^^^^^^^^^^^^^^^^^ File "/Users/liyifei/anaconda3/lib/python3.11/site-packages/chromadb/api/segment.py", line 222, in get_or_create_collection return self.create_collection( # type: ignore ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/liyifei/anaconda3/lib/python3.11/site-packages/chromadb/telemetry/opentelemetry/init.py", line 146, in wrapper return f(args, kwargs) ^^^^^^^^^^^^^^^^^^ File "/Users/liyifei/anaconda3/lib/python3.11/site-packages/chromadb/api/segment.py", line 200, in create_collection return Collection( ^^^^^^^^^^^ File "/Users/liyifei/anaconda3/lib/python3.11/site-packages/chromadb/api/models/CollectionCommon.py", line 91, in init validate_embedding_function(embedding_function) File "/Users/liyifei/anaconda3/lib/python3.11/site-packages/chromadb/api/types.py", line 215, in validate_embedding_function raise ValueError( ValueError: Expected EmbeddingFunction.call to have the following signature: odict_keys(['self', 'input']), got odict_keys(['self', 'args', 'kwargs']) Please see https://docs.trychroma.com/guides/embeddings for details of the EmbeddingFunction interface. Please note the recent change to the EmbeddingFunction interface: https://docs.trychroma.com/deployment/migration#migration-to-0.4.16---november-7,-2023 想问一下作者有遇到过吗?这个是模型问题还是chromadb的问题呢

模型用的是:https://huggingface.co/BAAI/bge-large-zh-v1.5/tree/main 里面的pytorch_model