anibali / margipose

3D monocular human pose estimation
Apache License 2.0
98 stars 20 forks source link

Not able to convert this model to ONNX #7

Closed jaggernaut007 closed 4 years ago

jaggernaut007 commented 4 years ago

Here is the error.. python3 src/margipose/bin/export_model.py -f onnx -i pretrained/margipose-h36m.pth -o pretrained/margipose.onnx /pytorch/aten/src/ATen/native/BinaryOps.cpp:81: UserWarning: Integer division of tensors using div or / is deprecated, and in a future release div will perform true division as in Python 3. Use true_divide or floor_divide (// in Python) instead. /home/shreyas/margipose/src/margipose/dsntnn.py:35: 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! /home/shreyas/.local/lib/python3.8/site-packages/torch/onnx/utils.py:736: UserWarning: ONNX export failed on ATen operator linspace because torch.onnx.symbolic_opset9.linspace does not exist Traceback (most recent call last): File "src/margipose/bin/export_model.py", line 60, in main() File "src/margipose/bin/export_model.py", line 54, in main onnx.export(model, (dummy_input,), args.output, verbose=False) File "/home/shreyas/.local/lib/python3.8/site-packages/torch/onnx/init.py", line 163, in export return utils.export(model, args, f, export_params, verbose, training, File "/home/shreyas/.local/lib/python3.8/site-packages/torch/onnx/utils.py", line 63, in export _export(model, args, f, export_params, verbose, training, input_names, output_names, File "/home/shreyas/.local/lib/python3.8/site-packages/torch/onnx/utils.py", line 483, in _export graph, params_dict, torch_out = _model_to_graph(model, args, verbose, File "/home/shreyas/.local/lib/python3.8/site-packages/torch/onnx/utils.py", line 349, in _model_to_graph graph = _optimize_graph(graph, operator_export_type, File "/home/shreyas/.local/lib/python3.8/site-packages/torch/onnx/utils.py", line 154, in _optimize_graph graph = torch._C._jit_pass_onnx(graph, operator_export_type) File "/home/shreyas/.local/lib/python3.8/site-packages/torch/onnx/init.py", line 199, in _run_symbolic_function return utils._run_symbolic_function(*args, **kwargs) File "/home/shreyas/.local/lib/python3.8/site-packages/torch/onnx/utils.py", line 739, in _run_symbolic_function op_fn = sym_registry.get_registered_op(op_name, '', opset_version) File "/home/shreyas/.local/lib/python3.8/site-packages/torch/onnx/symbolic_registry.py", line 109, in get_registered_op raise RuntimeError(msg) RuntimeError: Exporting the operator linspace to ONNX opset version 9 is not supported. Please open a bug to request ONNX export support for the missing operator.

Any fixes here that I can do with the model? Hopefully I need not go to ONNX repo and ask for an update!!

anibali commented 4 years ago

It looks like torch.linspace can't be ONNXified. The problem should be fixed in https://github.com/anibali/margipose/commit/5e6123f95eea2f161cf96730ff729390b1e0ef47.

jaggernaut007 commented 4 years ago

Awesome! Thanks!

Shreyas Jagannath

On Sun, 17 May 2020, 07:00 Aiden Nibali, notifications@github.com wrote:

It looks like torch.linspace can't be ONNXified. The problem should be fixed in 5e6123f https://github.com/anibali/margipose/commit/5e6123f95eea2f161cf96730ff729390b1e0ef47 .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/anibali/margipose/issues/7#issuecomment-629729118, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJPEPNEFE567S74R7MN35ZDRR442ZANCNFSM4NDCUETA .