TensorRT icon indicating copy to clipboard operation
TensorRT copied to clipboard

🐛 [Bug] Torch_tensorrt compile doesn’t support pretrained torchvision Mask_RCNN model.

Open Pradnya-Mundargi opened this issue 3 years ago • 1 comments
trafficstars

Bug Description

Torch_tensorrt compile doesn’t support pretrained torchvision Mask_RCNN model. Error: RuntimeError: temporary: the only valid use of a module is looking up an attribute but found = prim::SetAttr[name=“_has_warned”](%self, %178) :

To Reproduce

Steps to reproduce the behavior:

  1. Please execute the .ipynb notebook attached below https://drive.google.com/file/d/1nN95csu4r9KQJhH8XaryGFYdBPiAKlqm/view

Expected behavior

Expected the pretained mask rcnn model from the torchvision module to compile.

Environment

Build information about Torch-TensorRT can be found by turning on debug messages

  • TensorRT Version: 1.2.0a0
  • GPU Type: GeForce RTX 3070
  • Nvidia Driver Version: 470.141.03
  • CUDA Version: 11.4
  • Operating System + Version: Ubuntu 20.04
  • Python Version (if applicable): 3.8.13
  • TensorFlow Version (if applicable): -
  • PyTorch Version (if applicable): 1.13.0a0+08820cb
  • How you installed PyTorch (conda, pip, libtorch, source): pip [pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu116]
  • Baremetal or Container (if container which image + tag): Nvidia NGC Container [nvcr.io/nvidia/pytorch:22.07-py3]

Pradnya-Mundargi avatar Aug 15 '22 14:08 Pradnya-Mundargi

I’m getting the same type of error for a custom model.

ghazalehtrb avatar Aug 16 '22 02:08 ghazalehtrb

I am having similer issue too.

  File "/home/ainl/anaconda3/envs/torch/lib/python3.8/site-packages/torch_tensorrt/_compile.py", line 125, in compile
    return torch_tensorrt.ts.compile(
  File "/home/ainl/anaconda3/envs/torch/lib/python3.8/site-packages/torch_tensorrt/ts/_compiler.py", line 136, in compile
    compiled_cpp_mod = _C.compile_graph(module._c, _parse_compile_spec(spec))
RuntimeError: 
temporary: the only valid use of a module is looking up an attribute but found  = prim::SetAttr[name="center"](%c2.53, %8)
:

However my torch.jit.script dump doesn't not have prim::SetAttr[name="center"](%c2.53, %8).

model_ft = model
lr_curr = torch.empty((1, 1, 4, 540, 960), dtype=torch.float32, device=device)
traced_model = torch.jit.script(model_ft, (lr_curr))
model = traced_model
f_s_m = torch._C._freeze_module(traced_model._c)
f_s_m.dump()

gmlwns2000 avatar Oct 07 '22 10:10 gmlwns2000

Getting the same error if I try to convert simple Mask RCNN, although torch.jit.script() works fine.

Augis363 avatar Oct 18 '22 06:10 Augis363

This issue has not seen activity for 90 days, Remove stale label or comment or this will be closed in 10 days

github-actions[bot] avatar Jan 17 '23 00:01 github-actions[bot]

This issue has not seen activity for 90 days, Remove stale label or comment or this will be closed in 10 days

github-actions[bot] avatar Apr 19 '23 00:04 github-actions[bot]