Skip to content
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

model.pth to model.onxx? #13

Open
zhoujinhai opened this issue Nov 4, 2019 · 0 comments
Open

model.pth to model.onxx? #13

zhoujinhai opened this issue Nov 4, 2019 · 0 comments

Comments

@zhoujinhai
Copy link

I have trained the pytorch model.pth on my dataset, then, I use the convert_to_caffe2_models.py to convert ONXX model, but it raise an error like this:

Traceback (most recent call last):
  File "convert_to_caffe2_models.py", line 50, in <module>
    torch.onnx.export(net, dummy_input, model_path, verbose=False, output_names=['scores', 'boxes'])
  File "/home/tsd/.local/lib/python3.6/site-packages/torch/onnx/__init__.py", line 25, in export
    return utils.export(*args, **kwargs)
  File "/home/tsd/.local/lib/python3.6/site-packages/torch/onnx/utils.py", line 131, in export
    strip_doc_string=strip_doc_string)
  File "/home/tsd/.local/lib/python3.6/site-packages/torch/onnx/utils.py", line 363, in _export
    _retain_param_name, do_constant_folding)
  File "/home/tsd/.local/lib/python3.6/site-packages/torch/onnx/utils.py", line 278, in _model_to_graph
    _disable_torch_constant_prop=_disable_torch_constant_prop)
  File "/home/tsd/.local/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/tsd/.local/lib/python3.6/site-packages/torch/onnx/__init__.py", line 50, in _run_symbolic_function
    return utils._run_symbolic_function(*args, **kwargs)
  File "/home/tsd/.local/lib/python3.6/site-packages/torch/onnx/utils.py", line 589, in _run_symbolic_function
    return fn(g, *inputs, **attrs)
  File "/home/tsd/.local/lib/python3.6/site-packages/torch/onnx/symbolic.py", line 130, in wrapper
    args = [_parse_arg(arg, arg_desc) for arg, arg_desc in zip(args, arg_descriptors)]
  File "/home/tsd/.local/lib/python3.6/site-packages/torch/onnx/symbolic.py", line 130, in <listcomp>
    args = [_parse_arg(arg, arg_desc) for arg, arg_desc in zip(args, arg_descriptors)]
  File "/home/tsd/.local/lib/python3.6/site-packages/torch/onnx/symbolic.py", line 90, in _parse_arg
    raise RuntimeError("Failed to export an ONNX attribute, "
RuntimeError: Failed to export an ONNX attribute, since it's not constant, please try to make things (e.g., kernel size) static if possible
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant