Skip to content

Instantly share code, notes, and snippets.

@justinchuby
Created November 5, 2025 02:27
Show Gist options
  • Select an option

  • Save justinchuby/6dfad3e00685e5426dcef733c89a059b to your computer and use it in GitHub Desktop.

Select an option

Save justinchuby/6dfad3e00685e5426dcef733c89a059b to your computer and use it in GitHub Desktop.
ORT error
Loading ONNX model from: perch_v2_opt2.onnx
2025-11-04 18:25:33.374 python[72171:12211235] 2025-11-04 18:25:33.374513 [W:onnxruntime:, graph.cc:4885 CleanUnusedInitializersAndNodeArgs] Removing initializer 'arith.constant470'. It is not used by any node and should be removed from the model.
2025-11-04 18:25:33.414 python[72171:12211235] 2025-11-04 18:25:33.414751 [E:onnxruntime:, inference_session.cc:2544 operator()] Exception during initialization: /Users/runner/work/1/s/onnxruntime/core/framework/execution_frame.h:112 const OrtValue &onnxruntime::IExecutionFrame::GetMLValue(int) const ort_value_index >= 0 && static_cast<size_t>(ort_value_index) < all_values_size_ was false.
Traceback (most recent call last):
File "/Users/justinc/Documents/GitHub/tensorflow-onnx/examples/compare_onnx_tflite.py", line 599, in <module>
exit(main())
^^^^^^
File "/Users/justinc/Documents/GitHub/tensorflow-onnx/examples/compare_onnx_tflite.py", line 541, in main
onnx_session = load_onnx_model(args.onnx)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/justinc/Documents/GitHub/tensorflow-onnx/examples/compare_onnx_tflite.py", line 33, in load_onnx_model
session = ort.InferenceSession(onnx_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Caskroom/miniconda/base/envs/tf2onnx/lib/python3.12/site-packages/onnxruntime/capi/onnxruntime_inference_collection.py", line 485, in __init__
self._create_inference_session(providers, provider_options, disabled_optimizers)
File "/opt/homebrew/Caskroom/miniconda/base/envs/tf2onnx/lib/python3.12/site-packages/onnxruntime/capi/onnxruntime_inference_collection.py", line 584, in _create_inference_session
sess.initialize_session(providers, provider_options, disabled_optimizers)
onnxruntime.capi.onnxruntime_pybind11_state.RuntimeException: [ONNXRuntimeError] : 6 : RUNTIME_EXCEPTION : Exception during initialization: /Users/runner/work/1/s/onnxruntime/core/framework/execution_frame.h:112 const OrtValue &onnxruntime::IExecutionFrame::GetMLValue(int) const ort_value_index >= 0 && static_cast<size_t>(ort_value_index) < all_values_size_ was false.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment