HRNet / HigherHRNet-Human-Pose-Estimation

This is an official implementation of our CVPR 2020 paper "HigherHRNet: Scale-Aware Representation Learning for Bottom-Up Human Pose Estimation" (https://arxiv.org/abs/1908.10357)
MIT License
1.34k stars 272 forks source link

assert(isinstance(orig, torch.nn.Module)) when trace #105

Open upupdayday opened 2 years ago

upupdayday commented 2 years ago

When I trace model on cpu,I got the assert error Have you met this before?

My environment version:

torch 1.3.0 torchvision 0.2.1

trace code:

trace_input = torch.randn(1, 3, self.cfg.DATASET.INPUT_SIZE, self.cfg.DATASET.INPUT_SIZE, dtype=torch.float)
ts = torch.jit.trace(model, trace_input, check_trace=False)

assert Error:

Traceback (most recent call last):
  File "test_HigherHRNet_mlu.py", line 394, in <module>
    higherhrnet = HigherHRNet(args, cfg)
  File "test_HigherHRNet_mlu.py", line 87, in __init__
    ts = torch.jit.trace(self.model, trace_input, check_trace=False)
  File "/torch/venv3/pytorch/lib/python3.6/site-packages/torch/jit/__init__.py", line 858, in trace
    check_tolerance, _force_outplace, _module_class)
  File "/torch/venv3/pytorch/lib/python3.6/site-packages/torch/jit/__init__.py", line 991, in trace_module
    module = make_module(mod, _module_class, _compilation_unit, tuple(inputs.keys()))
  File "/torch/venv3/pytorch/lib/python3.6/site-packages/torch/jit/__init__.py", line 709, in make_module
    return _module_class(mod, _compilation_unit=_compilation_unit)
  File "/torch/venv3/pytorch/lib/python3.6/site-packages/torch/jit/__init__.py", line 1462, in init_then_register
    original_init(self, *args, **kwargs)
  File "/torch/venv3/pytorch/lib/python3.6/site-packages/torch/jit/__init__.py", line 1462, in init_then_register
    original_init(self, *args, **kwargs)
  File "/torch/venv3/pytorch/lib/python3.6/site-packages/torch/jit/__init__.py", line 1733, in __init__
    self._modules[name] = make_module(submodule, TracedModule, _compilation_unit)
  File "/torch/venv3/pytorch/lib/python3.6/site-packages/torch/jit/__init__.py", line 709, in make_module
    return _module_class(mod, _compilation_unit=_compilation_unit)
  File "/torch/venv3/pytorch/lib/python3.6/site-packages/torch/jit/__init__.py", line 1462, in init_then_register
    original_init(self, *args, **kwargs)
  File "/torch/venv3/pytorch/lib/python3.6/site-packages/torch/jit/__init__.py", line 1733, in __init__
    self._modules[name] = make_module(submodule, TracedModule, _compilation_unit)
  File "/torch/venv3/pytorch/lib/python3.6/site-packages/torch/jit/__init__.py", line 709, in make_module
    return _module_class(mod, _compilation_unit=_compilation_unit)
  File "/torch/venv3/pytorch/lib/python3.6/site-packages/torch/jit/__init__.py", line 1462, in init_then_register
    original_init(self, *args, **kwargs)
  File "/torch/venv3/pytorch/lib/python3.6/site-packages/torch/jit/__init__.py", line 1733, in __init__
    self._modules[name] = make_module(submodule, TracedModule, _compilation_unit)
  File "/torch/venv3/pytorch/lib/python3.6/site-packages/torch/jit/__init__.py", line 709, in make_module
    return _module_class(mod, _compilation_unit=_compilation_unit)
  File "/torch/venv3/pytorch/lib/python3.6/site-packages/torch/jit/__init__.py", line 1462, in init_then_register
    original_init(self, *args, **kwargs)
  File "/torch/venv3/pytorch/lib/python3.6/site-packages/torch/jit/__init__.py", line 1733, in __init__
    self._modules[name] = make_module(submodule, TracedModule, _compilation_unit)
  File "/torch/venv3/pytorch/lib/python3.6/site-packages/torch/jit/__init__.py", line 709, in make_module
    return _module_class(mod, _compilation_unit=_compilation_unit)
  File "/torch/venv3/pytorch/lib/python3.6/site-packages/torch/jit/__init__.py", line 1462, in init_then_register
    original_init(self, *args, **kwargs)
  File "/torch/venv3/pytorch/lib/python3.6/site-packages/torch/jit/__init__.py", line 1733, in __init__
    self._modules[name] = make_module(submodule, TracedModule, _compilation_unit)
  File "/torch/venv3/pytorch/lib/python3.6/site-packages/torch/jit/__init__.py", line 709, in make_module
    return _module_class(mod, _compilation_unit=_compilation_unit)
  File "/torch/venv3/pytorch/lib/python3.6/site-packages/torch/jit/__init__.py", line 1462, in init_then_register
    original_init(self, *args, **kwargs)
  File "/torch/venv3/pytorch/lib/python3.6/site-packages/torch/jit/__init__.py", line 1710, in __init__
    assert(isinstance(orig, torch.nn.Module))
AssertionError
dongdongzi commented 5 months ago

I encountered the same problem