ilovepose/fast-human-pose-estimation.pytorch

RuntimeError: Only tensors and (possibly nested) tuples of tensors are supported as inputs or outputs of traced functions

ItsJasonPan opened this issue · 1 comments

Python: 3.7.6
CUDA Version 10.2.89
pytorch 1.0.0 py3.7_cuda10.0.130_cudnn7.4.1_1 [cuda100] pytorch
opencv 3.4.2 py37h6fd60c2_1
torchvision 0.2.1 py_2 pytorch

I am trying to train with bash script/mpii/run_train_hg.sh , but I immediately got the following errors. It may or may not have something to do with [https://github.com/pytorch/pytorch/issues/24904]

......
RESUME: False
  SHUFFLE: True
  WD: 0.0001
WORKERS: 24
/home/panicpanda/miniconda3/lib/python3.7/site-packages/torch/nn/modules/upsampling.py:129: UserWarning: nn.Upsample is deprecated. Use nn.functional.interpolate instead.
  warnings.warn("nn.{} is deprecated. Use nn.functional.interpolate instead.".format(self.name))
Only tensors and (possibly nested) tuples of tensors are supported as inputs or outputs of traced functions (toIValue at /opt/conda/conda-bld/pytorch_1544202130060/work/torch/csrc/jit/pybind_utils.h:91)
frame #0: c10::Error::Error(c10::SourceLocation, std::string const&) + 0x45 (0x7f46a88c0cc5 in /home/panicpanda/miniconda3/lib/python3.7/site-packages/torch/lib/libc10.so)
frame #1: <unknown function> + 0x343be6 (0x7f46e9278be6 in /home/panicpanda/miniconda3/lib/python3.7/site-packages/torch/lib/libtorch_python.so)
frame #2: <unknown function> + 0x3439eb (0x7f46e92789eb in /home/panicpanda/miniconda3/lib/python3.7/site-packages/torch/lib/libtorch_python.so)
frame #3: <unknown function> + 0x343dca (0x7f46e9278dca in /home/panicpanda/miniconda3/lib/python3.7/site-packages/torch/lib/libtorch_python.so)
frame #4: <unknown function> + 0x39a18c (0x7f46e92cf18c in /home/panicpanda/miniconda3/lib/python3.7/site-packages/torch/lib/libtorch_python.so)
frame #5: <unknown function> + 0x3a6325 (0x7f46e92db325 in /home/panicpanda/miniconda3/lib/python3.7/site-packages/torch/lib/libtorch_python.so)
frame #6: <unknown function> + 0x112176 (0x7f46e9047176 in /home/panicpanda/miniconda3/lib/python3.7/site-packages/torch/lib/libtorch_python.so)
<omitting python frames>
frame #29: __libc_start_main + 0xe7 (0x7f46f9fb6b97 in /lib/x86_64-linux-gnu/libc.so.6)

Error occurs, No graph saved
Traceback (most recent call last):
  File "tools/train.py", line 255, in <module>
    main()
  File "tools/train.py", line 143, in main
    writer_dict['writer'].add_graph(model, (dump_input, ))
  File "/home/panicpanda/miniconda3/lib/python3.7/site-packages/tensorboardX/writer.py", line 804, in add_graph
    self._get_file_writer().add_graph(graph(model, input_to_model, verbose, profile_with_cuda, **kwargs))
  File "/home/panicpanda/miniconda3/lib/python3.7/site-packages/tensorboardX/pytorch_graph.py", line 335, in graph
    raise e
  File "/home/panicpanda/miniconda3/lib/python3.7/site-packages/tensorboardX/pytorch_graph.py", line 326, in graph
    trace = torch.jit.trace(model, args)
  File "/home/panicpanda/miniconda3/lib/python3.7/site-packages/torch/jit/__init__.py", line 635, in trace
    var_lookup_fn, _force_outplace)
RuntimeError: Only tensors and (possibly nested) tuples of tensors are supported as inputs or outputs of traced functions (toIValue at /opt/conda/conda-bld/pytorch_1544202130060/work/torch/csrc/jit/pybind_utils.h:91)
frame #0: c10::Error::Error(c10::SourceLocation, std::string const&) + 0x45 (0x7f46a88c0cc5 in /home/panicpanda/miniconda3/lib/python3.7/site-packages/torch/lib/libc10.so)
frame #1: <unknown function> + 0x343be6 (0x7f46e9278be6 in /home/panicpanda/miniconda3/lib/python3.7/site-packages/torch/lib/libtorch_python.so)
frame #2: <unknown function> + 0x3439eb (0x7f46e92789eb in /home/panicpanda/miniconda3/lib/python3.7/site-packages/torch/lib/libtorch_python.so)
frame #3: <unknown function> + 0x343dca (0x7f46e9278dca in /home/panicpanda/miniconda3/lib/python3.7/site-packages/torch/lib/libtorch_python.so)
frame #4: <unknown function> + 0x39a18c (0x7f46e92cf18c in /home/panicpanda/miniconda3/lib/python3.7/site-packages/torch/lib/libtorch_python.so)
frame #5: <unknown function> + 0x3a6325 (0x7f46e92db325 in /home/panicpanda/miniconda3/lib/python3.7/site-packages/torch/lib/libtorch_python.so)
frame #6: <unknown function> + 0x112176 (0x7f46e9047176 in /home/panicpanda/miniconda3/lib/python3.7/site-packages/torch/lib/libtorch_python.so)
<omitting python frames>
frame #29: __libc_start_main + 0xe7 (0x7f46f9fb6b97 in /lib/x86_64-linux-gnu/libc.so.6)

problem solved. I was using tensorboardX 2.0 instead of 1.6