我正在运行此代码,尝试将一些数据添加到 ChromaDB 集合中。
import ollama, chromadb, time
chroma_client = chromadb.Client()
#chroma_client = chromadb.HttpClient(host="localhost", port=8000)
collectionname = "my_collection"
print(chroma_client.list_collections())
if any(collection.name == collectionname for collection in chroma_client.list_collections()):
print("deleting collection")
chroma_client.delete_collection("my_collection")
collection = chroma_client.get_or_create_collection(name=collectionname, metadata={"hnsw:space": "cosine"})
collection.upsert(
documents=[
"This is a document about machine learning",
"This is another document about data science",
"A third document about artificial intelligence"
],
metadatas=[
{"source": "test1"},
{"source": "test2"},
{"source": "test3"}
],
ids=[
"id1",
"id2",
"id3"
]
)
但我收到此错误消息。 我现在不知道该去哪里解决。有没有人看过并有解决方案?
2024-07-13 17:31:45.534848 [E:onnxruntime:, sequential_executor.cc:516 ExecuteKernel] Non-zero status code returned while running CoreML_16713284627214834184_1 node. Name:'CoreMLExecutionProvider_CoreML_16713284627214834184_1_1' Status Message: Error executing model: Unable to compute the prediction using a neural network model. It can be an invalid input data or broken/unsupported model (error code: -1).
Traceback (most recent call last):
File "/Users/joe/development/python/gettings_started_chromadb.py", line 15, in <module>
collection.upsert(
File "/Users/joe/development/python/venv/dev/lib/python3.11/site-packages/chromadb/api/models/Collection.py", line 296, in upsert
) = self._validate_and_prepare_upsert_request(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/joe/development/python/venv/dev/lib/python3.11/site-packages/chromadb/api/models/CollectionCommon.py", line 531, in _validate_and_prepare_upsert_request
embeddings = self._embed(input=documents)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/joe/development/python/venv/dev/lib/python3.11/site-packages/chromadb/api/models/CollectionCommon.py", line 568, in _embed
return self._embedding_function(input=input)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/joe/development/python/venv/dev/lib/python3.11/site-packages/chromadb/api/types.py", line 211, in __call__
result = call(self, input)
^^^^^^^^^^^^^^^^^
File "/Users/joe/development/python/venv/dev/lib/python3.11/site-packages/chromadb/utils/embedding_functions/onnx_mini_lm_l6_v2.py", line 200, in __call__
return cast(Embeddings, self._forward(input).tolist())
^^^^^^^^^^^^^^^^^^^^
File "/Users/joe/development/python/venv/dev/lib/python3.11/site-packages/chromadb/utils/embedding_functions/onnx_mini_lm_l6_v2.py", line 143, in _forward
model_output = self.model.run(None, onnx_input)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/joe/development/python/venv/dev/lib/python3.11/site-packages/onnxruntime/capi/onnxruntime_inference_collection.py", line 220, in run
return self._sess.run(output_names, input_feed, run_options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxruntime.capi.onnxruntime_pybind11_state.Fail: [ONNXRuntimeError] : 1 : FAIL : Non-zero status code returned while running CoreML_16713284627214834184_1 node. Name:'CoreMLExecutionProvider_CoreML_16713284627214834184_1_1' Status Message: Error executing model: Unable to compute the prediction using a neural network model. It can be an invalid input data or broken/unsupported model (error code: -1).
我最初以为我的 Python 环境可能已损坏,因此我清理了所有软件包并创建了一个仅安装了 Python 3.11、Ollama、ChromaDB 和 Time 的虚拟环境。 我还认为这可能是 Chroma 的本地问题,因此我也构建了一个 Docker 映像并进行了部署,但仍然收到相同的错误。
我也有同样的问题。希望有人可以帮助我们解决这个问题。