chroma-core / chroma

the AI-native open-source embedding database
https://www.trychroma.com/
Apache License 2.0
15.2k stars 1.28k forks source link

[Bug]: Chroma 0.5.5 not working on intel CPU macbook #2731

Closed allnash closed 1 month ago

allnash commented 2 months ago

What happened?

 collection.add(
                        documents=[article["content"] for article in batch],
                        metadatas=[article["metadata"] for article in batch],
                        ids=[f"{scraper.name}_{j}" for j in range(i, i + len(batch))]
                    )

Versions

0.5.5

Relevant log output

Error adding batch to collection: [ONNXRuntimeError] : 1 : FAIL : Non-zero status code returned while running CoreML_368072560150139051_1 node. Name:'CoreMLExecutionProvider_CoreML_368072560150139051_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).
Continuing with next batch...
2024-08-27 17:00:34.030829 [E:onnxruntime:, sequential_executor.cc:516 ExecuteKernel] Non-zero status code returned while running CoreML_368072560150139051_1 node. Name:'CoreMLExecutionProvider_CoreML_368072560150139051_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).
Error adding batch to collection: [ONNXRuntimeError] : 1 : FAIL : Non-zero status code returned while running CoreML_368072560150139051_1 node. Name:'CoreMLExecutionProvider_CoreML_368072560150139051_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).
Continuing with next batch...
2024-08-27 17:00:34.066881 [E:onnxruntime:, sequential_executor.cc:516 ExecuteKernel] Non-zero status code returned while running CoreML_368072560150139051_1 node. Name:'CoreMLExecutionProvider_CoreML_368072560150139051_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).
Error adding batch to collection: [ONNXRuntimeError] : 1 : FAIL : Non-zero status code returned while running CoreML_368072560150139051_1 node. Name:'CoreMLExecutionProvider_CoreML_368072560150139051_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).
Continuing with next batch...
Error adding batch to collection: [ONNXRuntimeError] : 1 : FAIL : Non-zero status code returned while running CoreML_368072560150139051_1 node. Name:'CoreMLExecutionProvider_CoreML_368072560150139051_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).
Continuing with next batch...
tazarov commented 2 months ago

@allnash, can you share your MacOS and CoreML versions:

To get macOS from CLI:

sw_vers

For CoreML:

plutil -p /System/Library/Frameworks/CoreML.framework/Resources/Info.plist
tazarov commented 2 months ago

@allnash, can you try this and let me know if it works for you:

from chromadb.utils.embedding_functions.onnx_mini_lm_l6_v2 import ONNXMiniLM_L6_V2
ef = ONNXMiniLM_L6_V2(preferred_providers=["CPUExecutionProvider"])
# rest of your code
collection = client.get_or_create_collection("<collection_name", embedding_function=ef)
collection.add(
    documents=[article["content"] for article in batch],
    metadatas=[article["metadata"] for article in batch],
    ids=[f"{scraper.name}_{j}" for j in range(i, i + len(batch))]
)
Yc-Chen commented 2 months ago

I suspect I have encountered the same issue. After using ONNXMiniLM_L6_V2(preferred_providers=["CPUExecutionProvider"]) it worked.

My result of sw_vers

ProductName:            macOS
ProductVersion:         13.6.9
BuildVersion:           22G830

and result of CoreML:

{
  "BuildMachineOSBuild" => "22A380017"
  "CFBundleDevelopmentRegion" => "en"
  "CFBundleExecutable" => "CoreML"
  "CFBundleIdentifier" => "com.apple.CoreML"
  "CFBundleInfoDictionaryVersion" => "6.0"
  "CFBundleName" => "CoreML"
  "CFBundlePackageType" => "FMWK"
  "CFBundleShortVersionString" => "1.0"
  "CFBundleSupportedPlatforms" => [
    0 => "MacOSX"
  ]
  "CFBundleVersion" => "1436.140.3.0.1"
  "DTCompiler" => "com.apple.compilers.llvm.clang.1_0"
  "DTPlatformBuild" => "22G417"
  "DTPlatformName" => "macosx"
  "DTPlatformVersion" => "13.6"
  "DTSDKBuild" => "22G417"
  "DTSDKName" => "macosx13.6.internal"
  "DTXcode" => "1430"
  "DTXcodeBuild" => "14E6097d"
  "LSMinimumSystemVersion" => "13.6"
}
tazarov commented 1 month ago

@allnash, did using CPUExecutionProvider provider solve your issue too?

jeffchuber commented 1 month ago

closing this, but @allnash would love to know the resolution!

allnash commented 5 days ago

Sorry for being MIA, yes it did solve it. Just tried this am