New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WinRT information: Failed to load model with error: Unknown model file format version - How do I change the model format version? #3836
Comments
Hi @Westycoot, |
Hi @jcwchen , I will take a look at trying the hack, if that doesnt work I will post a similar thread in the Ultralytics Github. Thanks! |
This should be fixed in @jcwchen I think you can close this. |
Great! Thanks for the info. Close here now. @Westycoot feel free to reopen it if you still have other ONNX questions. |
It looks like PyTorch 1.11 doesn't have a release yet, how can I get hold of this new export? Many thanks. Hopefully this will solve my issue :) |
@Westycoot before the 1.11 release you can use the latest PyTorch nightly version. I guess the model code may not be compatible with the latest version of PyTorch. This PR seems related: pytorch/pytorch#66419 You may have to change the model to be compatible with the latest PyTorch. But if you've already successfully exported using PyTorch 1.10, I think just editing the ir_version in the exported ONNX file is probably the easiest thing to do. Something like: import onnx
model = onnx.load("path/to/model.onnx")
model.ir_version = 4
onnx.save_model(model, "path/to/model.irv4.onnx") |
Ask a Question
Question
I have converted a YoloV5 model to ONNX with the Opset 9. This model works great running a C# program using Microsoft.ML. However, I am now trying to get this model to work with UWP which requires Windows.AI.MachineLearning and I am running into this error:
WinRT information: Failed to load model with error: Unknown model file format version.
I see that my file format version is 7 when I check the model in Netron, whereas example models are format version 4 or 5. How can I change this file format version? I am using an export.py script from Ultralytics - ultralytics/yolov5#251 which perform the conversion from YoloV5 to ONNX. As mentioned above, my model has worked for the Microsoft.ML package, but is not working for Windows.AI.MachineLearning.
I can't find any documentation about the file format version, so I am wondering how I can produce a ONNX model with a different format version as this seems to be the issue.
Many thanks.
The text was updated successfully, but these errors were encountered: