mmdeploy
mmdeploy copied to clipboard
convnext onnx export loss precision!
Checklist
- I have searched related issues but cannot get the expected help.
- I have read the FAQ documentation but cannot get the expected help.
- The bug has not been fixed in the latest version.
Describe the bug
I try to convert mmcls's convnext to onnx format,the result is loss precion!
Reproduction
- What command or script did you run?
python ./tools/deploy.py \
configs/mmcls/classification_onnxruntime_dynamic.py \
~/workspace/mmclassification/configs/convnext/convnext-base_32xb128_in1k.py \
/root/workspace/weights/convnext-base_in21k-pre-3rdparty_32xb128_in1k_20220124-eb2d6ada.pth \
/root/workspace/mmclassification/demo/dog.jpg \
--work-dir work_dir \
--show \
--device cuda:0
- Did you make any modifications on the code or config? Did you understand what you have modified?
Environment
- Please run
python tools/check_env.pyto collect necessary environment information and paste it here.
2022-08-04 08:28:28,290 - mmdeploy - INFO -
2022-08-04 08:28:28,291 - mmdeploy - INFO - **********Environmental information**********
/opt/conda/lib/python3.8/site-packages/requests/__init__.py:102: RequestsDependencyWarning: urllib3 (1.26.8) or chardet (5.0.0)/charset_normalizer (2.0.4) doesn't match a supported version!
warnings.warn("urllib3 ({}) or chardet ({})/charset_normalizer ({}) doesn't match a supported "
2022-08-04 08:28:28,643 - mmdeploy - INFO - sys.platform: linux
2022-08-04 08:28:28,643 - mmdeploy - INFO - Python: 3.8.13 (default, Mar 28 2022, 11:38:47) [GCC 7.5.0]
2022-08-04 08:28:28,643 - mmdeploy - INFO - CUDA available: True
2022-08-04 08:28:28,643 - mmdeploy - INFO - GPU 0: Tesla P40
2022-08-04 08:28:28,644 - mmdeploy - INFO - CUDA_HOME: /usr/local/cuda
2022-08-04 08:28:28,644 - mmdeploy - INFO - NVCC: Cuda compilation tools, release 11.6, V11.6.124
2022-08-04 08:28:28,644 - mmdeploy - INFO - GCC: gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
2022-08-04 08:28:28,644 - mmdeploy - INFO - PyTorch: 1.11.0+cu113
2022-08-04 08:28:28,644 - mmdeploy - INFO - PyTorch compiling details: PyTorch built with:
- GCC 7.3
- C++ Version: 201402
- Intel(R) Math Kernel Library Version 2020.0.0 Product Build 20191122 for Intel(R) 64 architecture applications
- Intel(R) MKL-DNN v2.5.2 (Git Hash a9302535553c73243c632ad3c4c80beec3d19a1e)
- OpenMP 201511 (a.k.a. OpenMP 4.5)
- LAPACK is enabled (usually provided by MKL)
- NNPACK is enabled
- CPU capability usage: AVX2
- CUDA Runtime 11.3
- NVCC architecture flags: -gencode;arch=compute_37,code=sm_37;-gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_60,code=sm_60;-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
- CuDNN 8.2
- Magma 2.5.2
- Build settings: BLAS_INFO=mkl, BUILD_TYPE=Release, CUDA_VERSION=11.3, CUDNN_VERSION=8.2.0, CXX_COMPILER=/opt/rh/devtoolset-7/root/usr/bin/c++, CXX_FLAGS= -Wno-deprecated -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -fopenmp -DNDEBUG -DUSE_KINETO -DUSE_FBGEMM -DUSE_QNNPACK -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -DSYMBOLICATE_MOBILE_DEBUG_HANDLE -DEDGE_PROFILER_USE_KINETO -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-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 -Wno-stringop-overflow, LAPACK_INFO=mkl, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, TORCH_VERSION=1.11.0, USE_CUDA=ON, USE_CUDNN=ON, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_MKL=ON, USE_MKLDNN=OFF, USE_MPI=OFF, USE_NCCL=ON, USE_NNPACK=ON, USE_OPENMP=ON, USE_ROCM=OFF,
2022-08-04 08:28:28,644 - mmdeploy - INFO - TorchVision: 0.12.0+cu113
2022-08-04 08:28:28,644 - mmdeploy - INFO - OpenCV: 4.6.0
2022-08-04 08:28:28,644 - mmdeploy - INFO - MMCV: 1.5.3
2022-08-04 08:28:28,644 - mmdeploy - INFO - MMCV Compiler: GCC 7.3
2022-08-04 08:28:28,644 - mmdeploy - INFO - MMCV CUDA Compiler: 11.3
2022-08-04 08:28:28,644 - mmdeploy - INFO - MMDeploy: 0.6.0+ef56036
2022-08-04 08:28:28,644 - mmdeploy - INFO -
2022-08-04 08:28:28,644 - mmdeploy - INFO - **********Backend information**********
2022-08-04 08:28:29,698 - mmdeploy - INFO - onnxruntime: 1.8.1 ops_is_avaliable : False
2022-08-04 08:28:29,765 - mmdeploy - INFO - tensorrt: 8.2.4.2 ops_is_avaliable : True
2022-08-04 08:28:29,800 - mmdeploy - INFO - ncnn: None ops_is_avaliable : False
2022-08-04 08:28:29,801 - mmdeploy - INFO - pplnn_is_avaliable: False
2022-08-04 08:28:29,803 - mmdeploy - INFO - openvino_is_avaliable: False
2022-08-04 08:28:29,838 - mmdeploy - INFO - snpe_is_available: False
2022-08-04 08:28:29,838 - mmdeploy - INFO -
2022-08-04 08:28:29,838 - mmdeploy - INFO - **********Codebase information**********
2022-08-04 08:28:29,840 - mmdeploy - INFO - mmdet: None
2022-08-04 08:28:29,840 - mmdeploy - INFO - mmseg: None
2022-08-04 08:28:29,840 - mmdeploy - INFO - mmcls: 0.23.2
2022-08-04 08:28:29,840 - mmdeploy - INFO - mmocr: None
2022-08-04 08:28:29,840 - mmdeploy - INFO - mmedit: None
2022-08-04 08:28:29,840 - mmdeploy - INFO - mmdet3d: None
2022-08-04 08:28:29,840 - mmdeploy - INFO - mmpose: None
2022-08-04 08:28:29,840 - mmdeploy - INFO - mmrotate: None
- You may add addition that may be helpful for locating the problem, such as
- How you installed PyTorch [e.g., pip, conda, source] pytorch 1.11.0 cuda 11.3
- Other environment variables that may be related (such as
$PATH,$LD_LIBRARY_PATH,$PYTHONPATH, etc.)
python 3.8
Error traceback
If applicable, paste the error trackback here.
2022-08-04 00:54:56,452 - mmdeploy - INFO - Start pipeline mmdeploy.apis.pytorch2onnx.torch2onnx in subprocess
/opt/conda/lib/python3.8/site-packages/requests/__init__.py:102: RequestsDependencyWarning: urllib3 (1.26.8) or chardet (5.0.0)/charset_normalizer (2.0.4) doesn't match a supported version!
warnings.warn("urllib3 ({}) or chardet ({})/charset_normalizer ({}) doesn't match a supported "
load checkpoint from local path: /root/workspace/weights/convnext-base_in21k-pre-3rdparty_32xb128_in1k_20220124-eb2d6ada.pth
2022-08-04 00:55:01,976 - mmdeploy - WARNING - DeprecationWarning: get_onnx_config will be deprecated in the future.
2022-08-04 00:55:01,977 - mmdeploy - INFO - Export PyTorch model to ONNX: work_dir/end2end.onnx.
2022-08-04 00:55:07,997 - mmdeploy - INFO - Execute onnx optimize passes.
2022-08-04 00:55:07,998 - mmdeploy - WARNING - Can not optimize model, please build torchscipt extension.
More details: https://github.com/open-mmlab/mmdeploy/blob/master/docs/en/experimental/onnx_optimizer.md
2022-08-04 00:55:09,907 - mmdeploy - INFO - Finish pipeline mmdeploy.apis.pytorch2onnx.torch2onnx
2022-08-04 00:55:10,553 - mmdeploy - WARNING - "visualize_model" has been skipped may be because it's running on a headless device.
2022-08-04 00:55:10,553 - mmdeploy - INFO - All process success.
@tms2003 Hi, how much the performance difference is between PyTorch and ONNX Runtime?
Your config and checkpoint doesn't match, please try for this checkpoint.