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

traced_model #1291

Closed
HongyanJiao opened this issue Sep 19, 2019 · 4 comments
Closed

traced_model #1291

HongyanJiao opened this issue Sep 19, 2019 · 4 comments
Labels

Comments

@HongyanJiao
Copy link

HongyanJiao commented Sep 19, 2019

when I ran: traced_model = torch.jit.trace(model, (input_ids,))
I got:
/home/jhy/py3.6/lib/python3.6/site-packages/torch/tensor.py:389: RuntimeWarning: Iterating over a tensor might cause the trace to be incorrect. Passing a tensor of different shape won't change the number of iterations executed (and might lead to errors or silently give incorrect results).
'incorrect results).', category=RuntimeWarning)
Traceback (most recent call last):
File "/home/jhy/project/xlnet/src/xlnet_test.py", line 13, in
traced_model = torch.jit.trace(model, (input_ids,))
File "/home/jhy/py3.6/lib/python3.6/site-packages/torch/jit/init.py", line 772, in trace
check_tolerance, _force_outplace, _module_class)
File "/home/jhy/py3.6/lib/python3.6/site-packages/torch/jit/init.py", line 904, in trace_module
module._c._create_method_from_trace(method_name, func, example_inputs, var_lookup_fn, _force_outplace)
RuntimeError: Tracer cannot infer type of (tensor([[[-0.9993, 0.2632, -0.6305, ..., -0.3520, -1.2041, -1.5944],
[ 4.5358, 2.6032, -1.4790, ..., 2.1211, 1.6621, -0.9913],
[ 2.0586, 2.1398, 0.6811, ..., 1.9191, 0.0836, -1.2848],
...,
[-1.4818, 0.5329, 0.5212, ..., 0.6176, 1.7843, -1.8773],
[-2.8784, 1.9871, 0.5379, ..., 1.3778, 1.0554, -1.3039],
[-4.1723, 1.3071, 0.6565, ..., 1.2515, 1.6618, -0.8640]]],
grad_fn=), (None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None))
:Cannot infer type of a None value (toTraceableIValue at /pytorch/torch/csrc/jit/pybind_utils.h:268)
frame #0: c10::Error::Error(c10::SourceLocation, std::string const&) + 0x33 (0x7f8ea599c273 in /home/jhy/py3.6/lib/python3.6/site-packages/torch/lib/libc10.so)
frame #1: + 0x44e288 (0x7f8ea69db288 in /home/jhy/py3.6/lib/python3.6/site-packages/torch/lib/libtorch_python.so)
frame #2: + 0x4bdda2 (0x7f8ea6a4ada2 in /home/jhy/py3.6/lib/python3.6/site-packages/torch/lib/libtorch_python.so)
frame #3: + 0x4d1d81 (0x7f8ea6a5ed81 in /home/jhy/py3.6/lib/python3.6/site-packages/torch/lib/libtorch_python.so)
frame #4: + 0x1d3ef4 (0x7f8ea6760ef4 in /home/jhy/py3.6/lib/python3.6/site-packages/torch/lib/libtorch_python.so)
frame #5: _PyCFunction_FastCallDict + 0x288 (0x566ad8 in /home/jhy/py3.6/bin/python)
frame #6: /home/jhy/py3.6/bin/python() [0x5067b0]
frame #7: _PyEval_EvalFrameDefault + 0x4de (0x50729e in /home/jhy/py3.6/bin/python)
frame #8: /home/jhy/py3.6/bin/python() [0x504232]
frame #9: /home/jhy/py3.6/bin/python() [0x505e83]
frame #10: /home/jhy/py3.6/bin/python() [0x5066f0]
frame #11: _PyEval_EvalFrameDefault + 0x4de (0x50729e in /home/jhy/py3.6/bin/python)
frame #12: /home/jhy/py3.6/bin/python() [0x504232]
frame #13: /home/jhy/py3.6/bin/python() [0x505e83]
frame #14: /home/jhy/py3.6/bin/python() [0x5066f0]
frame #15: _PyEval_EvalFrameDefault + 0x4de (0x50729e in /home/jhy/py3.6/bin/python)
frame #16: /home/jhy/py3.6/bin/python() [0x504232]
frame #17: PyEval_EvalCode + 0x23 (0x6022e3 in /home/jhy/py3.6/bin/python)
frame #18: /home/jhy/py3.6/bin/python() [0x647fa2]
frame #19: PyRun_FileExFlags + 0x9a (0x64806a in /home/jhy/py3.6/bin/python)
frame #20: PyRun_SimpleFileExFlags + 0x197 (0x649d97 in /home/jhy/py3.6/bin/python)
frame #21: Py_Main + 0x5c2 (0x63c352 in /home/jhy/py3.6/bin/python)
frame #22: main + 0xe9 (0x4dbcb9 in /home/jhy/py3.6/bin/python)
frame #23: __libc_start_main + 0xf0 (0x7f8eabcff830 in /lib/x86_64-linux-gnu/libc.so.6)
frame #24: _start + 0x29 (0x5cb639 in /home/jhy/py3.6/bin/python)

@FeiWang96
Copy link
Contributor

Which model did you use?

@HongyanJiao
Copy link
Author

Which model did you use?

xlnet

@LysandreJik
Copy link
Member

Hi! Could you show the inputs you use to trace your model?

@stale
Copy link

stale bot commented Nov 29, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Nov 29, 2019
@stale stale bot closed this as completed Dec 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants