question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can not load onnx model with opset_version=14

See original GitHub issue

Thank for your great repo. I have problem with load model. Here my step by step

I convert onnx model successful

torch.onnx.export(model, dummy_input, model_path, verbose=False, input_names=['input'], output_names=['output'], opset_version=14)

but when I load onn model, I get error:

self._create_inference_session(providers, provider_options, disabled_optimizers)
  File "onnxruntime/capi/onnxruntime_inference_collection.py", line 358, in _create_inference_session
    sess = C.InferenceSession(session_options, self._model_path, True, self._read_config_from_model)
onnxruntime.capi.onnxruntime_pybind11_state.InvalidGraph: [ONNXRuntimeError] : 10 : INVALID_GRAPH : Load model from weights/model.onnx failed:This is an invalid model. Type Error: Type 'tensor(bool)' of input parameter (5287) of operator (CumSum) in node (CumSum_2919) is invalid.

Thank for your respone.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
jcwchencommented, Aug 4, 2022

Thank you for providing the details and I can repro this issue. I think it should be an issue in the exporter (torch.onnx.export), because CumSum does not allow bool as an input but it gets input from previous Equal op, which only outputs bool. The exporter should handle this by something like using a Cast op in the middle. Please raise this issue there (under PyTorch repo) to let exporter experts be aware of it.

0reactions
jcwchencommented, Aug 16, 2022

Close here since it has been tracked in the exporter instead. Feel free to reopen it if you still other ONNX questions. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

use v1.9.0 to load ONNX Opset 15 failed. #9418 - GitHub
I'm not sure it's loading ORT from the 1.9.0 version. I did a test and was able to successfully load a model I...
Read more >
ONNX Runtime compatibility
All versions of ONNX Runtime support ONNX opsets from ONNX v1.2.1+ (opset version 7 and higher). For example: if an ONNX Runtime release...
Read more >
What is the opset number? — sklearn-onnx 1.11.2 ...
The runtime used to deploy the model does not implement a new version, in that case, a model must be converted by usually...
Read more >
ValueError: Unsupported ONNX opset version: 13
Install or upgrade PyTorch 1.8.0 and OnnxRuntime 1.7.0 for CPU-only. I inserted a new cell right after: pip install torch==1.10.0 # latest.
Read more >
ONNX versions and Windows builds | Microsoft Learn
In this article. ONNX opset converter. Windows Machine Learning supports specific versions of the ONNX format in released Windows builds.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found