mmdeploy icon indicating copy to clipboard operation
mmdeploy copied to clipboard

[Bug] RTMpose model cannot convert to Tensorrt engine. 模型文件转化到tensorrt失败

Open waveviewer opened this issue 1 year ago • 0 comments

Checklist

  • [X] I have searched related issues but cannot get the expected help.
  • [X] 2. I have read the FAQ documentation but cannot get the expected help.
  • [X] 3. The bug has not been fixed in the latest version.

Describe the bug

I want to use mmdeploy sdk on windows 11 with C++ API. First I install Windows prebuilt mmdeploy via documention, and I can sucessfully run the demo conversion and get correct both ONNX and TensorRT engine file. And I try to run the conversion script outlined in RTMPose ReadMe. However I can not run neither ONNX nor TensorRT demo. I find it challenging for me to discern any helpful information from the error logs, leading me to suspect that the issue might be related to version compatibility. I would greatly appreciate any assistance or guidance in resolving this matter.

Reproduction

In mmdeploy repo dir, and the checkpoint is RTMPose-m

python tools/deploy.py configs/mmpose/pose-detection_simcc_tensorrt_dynamic-256x192.py ../mmpose/projects/rtmpose/rtmpose/body_2d_keypoint/rtmpose-m_8xb256-420e_coco-256x192.py ../rtmpose-m_simcc-body7_pt-body7_420e-256x192-e48f03d0_20230504.pth demo/resources/human-pose.jpg --work-dir rtmpose-trt/rtmpose-m --device cuda:0 --show --dump-info --log-level DEBUG

Environment

01/15 19:01:59 - mmengine - INFO - 

01/15 19:01:59 - mmengine - INFO - **********Environmental information**********
01/15 19:02:07 - mmengine - INFO - sys.platform: win32
01/15 19:02:07 - mmengine - INFO - Python: 3.10.13 | packaged by Anaconda, Inc. | (main, Sep 11 2023, 13:24:38) [MSC v.1916 64 bit (AMD64)]
01/15 19:02:07 - mmengine - INFO - CUDA available: True
01/15 19:02:07 - mmengine - INFO - numpy_random_seed: 2147483648
01/15 19:02:07 - mmengine - INFO - GPU 0,1: NVIDIA GeForce GTX 1080
01/15 19:02:07 - mmengine - INFO - CUDA_HOME: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8
01/15 19:02:07 - mmengine - INFO - NVCC: Cuda compilation tools, release 11.8, V11.8.89
01/15 19:02:07 - mmengine - INFO - MSVC: Microsoft (R) C/C++ Optimizing Compiler Version 19.38.33133 for x64
01/15 19:02:07 - mmengine - INFO - GCC: n/a
01/15 19:02:07 - mmengine - INFO - PyTorch: 2.1.2
01/15 19:02:07 - mmengine - INFO - PyTorch compiling details: PyTorch built with:
  - C++ Version: 199711
  - MSVC 192930151
  - Intel(R) Math Kernel Library Version 2020.0.2 Product Build 20200624 for Intel(R) 64 architecture applications
  - Intel(R) MKL-DNN v3.1.1 (Git Hash 64f6bcbcbab628e96f33a62c3e975f8535a7bde4)
  - OpenMP 2019
  - LAPACK is enabled (usually provided by MKL)
  - CPU capability usage: AVX2
  - CUDA Runtime 11.8
  - NVCC architecture flags: -gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_61,code=sm_61;-gencode;arch=compute_70,code=sm_70;-gencode;arch=compute_75,code=sm_75;-gencode;arch=compute_80,code=sm_80;-gencode;arch=compute_86,code=sm_86;-gencode;arch=compute_37,code=sm_37;-gencode;arch=compute_90,code=sm_90;-gencode;arch=compute_37,code=compute_37
  - CuDNN 8.7
  - Magma 2.5.4
  - Build settings: BLAS_INFO=mkl, BUILD_TYPE=Release, CUDA_VERSION=11.8, CUDNN_VERSION=8.7.0, CXX_COMPILER=C:/cb/pytorch_1000000000000/work/tmp_bin/sccache-cl.exe, CXX_FLAGS=/DWIN32 /D_WINDOWS /GR /EHsc /bigobj /FS -DUSE_PTHREADPOOL -DNDEBUG -DUSE_KINETO -DLIBKINETO_NOCUPTI -DLIBKINETO_NOROCTRACER -DUSE_FBGEMM -DUSE_XNNPACK -DSYMBOLICATE_MOBILE_DEBUG_HANDLE /utf-8 /wd4624 /wd4068 /wd4067 /wd4267 /wd4661 /wd4717 /wd4244 /wd4804 /wd4273, LAPACK_INFO=mkl, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, TORCH_DISABLE_GPU_ASSERTS=OFF, TORCH_VERSION=2.1.2, USE_CUDA=ON, USE_CUDNN=ON, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_MKL=ON, USE_MKLDNN=ON, USE_MPI=OFF, USE_NCCL=OFF, USE_NNPACK=OFF, USE_OPENMP=ON, USE_ROCM=OFF,

01/15 19:02:07 - mmengine - INFO - TorchVision: 0.16.2
01/15 19:02:07 - mmengine - INFO - OpenCV: 4.9.0
01/15 19:02:07 - mmengine - INFO - MMEngine: 0.10.2
01/15 19:02:07 - mmengine - INFO - MMCV: 2.1.0
01/15 19:02:07 - mmengine - INFO - MMCV Compiler: MSVC 192930148
01/15 19:02:07 - mmengine - INFO - MMCV CUDA Compiler: not available
01/15 19:02:07 - mmengine - INFO - MMDeploy: 1.3.1+
01/15 19:02:07 - mmengine - INFO -

01/15 19:02:07 - mmengine - INFO - **********Backend information**********
01/15 19:02:12 - mmengine - INFO - tensorrt:    8.6.1
01/15 19:02:12 - mmengine - INFO - tensorrt custom ops: Available
01/15 19:02:12 - mmengine - INFO - ONNXRuntime: 1.16.3
01/15 19:02:12 - mmengine - INFO - ONNXRuntime-gpu:     None
01/15 19:02:12 - mmengine - INFO - ONNXRuntime custom ops:      Available
01/15 19:02:12 - mmengine - INFO - pplnn:       None
01/15 19:02:12 - mmengine - INFO - ncnn:        None
01/15 19:02:12 - mmengine - INFO - snpe:        None
01/15 19:02:12 - mmengine - INFO - openvino:    None
01/15 19:02:12 - mmengine - INFO - torchscript: 2.1.2
01/15 19:02:12 - mmengine - INFO - torchscript custom ops:      NotAvailable
01/15 19:02:12 - mmengine - INFO - rknn-toolkit:        None
01/15 19:02:12 - mmengine - INFO - rknn-toolkit2:       None
01/15 19:02:12 - mmengine - INFO - ascend:      None
01/15 19:02:12 - mmengine - INFO - coreml:      None
01/15 19:02:12 - mmengine - INFO - tvm: None
01/15 19:02:12 - mmengine - INFO - vacc:        None
01/15 19:02:12 - mmengine - INFO -

01/15 19:02:12 - mmengine - INFO - **********Codebase information**********
01/15 19:02:12 - mmengine - INFO - mmdet:       3.2.0
01/15 19:02:12 - mmengine - INFO - mmseg:       None
01/15 19:02:12 - mmengine - INFO - mmpretrain:  1.2.0
01/15 19:02:12 - mmengine - INFO - mmocr:       None
01/15 19:02:12 - mmengine - INFO - mmagic:      None
01/15 19:02:12 - mmengine - INFO - mmdet3d:     None
01/15 19:02:12 - mmengine - INFO - mmpose:      1.3.1
01/15 19:02:12 - mmengine - INFO - mmrotate:    None
01/15 19:02:12 - mmengine - INFO - mmaction:    None
01/15 19:02:12 - mmengine - INFO - mmrazor:     None
01/15 19:02:12 - mmengine - INFO - mmyolo:      None

Error traceback

python tools/deploy.py configs/mmpose/pose-detection_simcc_tensorrt_dynamic-256x192.py ../mmpose/projects/rtmpose/rtmpose/body_2d_keypoint/rtmpose-m_8xb256-420e_coco-256x192.py ../rtmpose-m_simcc-body7_pt-body7_420e-256x192-e48f03d0_20230504.pth demo/resources/human-pose.jpg --work-dir rtmpose-trt/rtmpose-m --device cuda:0 --show --dump-info --log-level DEBUG
01/15 16:12:02 - mmengine - WARNING - Failed to search registry with scope "mmpose" in the "Codebases" registry tree. As a workaround, the current "Codebases" registry in "mmdeploy" is used to build instance. This may cause unexpected failure when running the built modules. Please check whether "mmpose" is a correct scope, or whether the registry is initialized.
01/15 16:12:02 - mmengine - WARNING - Failed to search registry with scope "mmpose" in the "mmpose_tasks" registry tree. As a workaround, the current "mmpose_tasks" registry in "mmdeploy" is used to build instance. This may cause unexpected failure when running the built modules. Please check whether "mmpose" is a correct scope, or whether the registry is initialized.
01/15 16:12:08 - mmengine - WARNING - Failed to search registry with scope "mmpose" in the "Codebases" registry tree. As a workaround, the current "Codebases" registry in "mmdeploy" is used to build instance. This may cause unexpected failure when running the built modules. Please check whether "mmpose" is a correct scope, or whether the registry is initialized.
01/15 16:12:08 - mmengine - WARNING - Failed to search registry with scope "mmpose" in the "mmpose_tasks" registry tree. As a workaround, the current "mmpose_tasks" registry in "mmdeploy" is used to build instance. This may cause unexpected failure when running the built modules. Please check whether "mmpose" is a correct scope, or whether the registry is initialized.
Loads checkpoint by local backend from path: ../rtmpose-m_simcc-body7_pt-body7_420e-256x192-e48f03d0_20230504.pth
d:\projects\rtmposetest\mmpose\mmpose\datasets\datasets\utils.py:102: UserWarning: The metainfo config file "configs/_base_/datasets/coco.py" does not exist. A matched config file "d:\projects\rtmposetest\mmpose\mmpose\.mim\configs\_base_\datasets\coco.py" will be used instead.
  warnings.warn(
01/15 16:12:09 - mmengine - WARNING - DeprecationWarning: get_onnx_config will be deprecated in the future. 
01/15 16:12:09 - mmengine - INFO - Export PyTorch model to ONNX: rtmpose-trt/rtmpose-m\end2end.onnx.
01/15 16:12:09 - mmengine - WARNING - Can not find torch.nn.functional._scaled_dot_product_attention, function rewrite will not be applied
01/15 16:12:09 - mmengine - WARNING - Can not find mmdet.models.utils.transformer.PatchMerging.forward, function rewrite will not be applied
01/15 16:12:10 - mmengine - ERROR - D:\Apps\Miniconda\envs\rtmpose\lib\site-packages\mmdeploy\apis\core\pipeline_manager.py - pop_mp_output - 80 - `mmdeploy.apis.pytorch2onnx.torch2onnx` with Call id: 0 failed. exit.

waveviewer avatar Jan 16 '24 02:01 waveviewer