-
Notifications
You must be signed in to change notification settings - Fork 678
Description
Checklist
- I have searched related issues but cannot get the expected help.
- 2. I have read the FAQ documentation but cannot get the expected help.
- 3. The bug has not been fixed in the latest version.
Describe the bug
RuntimeError: ONNX export failed: Couldn't export Python operator SigmoidGeometricMean
means that PyTorch's ONNX exporter is trying to export a custom Python operator named SigmoidGeometricMean to ONNX, but it doesn't know how to convert it into a standard ONNX operator. This is a common issue when using custom-defined PyTorch functions or modules that are not registered with the ONNX exporter.
Reproduction
python tools/deploy.py
configs/mmdet/detection/detection_onnxruntime_dynamic.py
/root/mmdetection/configs/tood/tood_r50_fpn_1x_visdrone.py
/root/mmdetection/work_dirs/tood_r50_fpn_1x_visdrone/epoch_12.pth
/root/autodl-tmp/test_smoke/smoke2025/train/true/images/yw_t_00010.jpg
--work-dir mmdeploy_models/mmdet/onnx/tood
--device cuda:0
--show
--dump-info
Environment
08/29 11:54:31 - mmengine - INFO -
08/29 11:54:31 - mmengine - INFO - **********Environmental information**********
08/29 11:54:32 - mmengine - INFO - sys.platform: linux
08/29 11:54:32 - mmengine - INFO - Python: 3.8.20 (default, Oct 3 2024, 15:24:27) [GCC 11.2.0]
08/29 11:54:32 - mmengine - INFO - CUDA available: True
08/29 11:54:32 - mmengine - INFO - MUSA available: False
08/29 11:54:32 - mmengine - INFO - numpy_random_seed: 2147483648
08/29 11:54:32 - mmengine - INFO - GPU 0: NVIDIA GeForce RTX 2080 Ti
08/29 11:54:32 - mmengine - INFO - CUDA_HOME: /usr/local/cuda
08/29 11:54:32 - mmengine - INFO - NVCC: Cuda compilation tools, release 11.3, V11.3.109
08/29 11:54:32 - mmengine - INFO - GCC: gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
08/29 11:54:32 - mmengine - INFO - PyTorch: 1.10.1+cu113
08/29 11:54:32 - mmengine - 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.2.3 (Git Hash 7336ca9f055cf1bfa13efb658fe15dc9b41f0740)
- OpenMP 201511 (a.k.a. OpenMP 4.5)
- LAPACK is enabled (usually provided by MKL)
- NNPACK is enabled
- CPU capability usage: AVX512
- 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-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 -Wno-stringop-overflow, LAPACK_INFO=mkl, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, TORCH_VERSION=1.10.1, 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=ON, USE_NNPACK=ON, USE_OPENMP=ON,
08/29 11:54:32 - mmengine - INFO - TorchVision: 0.11.2+cu113
08/29 11:54:32 - mmengine - INFO - OpenCV: 4.12.0
08/29 11:54:32 - mmengine - INFO - MMEngine: 0.10.7
08/29 11:54:32 - mmengine - INFO - MMCV: 2.1.0
08/29 11:54:32 - mmengine - INFO - MMCV Compiler: GCC 9.3
08/29 11:54:32 - mmengine - INFO - MMCV CUDA Compiler: 11.3
08/29 11:54:32 - mmengine - INFO - MMDeploy: 1.3.1+
08/29 11:54:32 - mmengine - INFO -
08/29 11:54:32 - mmengine - INFO - **********Backend information**********
08/29 11:54:32 - mmengine - INFO - tensorrt: 8.6.1
08/29 11:54:32 - mmengine - INFO - tensorrt custom ops: NotAvailable
08/29 11:54:32 - mmengine - INFO - ONNXRuntime: 1.19.2
08/29 11:54:32 - mmengine - INFO - ONNXRuntime-gpu: 1.19.2
08/29 11:54:32 - mmengine - INFO - ONNXRuntime custom ops: NotAvailable
08/29 11:54:32 - mmengine - INFO - pplnn: None
08/29 11:54:32 - mmengine - INFO - ncnn: None
08/29 11:54:32 - mmengine - INFO - snpe: None
08/29 11:54:32 - mmengine - INFO - openvino: None
08/29 11:54:32 - mmengine - INFO - torchscript: 1.10.1+cu113
08/29 11:54:32 - mmengine - INFO - torchscript custom ops: NotAvailable
08/29 11:54:32 - mmengine - INFO - rknn-toolkit: None
08/29 11:54:32 - mmengine - INFO - rknn-toolkit2: None
08/29 11:54:32 - mmengine - INFO - ascend: None
08/29 11:54:32 - mmengine - INFO - coreml: None
08/29 11:54:32 - mmengine - INFO - tvm: None
08/29 11:54:32 - mmengine - INFO - vacc: None
08/29 11:54:32 - mmengine - INFO -
08/29 11:54:32 - mmengine - INFO - **********Codebase information**********
08/29 11:54:32 - mmengine - INFO - mmdet: 3.3.0
08/29 11:54:32 - mmengine - INFO - mmseg: None
08/29 11:54:32 - mmengine - INFO - mmpretrain: None
08/29 11:54:32 - mmengine - INFO - mmocr: None
08/29 11:54:32 - mmengine - INFO - mmagic: None
08/29 11:54:32 - mmengine - INFO - mmdet3d: None
08/29 11:54:32 - mmengine - INFO - mmpose: None
08/29 11:54:32 - mmengine - INFO - mmrotate: None
08/29 11:54:32 - mmengine - INFO - mmaction: None
08/29 11:54:32 - mmengine - INFO - mmrazor: None
08/29 11:54:32 - mmengine - INFO - mmyolo: None
Error traceback
Process Process-2:
Traceback (most recent call last):
File "/root/miniconda3/envs/openmmlab/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap
self.run()
File "/root/miniconda3/envs/openmmlab/lib/python3.8/multiprocessing/process.py", line 108, in run
self._target(*self._args, **self._kwargs)
File "/root/mmdeploy-main/mmdeploy/apis/core/pipeline_manager.py", line 107, in __call__
ret = func(*args, **kwargs)
File "/root/mmdeploy-main/mmdeploy/apis/pytorch2onnx.py", line 98, in torch2onnx
export(
File "/root/mmdeploy-main/mmdeploy/apis/core/pipeline_manager.py", line 356, in _wrap
return self.call_function(func_name_, *args, **kwargs)
File "/root/mmdeploy-main/mmdeploy/apis/core/pipeline_manager.py", line 326, in call_function
return self.call_function_local(func_name, *args, **kwargs)
File "/root/mmdeploy-main/mmdeploy/apis/core/pipeline_manager.py", line 275, in call_function_local
return pipe_caller(*args, **kwargs)
File "/root/mmdeploy-main/mmdeploy/apis/core/pipeline_manager.py", line 107, in __call__
ret = func(*args, **kwargs)
File "/root/mmdeploy-main/mmdeploy/apis/onnx/export.py", line 138, in export
torch.onnx.export(
File "/root/miniconda3/envs/openmmlab/lib/python3.8/site-packages/torch/onnx/__init__.py", line 316, in export
return utils.export(model, args, f, export_params, verbose, training,
File "/root/miniconda3/envs/openmmlab/lib/python3.8/site-packages/torch/onnx/utils.py", line 107, in export
_export(model, args, f, export_params, verbose, training, input_names, output_names,
File "/root/miniconda3/envs/openmmlab/lib/python3.8/site-packages/torch/onnx/utils.py", line 737, in _export
proto, export_map, val_use_external_data_format = graph._export_onnx(
RuntimeError: ONNX export failed: Couldn't export Python operator SigmoidGeometricMean