Description
Ask a Question
https://mxnet.apache.org/versions/1.5.0/tutorials/onnx/export_mxnet_to_onnx.html
runing this code got error
Downloaded input symbol and params files
sym = './resnet-18-symbol.json'
params = './resnet-18-0000.params'
Standard Imagenet input - 3 channels, 224*224
input_shape = (1,3,224,224)
Path of the output file
onnx_file = './mxnet_exported_resnet18.onnx'
Invoke export model API. It returns path of the converted onnx model
converted_model_path = onnx_mxnet.export_model(sym, params, [input_shape], np.float32, onnx_file)
Question
Explain your question here.
INFO:root:Converting json and weight file to sym and params
Calling mxnet.contrib.onnx.export_model...
Please be advised that the ONNX module has been moved to mxnet.onnx and mxnet.onnx.export_model is the preferred path. The current path will be deprecated in the upcoming MXNet v1.10 release.
[16:25:26] ../src/nnvm/legacy_json_util.cc:208: Loading symbol saved by previous version v0.8.0. Attempting to upgrade...
[16:25:26] ../src/nnvm/legacy_json_util.cc:216: Symbol successfully upgraded!
IndexError Traceback (most recent call last)
Cell In[7], line 2
1 # Invoke export model API. It returns path of the converted onnx model
----> 2 converted_model_path = onnx_mxnet.export_model(sym, params, [input_shape], np.float32, onnx_file)
File ~/.conda/envs/ppq/lib/python3.9/site-packages/mxnet/contrib/onnx/init.py:53, in export_model(*args, **kwargs)
49 print('Calling mxnet.contrib.onnx.export_model...')
50 print('Please be advised that the ONNX module has been moved to mxnet.onnx and '
51 'mxnet.onnx.export_model is the preferred path. The current path will be deprecated '
52 'in the upcoming MXNet v1.10 release.')
---> 53 return export_model_(*args, **kwargs)
File ~/.conda/envs/ppq/lib/python3.9/site-packages/mxnet/onnx/mx2onnx/_export_model.py:122, in export_model(sym, params, in_shapes, in_types, onnx_file_path, verbose, dynamic, dynamic_input_shapes, run_shape_inference, input_type, input_shape)
120 logging.info("Converting json and weight file to sym and params")
121 sym_obj, params_obj = load_module(sym, params)
--> 122 onnx_graph = converter.create_onnx_graph_proto(sym_obj, params_obj, in_shapes,
123 in_types_t,
124 verbose=verbose, opset_version=opset_version,
125 dynamic=dynamic, dynamic_input_shapes=dynamic_input_shapes)
126 elif isinstance(sym, symbol.Symbol) and isinstance(params, dict):
127 onnx_graph = converter.create_onnx_graph_proto(sym, params, in_shapes,
128 in_types_t,
129 verbose=verbose, opset_version=opset_version,
130 dynamic=dynamic, dynamic_input_shapes=dynamic_input_shapes)
...
--> 125 input_node_name = outputs_lookup[ip[0]][ip[1]].name
126 input_nodes.append(input_node_name)
128 return name, input_nodes, attrs
Notes
WSL2 Ubuntu-22.04
Package Version
certifi 2023.5.7
charset-normalizer 3.1.0
graphviz 0.8.4
idna 3.4
mxnet 1.9.1
numpy 1.20.0
onnx 1.14.0
pip 23.1.2
protobuf 4.23.1
requests 2.30.0
setuptools 67.7.2
typing_extensions 4.5.0
urllib3 2.0.2
wheel 0.40.0