You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@mxnet.apache.org by GitBox <gi...@apache.org> on 2021/12/04 13:00:07 UTC

[GitHub] [incubator-mxnet] maybeLee opened a new issue #20769: MXNet 1.8.0 fail to import ONNX model

maybeLee opened a new issue #20769:
URL: https://github.com/apache/incubator-mxnet/issues/20769


   ## Description
   I was trying to follow the official documentation: https://mxnet.apache.org/versions/1.6/api/python/docs/tutorials/packages/onnx/super_resolution.html
   to import an ONNX model into MXNet but failed.
   
   ### Error Message
   ```
   ValueError                                Traceback (most recent call last)
   <ipython-input-6-d9827b2914f4> in <module>()
   ----> 1 sym, arg, aux = onnx_mxnet.import_model(onnx_model_file)
   
   /usr/local/lib/python3.7/dist-packages/mxnet/contrib/onnx/onnx2mx/import_model.py in import_model(model_file)
        57     # loads model file and returns ONNX protobuf object
        58     model_proto = onnx.load_model(model_file)
   ---> 59     model_opset_version = max([x.version for x in model_proto.opset_import])
        60     sym, arg_params, aux_params = graph.from_onnx(model_proto.graph, opset_version=model_opset_version)
        61     return sym, arg_params, aux_params
   
   ValueError: max() arg is an empty sequence
   ```
   
   ## To Reproduce
   code to reproduce
   ```
   from PIL import Image
   import numpy as np
   import mxnet as mx
   import mxnet.contrib.onnx as onnx_mxnet
   from mxnet.test_utils import download
   from matplotlib.pyplot import imshow
   img_url = 'https://s3.amazonaws.com/onnx-mxnet/examples/super_res_input.jpg'
   download(img_url, 'super_res_input.jpg')
   model_url = 'https://s3.amazonaws.com/onnx-mxnet/examples/super_resolution.onnx'
   onnx_model_file = download(model_url, 'super_resolution.onnx')
   sym, arg, aux = onnx_mxnet.import_model(onnx_model_file)
   ```
   You can also access the reproducible script online
   https://colab.research.google.com/drive/10FuegzQA3iDusWSw4ofCMIi4tOLxg0Dd?usp=sharing
   
   Can you help fix this issue?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org
For additional commands, e-mail: issues-help@mxnet.apache.org


[GitHub] [incubator-mxnet] dai-ichiro commented on issue #20769: MXNet 1.8.0 fail to import ONNX model

Posted by GitBox <gi...@apache.org>.
dai-ichiro commented on issue #20769:
URL: https://github.com/apache/incubator-mxnet/issues/20769#issuecomment-988572747


   super_resolution.onnx has no opset because it is too old.
   
   
   ```
   import onnx
   from mxnet.contrib.onnx.onnx2mx.import_onnx import GraphProto
   
   graph = GraphProto()
   model_proto = onnx.load_model('super_resolution.onnx')
   sym, arg, aux = graph.from_onnx(model_proto.graph, opset_version=10)
   ```
   
   10 is dummy number.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org
For additional commands, e-mail: issues-help@mxnet.apache.org


[GitHub] [incubator-mxnet] dai-ichiro edited a comment on issue #20769: MXNet 1.8.0 fail to import ONNX model

Posted by GitBox <gi...@apache.org>.
dai-ichiro edited a comment on issue #20769:
URL: https://github.com/apache/incubator-mxnet/issues/20769#issuecomment-988572747


   super_resolution.onnx has no opset.
   I think it's because this is too old.
   
   ```
   import onnx
   from mxnet.contrib.onnx.onnx2mx.import_onnx import GraphProto
   
   graph = GraphProto()
   model_proto = onnx.load_model('super_resolution.onnx')
   sym, arg, aux = graph.from_onnx(model_proto.graph, opset_version=10)
   ```
   
   10 is dummy number.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org
For additional commands, e-mail: issues-help@mxnet.apache.org


[GitHub] [incubator-mxnet] maybeLee commented on issue #20769: MXNet 1.8.0 fail to import ONNX model

Posted by GitBox <gi...@apache.org>.
maybeLee commented on issue #20769:
URL: https://github.com/apache/incubator-mxnet/issues/20769#issuecomment-989453920


   Hi dai-ichiro,
   Thanks for your suggestion, it works!
   I am wondering if the developer can nicely update the tutorial page: https://mxnet.apache.org/versions/1.6/api/python/docs/tutorials/packages/onnx/super_resolution.html
   so people new to mxnet like me may not be confused.
   thanks a lot!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org
For additional commands, e-mail: issues-help@mxnet.apache.org