open-mmlab / mmdeploy

OpenMMLab Model Deployment Framework
https://mmdeploy.readthedocs.io/en/latest/
Apache License 2.0
2.79k stars 637 forks source link

When run the test.py[Bug] #1568

Closed ChenZhenGui closed 1 year ago

ChenZhenGui commented 1 year ago

Checklist

Describe the bug

When I run the test.py by the .pth model,there are some issue

Reproduction

python tools/test.py ./configs/mmpose/pose-detection_tensorrt_static-256x192.py /home/nvidia/Desktop/mmpose/configs/body_2d_keypoint/topdown_heatmap/coco/mobilevit_coco-256x192.py /home/nvidia/Desktop/mmdeploy/AP_epoch_200.pth

Environment

12/22 18:12:04 - mmengine - INFO - 

12/22 18:12:04 - mmengine - INFO - **********Environmental information**********
/home/nvidia/miniforge3/envs/mobilevit_test/lib/python3.6/site-packages/torchvision/io/image.py:11: UserWarning: Failed to load image Python extension: 
  warn(f"Failed to load image Python extension: {e}")
12/22 18:12:06 - mmengine - INFO - sys.platform: linux
12/22 18:12:06 - mmengine - INFO - Python: 3.6.15 | packaged by conda-forge | (default, Dec  3 2021, 19:12:04) [GCC 9.4.0]
12/22 18:12:06 - mmengine - INFO - CUDA available: True
12/22 18:12:06 - mmengine - INFO - numpy_random_seed: 2147483648
12/22 18:12:06 - mmengine - INFO - GPU 0: NVIDIA Tegra X1
12/22 18:12:06 - mmengine - INFO - CUDA_HOME: /usr/local/cuda-10.2
12/22 18:12:06 - mmengine - INFO - NVCC: Cuda compilation tools, release 10.2, V10.2.300
12/22 18:12:06 - mmengine - INFO - GCC: gcc (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04) 7.5.0
12/22 18:12:06 - mmengine - INFO - PyTorch: 1.8.0
12/22 18:12:06 - mmengine - INFO - PyTorch compiling details: PyTorch built with:
  - GCC 7.5
  - C++ Version: 201402
  - OpenMP 201511 (a.k.a. OpenMP 4.5)
  - NNPACK is enabled
  - CPU capability usage: NO AVX
  - CUDA Runtime 10.2
  - NVCC architecture flags: -gencode;arch=compute_53,code=sm_53;-gencode;arch=compute_62,code=sm_62;-gencode;arch=compute_72,code=sm_72
  - CuDNN 8.2.1
    - Built with CuDNN 8.0
  - Build settings: BLAS_INFO=open, BUILD_TYPE=Release, CUDA_VERSION=10.2, CUDNN_VERSION=8.0.0, CXX_COMPILER=/usr/bin/c++, CXX_FLAGS= -Wno-deprecated -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -fopenmp -DNDEBUG -DUSE_XNNPACK -O2 -fPIC -Wno-narrowing -Wall -Wextra -Werror=return-type -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-unused-result -Wno-unused-local-typedefs -Wno-strict-overflow -Wno-strict-aliasing -Wno-error=deprecated-declarations -Wno-stringop-overflow -Wno-psabi -Wno-error=pedantic -Wno-error=redundant-decls -Wno-error=old-style-cast -fdiagnostics-color=always -faligned-new -Wno-unused-but-set-variable -Wno-maybe-uninitialized -fno-math-errno -fno-trapping-math -Werror=format -DMISSING_ARM_VST1 -DMISSING_ARM_VLD1 -Wno-stringop-overflow, FORCE_FALLBACK_CUDA_MPI=1, LAPACK_INFO=open, TORCH_VERSION=1.8.0, USE_CUDA=ON, USE_CUDNN=ON, USE_EIGEN_FOR_BLAS=ON, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_MKL=OFF, USE_MKLDNN=OFF, USE_MPI=ON, USE_NCCL=0, USE_NNPACK=ON, USE_OPENMP=ON, 

12/22 18:12:06 - mmengine - INFO - TorchVision: 0.11.3
12/22 18:12:06 - mmengine - INFO - OpenCV: 4.6.0
12/22 18:12:06 - mmengine - INFO - MMEngine: 0.3.1
12/22 18:12:06 - mmengine - INFO - MMCV: 2.0.0rc2
12/22 18:12:06 - mmengine - INFO - MMCV Compiler: GCC 7.5
12/22 18:12:06 - mmengine - INFO - MMCV CUDA Compiler: 10.2
12/22 18:12:06 - mmengine - INFO - MMDeploy: 0.10.0+71344b2
12/22 18:12:06 - mmengine - INFO - 

12/22 18:12:06 - mmengine - INFO - **********Backend information**********
12/22 18:12:09 - mmengine - INFO - onnxruntime: None    ops_is_avaliable : False
12/22 18:12:10 - mmengine - INFO - tensorrt: 8.0.1.6    ops_is_avaliable : True
12/22 18:12:10 - mmengine - INFO - ncnn: None   ops_is_avaliable : False
12/22 18:12:10 - mmengine - INFO - pplnn_is_avaliable: False
12/22 18:12:10 - mmengine - INFO - openvino_is_avaliable: False
12/22 18:12:10 - mmengine - INFO - snpe_is_available: False
12/22 18:12:10 - mmengine - INFO - ascend_is_available: False
12/22 18:12:10 - mmengine - INFO - coreml_is_available: False
12/22 18:12:10 - mmengine - INFO - 

12/22 18:12:10 - mmengine - INFO - **********Codebase information**********
12/22 18:12:10 - mmengine - INFO - mmdet:   3.0.0rc3
12/22 18:12:10 - mmengine - INFO - mmseg:   None
12/22 18:12:10 - mmengine - INFO - mmcls:   None
12/22 18:12:10 - mmengine - INFO - mmocr:   None
12/22 18:12:10 - mmengine - INFO - mmedit:  None
12/22 18:12:10 - mmengine - INFO - mmdet3d: None
12/22 18:12:10 - mmengine - INFO - mmpose:  1.0.0rc0
12/22 18:12:10 - mmengine - INFO - mmrotate:    None
12/22 18:12:10 - mmengine - INFO - mmaction:    None

Error traceback

[TensorRT] ERROR: 1: [stdArchiveReader.cpp::StdArchiveReader::29] Error Code 1: Serialization (Serialization assertion magicTagRead == magicTag failed.Magic tag does not match)
[TensorRT] ERROR: 4: [runtime.cpp::deserializeCudaEngine::76] Error Code 4: Internal Error (Engine deserialization failed.)
Traceback (most recent call last):
  File "/home/nvidia/miniforge3/envs/mobilevit_test/lib/python3.6/site-packages/mmengine/registry/build_functions.py", line 121, in build_from_cfg
    obj = obj_cls(**args)  # type: ignore
  File "/home/nvidia/Desktop/mmdeploy/mmdeploy/codebase/mmpose/deploy/pose_detection_model.py", line 60, in __init__
    **kwargs)
  File "/home/nvidia/Desktop/mmdeploy/mmdeploy/codebase/mmpose/deploy/pose_detection_model.py", line 82, in _init_wrapper
    **kwargs)
  File "/home/nvidia/Desktop/mmdeploy/mmdeploy/codebase/base/backend_model.py", line 70, in _build_wrapper
    engine=backend_files[0], output_names=output_names)
  File "/home/nvidia/Desktop/mmdeploy/mmdeploy/backend/tensorrt/wrapper.py", line 88, in __init__
    but given: {type(self.engine)}')
TypeError: `engine` should be str or trt.ICudaEngine,                 but given: <class 'NoneType'>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "tools/test.py", line 157, in <module>
    main()
  File "tools/test.py", line 125, in main
    model = task_processor.build_backend_model(args.model)
  File "/home/nvidia/Desktop/mmdeploy/mmdeploy/codebase/mmpose/deploy/pose_detection.py", line 191, in build_backend_model
    **kwargs)
  File "/home/nvidia/Desktop/mmdeploy/mmdeploy/codebase/mmpose/deploy/pose_detection_model.py", line 253, in build_pose_detection_model
    **kwargs))
  File "/home/nvidia/miniforge3/envs/mobilevit_test/lib/python3.6/site-packages/mmengine/registry/registry.py", line 454, in build
    return self.build_func(cfg, *args, **kwargs, registry=self)
  File "/home/nvidia/miniforge3/envs/mobilevit_test/lib/python3.6/site-packages/mmengine/registry/build_functions.py", line 136, in build_from_cfg
    f'class `{obj_cls.__name__}` in '  # type: ignore
TypeError: class `End2EndModel` in mmdeploy/codebase/mmpose/deploy/pose_detection_model.py: `engine` should be str or trt.ICudaEngine,                 but given: <class 'NoneType'>
lvhan028 commented 1 year ago

test.py is used to test backend models instead of pytorch model

github-actions[bot] commented 1 year ago

This issue is marked as stale because it has been marked as invalid or awaiting response for 7 days without any further response. It will be closed in 5 days if the stale label is not removed or if there is no further response.

github-actions[bot] commented 1 year ago

This issue is closed because it has been stale for 5 days. Please open a new issue if you have similar issues or you have any new updates now.