grimoire/mmdetection-to-tensorrt

Unable to convert FRCNN: Warning: Encountered known unsupported method torch.Tensor.new_tensor

Opened this issue · 3 comments

Describe the bug
I installed the newest MMDetection version but can not convert a simple frcnn model.

mim download mmdet --config faster_rcnn_x101_64x4d_fpn_1x_coco --dest .

mmdet2trt --save-engine=true --min-scale 1 3 800 1312 --opt-scale 1 3 800 1333 --max-scale 1 3 800 1344 ./faster_rcnn_x101_64x4d_fpn_1x_coco.py ./faster_rcnn_x101_64x4d_fpn_1x_coco_20200204-833ee192.pth faster_rcnn_x101_64x4d_fpn_1x_coco_1-1-1-1333x800_fp16.trt --fp16 True

Error:

/home/spraul/miniconda3/envs/mmdet-2.22/lib/python3.7/site-packages/mmdet/models/dense_heads/anchor_head.py:123: UserWarning: DeprecationWarning: anchor_generator is deprecated, please use "prior_generator" instead
  warnings.warn('DeprecationWarning: anchor_generator is deprecated, '
/home/spraul/miniconda3/envs/mmdet-2.22/lib/python3.7/site-packages/mmdet/core/anchor/anchor_generator.py:370: UserWarning: ``single_level_grid_anchors`` would be deprecated soon. Please use ``single_level_grid_priors`` 
  '``single_level_grid_anchors`` would be deprecated soon. '
Warning: Encountered known unsupported method torch.Tensor.new_tensor
Warning: Encountered known unsupported method torch.Tensor.new_tensor
Speicherzugriffsfehler

Any idea what happened here? FCOS works fine.

environment:

Collecting environment information...
PyTorch version: 1.8.0
Is debug build: False
CUDA used to build PyTorch: 11.1
OS: Debian GNU/Linux 11 (bullseye) (x86_64)
GCC version: (Debian 10.2.1-6) 10.2.1 20210110
Clang version: 11.0.1-2
CMake version: version 3.18.4
Libc version: glibc-2.17
Python version: 3.7.11 (default, Jul 27 2021, 14:32:16)  [GCC 7.5.0] (64-bit runtime)
Python platform: Linux-5.10.0-8-amd64-x86_64-with-debian-11.0
Is CUDA available: True
CUDA runtime version: 11.1.105
GPU models and configuration: GPU 0: GeForce RTX 2070 SUPER
Nvidia driver version: 460.84
cuDNN version: Could not collect
Versions of relevant libraries:
[pip3] mmcv-full==1.4.6
[pip3] mmdet==2.22.0
[pip3] mmdet2trt==0.5.0
[pip3] tensorrt==7.2.2.3
[pip3] torch==1.8.0
[pip3] torch2trt-dynamic==0.5.0
[pip3] torchaudio==0.8.0a0+a751e1d
[pip3] torchvision==0.9.0
[conda] ffmpeg                    4.3                  hf484d3e_0    pytorch
[conda] mmcv-full                 1.4.6                    pypi_0    pypi
[conda] mmdet                     2.22.0                   pypi_0    pypi
[conda] mmdet2trt                 0.5.0                     dev_0    <develop>
[conda] pytorch                   1.8.0           py3.7_cuda11.1_cudnn8.0.5_0    pytorch
[conda] tensorrt                  7.2.2.3                  pypi_0    pypi
[conda] torch2trt-dynamic         0.5.0                     dev_0    <develop>
[conda] torchaudio                0.8.0                      py37    pytorch
[conda] torchvision               0.9.0                py37_cu111    pytorch

Warning: Encountered known unsupported method torch.Tensor.new_tensor can be ignored. Any tensor generated by torch.Tensor.new_tensor would be treated as a constant value. And I can convert this model on my device(2070 super, same as yours).
Would you mind updating the version of TensorRT? I haven't tested this repo on TensorRT7 for a long time. And don't forget to rebuild amirstan_plugin.

Thanks for your reply. I have to test it with a newer TRT Version.
TRT 7.2.2.3 and cuda11.1 worked for me in the past with mmdet2.12 and mmdet2trt 0.4.0.
When do I have to rebuild amirstan_plugin? Everytime I switch to a new CUDA or TensorRT Version?

Yes, a rebuild is required if you are using a new CUDA or TensorRT. And custom ops has been changed a lot since 0.4.