DerryHub / BEVFormer_tensorrt

BEVFormer inference on TensorRT, including INT8 Quantization and Custom TensorRT Plugins (float/half/half2/int8).
Apache License 2.0
433 stars 71 forks source link

amples/bevformer/tiny/pth2onnx.sh error, #74

Open linClubs opened 1 year ago

linClubs commented 1 year ago

hi, I run ./amples/bevformer/tiny/pth2onnx.sh, my terminal displayed as follows: how do I fix it? Thanks

my env:

bev-mmdet3d 0.1 comm 0.1.4 mmcv-full 1.5.0 mmdeploy 0.14.0 mmdet 2.25.1 pytorch-quantization 2.1.2 torch 1.10.0+cu113 torchaudio 0.10.0+rocm4.1 torchvision 0.11.0+cu113 TensorRT-8.5.3.1 cuda-11.3

(bevformer) lin@PC:~/code/BEVFormer_tensorrt$ sh samples/bevformer/tiny/pth2onnx.sh -d 0
Running on the GPU: 0
WARNING: Logging before flag parsing goes to stderr.
W0908 16:44:15.548062 139772466808640 collision.py:11] No FCL -- collision checking will not work
Loaded tensorrt plugins from /home/lin/code/BEVFormer_tensorrt/TensorRT/lib/libtensorrt_ops.so
Traceback (most recent call last):
  File "tools/pth2onnx.py", line 9, in <module>
    from det2trt.convert import pytorch2onnx
  File "/home/lin/code/BEVFormer_tensorrt/./det2trt/__init__.py", line 1, in <module>
    from .models import *
  File "/home/lin/code/BEVFormer_tensorrt/./det2trt/models/__init__.py", line 1, in <module>
    from .backbones import *
  File "/home/lin/code/BEVFormer_tensorrt/./det2trt/models/backbones/__init__.py", line 1, in <module>
    from .csp_darknet import CSPDarknetQ
  File "/home/lin/code/BEVFormer_tensorrt/./det2trt/models/backbones/csp_darknet.py", line 11, in <module>
    from ..utils import CSPLayer
  File "/home/lin/code/BEVFormer_tensorrt/./det2trt/models/utils/__init__.py", line 2, in <module>
    from .onnx_ops import rotate, rotate_p, rotate_p2
  File "/home/lin/code/BEVFormer_tensorrt/./det2trt/models/utils/onnx_ops.py", line 400, in <module>
    torch.onnx.register_custom_op_symbolic("aten::grid_sampler", grid_sampler_sym, 13)
  File "/home/lin/software/miniconda3/envs/bevformer/lib/python3.8/site-packages/torch/onnx/__init__.py", line 404, in register_custom_op_symbolic
    utils.register_custom_op_symbolic(symbolic_name, symbolic_fn, opset_version)
  File "/home/lin/software/miniconda3/envs/bevformer/lib/python3.8/site-packages/torch/onnx/utils.py", line 1255, in register_custom_op_symbolic
    ns, op_name = get_ns_op_name_from_custom_op(symbolic_name)
  File "/home/lin/software/miniconda3/envs/bevformer/lib/python3.8/site-packages/torch/onnx/utils.py", line 1245, in get_ns_op_name_from_custom_op
    raise RuntimeError("Failed to register operator {}. The domain {} is already a used domain."
RuntimeError: Failed to register operator aten::grid_sampler. The domain aten is already a used domain.
(bevformer) lin@PC:~/code/BEVFormer_tensorrt$ 
DerryHub commented 1 year ago

Maybe you should upgrade your pytorch to 1.12.1

linClubs commented 1 year ago

ok, I try it,thanks

Mandylove1993 commented 6 months ago

ok, I try it,thanks

I meet same error,are you solved? just upgrade pytorch to 1.12.1? Is it work?,Thanks!