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

RuntimeError: Only tuples, lists and Variables supported as JIT inputs, but got dict #13040

Closed
olgapeled opened this issue Oct 24, 2018 · 22 comments
Closed

Comments

@olgapeled
Copy link

@olgapeled olgapeled commented Oct 24, 2018

Hi All,

I am trying to convert yolo2 pytorch to onnx model and I got:
"RuntimeError: Only tuples, lists and Variables supported as JIT inputs, but got dict"

This is the code example:
https://github.com/purelyvivid/yolo2_onnx/blob/master/1.yolo2_pytorch_onnx_save_model.ipynb

Any ideas?

cc @suo

@vince62s
Copy link

@vince62s vince62s commented Nov 9, 2018

same issue.
Is there any plan to support dict in ONNX ?
thanks to let us know.

Loading

@DJNing
Copy link

@DJNing DJNing commented Jan 16, 2019

same problem here, any solution now?

Loading

@wangshankun
Copy link

@wangshankun wangshankun commented May 16, 2019

same problem here, Centernet to onnx

Loading

@liuchang8am
Copy link

@liuchang8am liuchang8am commented May 17, 2019

Solved.Just change the output of your model from dict to list.

Loading

@cwjhx
Copy link

@cwjhx cwjhx commented May 25, 2019

Solved.Just change the output of your model from dict to list.

same problem , Centernet to onnx. "change the output of your model from dict to list".How should I change it ?

Loading

@zhyj3038
Copy link

@zhyj3038 zhyj3038 commented Jun 10, 2019

@wangshankun @cwjhx same problem. centernet to onnx. how u gays solved it? thanks!


SOLVED!

Loading

@sivaprasadraju
Copy link

@sivaprasadraju sivaprasadraju commented Jun 14, 2019

@wangshankun @cwjhx same problem. centernet to onnx. how u gays solved it? thanks!

SOLVED!

How did you change the output of model from dict to list? Thanks!

Loading

@zhyj3038
Copy link

@zhyj3038 zhyj3038 commented Jun 14, 2019

Loading

@westpilgrim
Copy link

@westpilgrim westpilgrim commented Jun 18, 2019

modify the original code which using setattr and getattr, it will generate dict . just using a list to gather 'hm', 'reg' and 'wh' layers.

how did you modify this?could you give some sample code?

Loading

@westpilgrim
Copy link

@westpilgrim westpilgrim commented Jun 19, 2019

I modify dlav0.py line 615 - 618 to :
ret = []
for head in self.heads:
ret.append(self.getattr(head)(x))
return [ret]

and convert to onnx successes.haven't test the model yet

Loading

@zhedasuiyuan
Copy link

@zhedasuiyuan zhedasuiyuan commented Jun 27, 2019

modify the original code which using setattr and getattr, it will generate dict . just using a list to gather 'hm', 'reg' and 'wh' layers.

---Original--- From: "Siva Prasad Raju"notifications@github.com Date: 2019/6/14 15:57:38 To: "pytorch/pytorch"pytorch@noreply.github.com; Cc: "zhang ya jun"zhyj3038@qq.com;"Comment"comment@noreply.github.com; Subject: Re: [pytorch/pytorch] RuntimeError: Only tuples, lists and Variables supported as JIT inputs, but got dict (#13040) @wangshankun @cwjhx same problem. centernet to onnx. how u gays solved it? thanks! SOLVED! How did you change the output of model from dict to list? Thanks! — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

Hi, could you share more details or kindly share your changes on the code? Thanks!

Loading

@echan00
Copy link

@echan00 echan00 commented Nov 11, 2019

Yes, it would be nice if someone could offer directions that will help here!

Loading

@visionandy
Copy link

@visionandy visionandy commented Nov 12, 2019

same problem here

Loading

@soumith
Copy link
Member

@soumith soumith commented Nov 12, 2019

cc: @wanchaol @driazati because a couple of new responses in the last 24 hours

Loading

@echan00
Copy link

@echan00 echan00 commented Nov 12, 2019

More information to reproduce: #29551

Loading

@fujingling
Copy link

@fujingling fujingling commented Nov 27, 2019

upgrade your torch to 1.3.0, this problem will be resolved

Loading

@cpoptic
Copy link

@cpoptic cpoptic commented Dec 9, 2019

Currently running Torch 1.3.1 and this problem is definitely still a problem. Upgrading to 1.3.x did not solve the problem at all.

Loading

@suo
Copy link
Member

@suo suo commented Dec 10, 2019

@lara-hdr You added this capability to the ONNX converter, right? When was it released?

Loading

@lara-hdr
Copy link
Contributor

@lara-hdr lara-hdr commented Dec 10, 2019

@suo, we added support for dicts in 1.3.0 #25889.
We only support it for ONNX and not jit.trace.
So calls to torch.jit.trace() will still give this error, but calls for torch.onnx.export() should work for PyTorch 1.3.0 and above.

Loading

@wangshuai66666
Copy link

@wangshuai66666 wangshuai66666 commented Aug 19, 2020

Solved.upgrade your torch to 1.3.0.

Loading

brosenfi referenced this issue Dec 17, 2020
Summary:
The args parameter of ONNX export is changed to better support optional arguments such that args is represented as:
args (tuple of arguments or torch.Tensor, a dictionary consisting of named arguments (optional)):
            a dictionary to specify the input to the corresponding named parameter:
            - KEY: str, named parameter
            - VALUE: corresponding input

Pull Request resolved: #47367

Reviewed By: H-Huang

Differential Revision: D25432691

Pulled By: bzinodev

fbshipit-source-id: 9d4cba73cbf7bef256351f181f9ac5434b77eee8
@spandantiwari
Copy link
Contributor

@spandantiwari spandantiwari commented May 17, 2021

Closing now. Please reopen if the issue persists.

Loading

@prathamsss
Copy link

@prathamsss prathamsss commented Oct 13, 2021

Still Facing the same issue

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet