You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using cache found in /home/paul/.cache/torch/hub/rwightman_gen-efficientnet-pytorch_master
/home/paul/.cache/torch/hub/rwightman_gen-efficientnet-pytorch_master/geffnet/conv2d_layers.py:47: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
return max((-(i // -s) - 1) * s + (k - 1) * d + 1 - i, 0)
/home/paul/pytorch/AdaBins/models/layers.py:19: TracerWarning: Converting a tensor to a Python index might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
embeddings = embeddings + self.positional_encodings[:embeddings.shape[2], :].T.unsqueeze(0)
Traceback (most recent call last):
File "rk3566Test.py", line 273, in <module>
export_pytorch_model()
File "rk3566Test.py", line 55, in export_pytorch_model
torch.onnx.export(net, x, "./sqnet_3566.onnx")
File "/home/paul/rknn2/lib/python3.6/site-packages/torch/onnx/__init__.py", line 208, in export
custom_opsets, enable_onnx_checker, use_external_data_format)
File "/home/paul/rknn2/lib/python3.6/site-packages/torch/onnx/utils.py", line 92, in export
use_external_data_format=use_external_data_format)
File "/home/paul/rknn2/lib/python3.6/site-packages/torch/onnx/utils.py", line 530, in _export
fixed_batch_size=fixed_batch_size)
File "/home/paul/rknn2/lib/python3.6/site-packages/torch/onnx/utils.py", line 384, in _model_to_graph
fixed_batch_size=fixed_batch_size, params_dict=params_dict)
File "/home/paul/rknn2/lib/python3.6/site-packages/torch/onnx/utils.py", line 188, in _optimize_graph
graph = torch._C._jit_pass_onnx(graph, operator_export_type)
File "/home/paul/rknn2/lib/python3.6/site-packages/torch/onnx/__init__.py", line 241, in _run_symbolic_function
return utils._run_symbolic_function(*args, **kwargs)
File "/home/paul/rknn2/lib/python3.6/site-packages/torch/onnx/utils.py", line 791, in _run_symbolic_function
return symbolic_fn(g, *inputs, **attrs)
File "/home/paul/rknn2/lib/python3.6/site-packages/torch/onnx/symbolic_helper.py", line 128, in wrapper
args = [_parse_arg(arg, arg_desc) for arg, arg_desc in zip(args, arg_descriptors)]
File "/home/paul/rknn2/lib/python3.6/site-packages/torch/onnx/symbolic_helper.py", line 128, in <listcomp>
args = [_parse_arg(arg, arg_desc) for arg, arg_desc in zip(args, arg_descriptors)]
File "/home/paul/rknn2/lib/python3.6/site-packages/torch/onnx/symbolic_helper.py", line 81, in _parse_arg
"', since it's not constant, please try to make "
RuntimeError: Failed to export an ONNX attribute 'onnx::Cast', since it's not constant, please try to make things (e.g., kernel size) static if possible
I did change the _EXPORTABLE flag to True in config.py as following:
# Set to True if exporting a model with Same padding via ONNX
_EXPORTABLE = True
Is this the right way to do it? or I miss something else? Could you please help? Thanks a lot.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi
I am impressed by your work on Rwightman / gen-efficientnet-pytorch.
I try to export your model to onnx as following:
But I encountered the following error message:
I did change the _EXPORTABLE flag to True in config.py as following:
Is this the right way to do it? or I miss something else? Could you please help? Thanks a lot.
Beta Was this translation helpful? Give feedback.
All reactions