ONNXRuntimeError on macOS Intel (Core ML - error code -7)
Description
I'm using the latest beta version of GraXpert on macOS (Intel), and denoising fails with the following error:
2025-04-21 16:34:28,130 MainProcess root INFO Starting denoising 2025-04-21 16:34:30,265 MainProcess root ERROR [ONNXRuntimeError] : 1 : FAIL : Failed to create MLModel, error: Failed to build the model execution plan using a model architecture file /private/var/folders/.../onnxruntime-XXXXXXXX/model.mil with error code: -7. Traceback (most recent call last): File "graxpert/application/app.py", line 451, in on_denoise_request File "graxpert/denoising.py", line 70, in denoise File "onnxruntime/capi/onnxruntime_inference_collection.py", line 465, in init File "onnxruntime/capi/onnxruntime_inference_collection.py", line 537, in _create_inference_session onnxruntime.capi.onnxruntime_pybind11_state.Fail: [ONNXRuntimeError] : 1 : FAIL : Failed to create MLModel, error: Failed to build the model execution plan using a model architecture file '/private/var/folders/.../onnxruntime-XXXXXXXX/model.mil' with error code: -7.
(I inserted /private/var/folders/.../onnxruntime-XXXXXXXX/model.mil for security)
System Info
- MacBook Pro 13" (2020)
- macOS Sequoia 15.4.1
- Intel Core i5 (quad-core)
- 16 GB RAM
- Intel Iris Plus Graphics
- ONNX Runtime used by GraXpert seems to crash on macOS Intel with Core ML backend
Steps tried
- Deleted
/private/var/folders/.../onnxruntime*temporary files - Rebooted system
- Retried denoising → Same error
Suggestion
Maybe fallback to CPU inference on Intel Macs, or check Core ML compatibility with .milmodel builds on macOS Intel?
I get the same on an arm mac: 2025-05-22 21:02:03,265 MainProcess root INFO Starting denoising 2025-05-22 21:02:03,265 MainProcess root INFO mapping batch_size of 3 to 2 2025-05-22 21:02:04,390 MainProcess root ERROR [ONNXRuntimeError] : 1 : FAIL : Failed to create MLModel, error: Failed to build the model execution plan using a model architecture file '/private/var/folders/m0/xjmlqxb91r5czp96dyl1ntph0000gn/T/onnxruntime-C873BAC0-B2A3-47C0-AF65-80A077D62A99-36008-000005279683F862.mlmodelc/model.mil' with error code: -7. Traceback (most recent call last): File "graxpert/application/app.py", line 451, in on_denoise_request File "graxpert/denoising.py", line 70, in denoise File "onnxruntime/capi/onnxruntime_inference_collection.py", line 465, in init File "onnxruntime/capi/onnxruntime_inference_collection.py", line 537, in _create_inference_session onnxruntime.capi.onnxruntime_pybind11_state.Fail: [ONNXRuntimeError] : 1 : FAIL : Failed to create MLModel, error: Failed to build the model execution plan using a model architecture file '/private/var/folders/m0/xjmlqxb91r5czp96dyl1ntph0000gn/T/onnxruntime-C873BAC0-B2A3-47C0-AF65-80A077D62A99-36008-000005279683F862.mlmodelc/model.mil' with error code: -7.
Turn off AI Hardware Acceleration for the denoise step
btw @Steffenhir this can be closed as a dup of #232