The from_onnx tutorial hosted here: 
https://tvm.apache.org/docs/how_to/compile_models/from_onnx.html

Relies on a model that generate the following error using onnxruntime code:
```
from tvm.contrib.download import download_testdata
import onnxruntime as ort

model_url = "".join(
    [
        "https://gist.github.com/zhreshold/";,
        "bcda4716699ac97ea44f791c24310193/raw/",
        "93672b029103648953c4e5ad3ac3aadf346a4cdc/",
        "super_resolution_0.2.onnx",
    ]
)

model_path = download_testdata(
    model_url, "super_resolution.onnx", module="onnx"
)
ort_sess = ort.InferenceSession(model_path)
```
``` 
onnxruntime.capi.onnxruntime_pybind11_state.Fail: [ONNXRuntimeError] : 1 : FAIL 
: Load model from /home/peter/.tvm_test_data/onnx/super_resolution.onnx 
failed:/onnxruntime_src/onnxruntime/core/graph/model.cc:107 
onnxruntime::Model::Model(onnx::ModelProto&&, const PathString&, const 
IOnnxRuntimeOpSchemaRegistryList*, const onnxruntime::logging::Logger&) Missing 
opset in the model. All ModelProtos MUST have at least one entry that specifies 
which version of the ONNX OperatorSet is being imported.
```


Therefore the model hosted by @zhreshold should be updated or changed.

You can check the missing opset version using the following code: 
```
import onnx
model_url = "".join(
    [
        "https://gist.github.com/zhreshold/";,
        "bcda4716699ac97ea44f791c24310193/raw/",
        "93672b029103648953c4e5ad3ac3aadf346a4cdc/",
        "super_resolution_0.2.onnx",
    ]
)
model_path = download_testdata(
    model_url, "super_resolution.onnx", module="onnx"
)

onnx_model = onnx.load(model_path)
print(onnx_model.opset_import)
```
This might not be an issue if the tutorial is only about the API usage but it 
can be counterintuitive for someone wanting to test out tvm vs onnxruntime.





---
[Visit 
Topic](https://discuss.tvm.apache.org/t/onnx-tutorial-relies-on-outdated-model/11755/1)
 to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click 
here](https://discuss.tvm.apache.org/email/unsubscribe/2ddc31308caa90792aeb2878d2c6646f5446bf8fe9f4cfc4f846cc513d631dbb).

Reply via email to