failed to export mmdet efficientnet to onnx
error when export to onnx
code: 112b11469c7c95c9f92dcfc9dc58212f28ac2a54
[2022-07-09 06:36:12.441] [mmdeploy] [info] [model.cpp:95] Register 'DirectoryModel'
[2022-07-09 06:36:14.825] [mmdeploy] [info] [model.cpp:95] Register 'DirectoryModel'
/root/workspace/mmdetection/mmdet/datasets/utils.py:66: UserWarning: "ImageToTensor" pipeline is replaced by "DefaultFormatBundle" for batch inference. It is recommended to manually replace it in the test data pipeline in your config file.
warnings.warn(
[2022-07-09 06:36:24.775] [mmdeploy] [info] [model.cpp:95] Register 'DirectoryModel'
2022-07-09 06:36:24,811 - mmdeploy - INFO - Start pipeline mmdeploy.apis.pytorch2onnx.torch2onnx in subprocess
load checkpoint from local path: best_bbox_mAP_epoch_34.pth
/root/workspace/mmdetection/mmdet/datasets/utils.py:66: UserWarning: "ImageToTensor" pipeline is replaced by "DefaultFormatBundle" for batch inference. It is recommended to manually replace it in the test data pipeline in your config file.
warnings.warn(
2022-07-09 06:36:36,171 - mmdeploy - WARNING - DeprecationWarning: get_onnx_config will be deprecated in the future.
2022-07-09 06:36:36,172 - mmdeploy - INFO - Export PyTorch model to ONNX: /tensorrt/end2end.onnx.
/root/workspace/mmdeploy/mmdeploy/core/optimizers/function_marker.py:158: TracerWarning: Converting a tensor to a Python integer might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
ys_shape = tuple(int(s) for s in ys.shape)
/opt/conda/lib/python3.8/site-packages/mmcv/cnn/bricks/conv2d_adaptive_padding.py:49: TracerWarning: Converting a tensor to a Python float might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
output_h = math.ceil(img_h / stride_h)
/opt/conda/lib/python3.8/site-packages/mmcv/cnn/bricks/conv2d_adaptive_padding.py:50: TracerWarning: Converting a tensor to a Python float might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
output_w = math.ceil(img_w / stride_w)
/opt/conda/lib/python3.8/site-packages/mmcv/cnn/bricks/conv2d_adaptive_padding.py:52: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
max((output_h - 1) * self.stride[0] +
/opt/conda/lib/python3.8/site-packages/mmcv/cnn/bricks/conv2d_adaptive_padding.py:55: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
max((output_w - 1) * self.stride[1] +
/opt/conda/lib/python3.8/site-packages/mmcv/cnn/bricks/conv2d_adaptive_padding.py:57: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
if pad_h > 0 or pad_w > 0:
/root/workspace/mmdeploy/mmdeploy/codebase/mmdet/models/dense_heads/base_dense_head.py:95: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
assert cls_score.size()[-2:] == bbox_pred.size()[-2:]
/root/workspace/mmdeploy/mmdeploy/pytorch/functions/topk.py:56: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
if k > size:
/root/workspace/mmdeploy/mmdeploy/codebase/mmdet/core/bbox/delta_xywh_bbox_coder.py:39: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
assert pred_bboxes.size(0) == bboxes.size(0)
/root/workspace/mmdeploy/mmdeploy/codebase/mmdet/core/bbox/delta_xywh_bbox_coder.py:41: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
assert pred_bboxes.size(1) == bboxes.size(1)
/root/workspace/mmdeploy/mmdeploy/codebase/mmdet/core/post_processing/bbox_nms.py:259: TracerWarning: Converting a tensor to a Python integer might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
dets, labels = TRTBatchedNMSop.apply(boxes, scores, int(scores.shape[-1]),
/root/workspace/mmdeploy/mmdeploy/mmcv/ops/nms.py:178: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
out_boxes = min(num_boxes, after_topk)
Process Process-2:
Traceback (most recent call last):
File "/opt/conda/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap
self.run()
File "/opt/conda/lib/python3.8/multiprocessing/process.py", line 108, in run
self._target(*self._args, **self._kwargs)
File "/root/workspace/mmdeploy/mmdeploy/apis/core/pipeline_manager.py", line 107, in __call__
ret = func(*args, **kwargs)
File "/root/workspace/mmdeploy/mmdeploy/apis/pytorch2onnx.py", line 92, in torch2onnx
export(
File "/root/workspace/mmdeploy/mmdeploy/apis/core/pipeline_manager.py", line 356, in _wrap
return self.call_function(func_name_, *args, **kwargs)
File "/root/workspace/mmdeploy/mmdeploy/apis/core/pipeline_manager.py", line 326, in call_function
return self.call_function_local(func_name, *args, **kwargs)
File "/root/workspace/mmdeploy/mmdeploy/apis/core/pipeline_manager.py", line 275, in call_function_local
return pipe_caller(*args, **kwargs)
File "/root/workspace/mmdeploy/mmdeploy/apis/core/pipeline_manager.py", line 107, in __call__
ret = func(*args, **kwargs)
File "/root/workspace/mmdeploy/mmdeploy/apis/onnx/export.py", line 122, in export
torch.onnx.export(
File "/opt/conda/lib/python3.8/site-packages/torch/onnx/__init__.py", line 271, in export
return utils.export(model, args, f, export_params, verbose, training,
File "/opt/conda/lib/python3.8/site-packages/torch/onnx/utils.py", line 88, in export
_export(model, args, f, export_params, verbose, training, input_names, output_names,
File "/opt/conda/lib/python3.8/site-packages/torch/onnx/utils.py", line 691, in _export
_model_to_graph(model, args, verbose, input_names,
File "/root/workspace/mmdeploy/mmdeploy/core/rewriters/rewriter_utils.py", line 371, in wrapper
return self.func(self, *args, **kwargs)
File "/root/workspace/mmdeploy/mmdeploy/apis/onnx/optimizer.py", line 10, in model_to_graph__custom_optimizer
graph, params_dict, torch_out = ctx.origin_func(*args, **kwargs)
File "/opt/conda/lib/python3.8/site-packages/torch/onnx/utils.py", line 460, in _model_to_graph
graph = _optimize_graph(graph, operator_export_type,
File "/opt/conda/lib/python3.8/site-packages/torch/onnx/utils.py", line 206, in _optimize_graph
graph = torch._C._jit_pass_onnx(graph, operator_export_type)
File "/opt/conda/lib/python3.8/site-packages/torch/onnx/__init__.py", line 309, in _run_symbolic_function
return utils._run_symbolic_function(*args, **kwargs)
File "/opt/conda/lib/python3.8/site-packages/torch/onnx/utils.py", line 994, in _run_symbolic_function
return symbolic_fn(g, *inputs, **attrs)
File "/opt/conda/lib/python3.8/site-packages/torch/onnx/symbolic_opset11.py", line 466, in constant_pad_nd
pad = _prepare_onnx_paddings(g, sym_help._get_tensor_rank(input), padding)
File "/root/workspace/mmdeploy/mmdeploy/core/rewriters/rewriter_utils.py", line 371, in wrapper
return self.func(self, *args, **kwargs)
File "/root/workspace/mmdeploy/mmdeploy/pytorch/ops/pad.py", line 36, in _prepare_onnx_paddings__tensorrt
rank = sym_help._get_tensor_rank(input)
File "/opt/conda/lib/python3.8/site-packages/torch/onnx/symbolic_helper.py", line 196, in _get_tensor_rank
if not _is_tensor(x) or x.type() is None:
File "/opt/conda/lib/python3.8/site-packages/torch/onnx/symbolic_helper.py", line 190, in _is_tensor
return x.type().isSubtypeOf(torch._C.TensorType.get())
AttributeError: 'int' object has no attribute 'type'
2022-07-09 06:36:38,244 - mmdeploy - ERROR - `mmdeploy.apis.pytorch2onnx.torch2onnx` with Call id: 0 failed. exit.
@dwSun Hi, could provide the the full script and version of pytorch you are using?
I am using docker to build and run mmdeploy. This is the Dockerfile I am using https://github.com/open-mmlab/mmdeploy/blob/master/docker/GPU/Dockerfile
python ${MMDEPLOY_DIR}/tools/deploy.py /code/openmm-lab/mmdeploy/configs/mmdet/_base_/base_tensorrt_dynamic-320x321-1344x1344.py /code/mm_training/efficientnet/efficientnet.py /code/mm_training/efficientnet/best_bbox_mAP_epoch_69.pth /code/mm_training/efficientnet/test_data/SXCQ20160410420140.JPG --work-dir /code/mm_training/efficientnet/tensorrt --device cuda --show --dump-info
root@54601aaa1f4c:~/workspace# pip list
Package Version Location
---------------------- --------- ---------------------------
addict 2.4.0
asttokens 2.0.5
backcall 0.2.0
beautifulsoup4 4.11.1
brotlipy 0.7.0
certifi 2022.6.15
cffi 1.15.0
chardet 4.0.0
charset-normalizer 2.0.4
colorama 0.4.4
conda 4.13.0
conda-build 3.21.9
conda-content-trust 0+unknown
conda-package-handling 1.8.1
cryptography 37.0.1
cycler 0.11.0
Cython 0.29.28
decorator 5.1.1
dill 0.3.5.1
executing 0.8.3
filelock 3.6.0
flatbuffers 2.0
fonttools 4.34.4
glob2 0.7
h5py 3.7.0
idna 3.3
ipython 8.3.0
jedi 0.18.1
Jinja2 2.11.3
kiwisolver 1.4.3
libarchive-c 2.9
MarkupSafe 2.0.1
matplotlib 3.5.2
matplotlib-inline 0.1.2
mkl-fft 1.3.0
mkl-random 1.1.1
mkl-service 2.3.0
mmcv-full 1.4.0
mmdeploy 0.6.0 /root/workspace/mmdeploy
mmdet 2.24.1 /root/workspace/mmdetection
multiprocess 0.70.13
numpy 1.19.2
onnx 1.12.0
onnxruntime-gpu 1.8.1
opencv-python 4.6.0.66
packaging 21.3
parso 0.8.3
pexpect 4.8.0
pickleshare 0.7.5
Pillow 9.0.1
pip 21.2.4
pkginfo 1.8.2
prompt-toolkit 3.0.20
protobuf 3.20.1
psutil 5.8.0
ptyprocess 0.7.0
pure-eval 0.2.2
pycocotools 2.0.4
pycosat 0.6.3
pycparser 2.21
Pygments 2.11.2
pyOpenSSL 22.0.0
pyparsing 3.0.9
PySocks 1.7.1
python-dateutil 2.8.2
pytz 2022.1
PyYAML 6.0
requests 2.27.1
ruamel-yaml-conda 0.15.100
setuptools 61.2.0
six 1.16.0
soupsieve 2.3.1
stack-data 0.2.0
tensorrt 7.2.3.4
terminaltables 3.1.10
torch 1.8.0
torchvision 0.9.0
tqdm 4.63.0
traitlets 5.1.1
typing_extensions 4.1.1
urllib3 1.26.8
wcwidth 0.2.5
wheel 0.37.1
yapf 0.32.0
root@54601aaa1f4c:~/workspace# conda list
# packages in environment at /opt/conda:
#
# Name Version Build Channel
_libgcc_mutex 0.1 main https://repo.anaconda.com/pkgs/main
_openmp_mutex 4.5 1_gnu https://repo.anaconda.com/pkgs/main
addict 2.4.0 pypi_0 pypi
asttokens 2.0.5 pyhd3eb1b0_0 defaults
backcall 0.2.0 pyhd3eb1b0_0 defaults
beautifulsoup4 4.11.1 py38h06a4308_0 defaults
blas 1.0 mkl defaults
brotlipy 0.7.0 py38h27cfd23_1003 defaults
bzip2 1.0.8 h7b6447c_0 defaults
ca-certificates 2022.4.26 h06a4308_0 defaults
certifi 2022.6.15 py38h06a4308_0 defaults
cffi 1.15.0 py38hd667e15_1 defaults
chardet 4.0.0 py38h06a4308_1003 defaults
charset-normalizer 2.0.4 pyhd3eb1b0_0 https://repo.anaconda.com/pkgs/main
colorama 0.4.4 pyhd3eb1b0_0 https://repo.anaconda.com/pkgs/main
conda 4.13.0 py38h06a4308_0 defaults
conda-build 3.21.9 py38h06a4308_0 defaults
conda-content-trust 0.1.1 pyhd3eb1b0_0 https://repo.anaconda.com/pkgs/main
conda-package-handling 1.8.1 py38h7f8727e_0 defaults
cryptography 37.0.1 py38h9ce1e76_0 defaults
cudatoolkit 10.2.89 hfd86e86_1 defaults
cycler 0.11.0 pypi_0 pypi
cython 0.29.28 py38h295c915_0 defaults
decorator 5.1.1 pyhd3eb1b0_0 defaults
dill 0.3.5.1 pypi_0 pypi
executing 0.8.3 pyhd3eb1b0_0 defaults
ffmpeg 4.3 hf484d3e_0 pytorch
filelock 3.6.0 pyhd3eb1b0_0 defaults
flatbuffers 2.0 pypi_0 pypi
fonttools 4.34.4 pypi_0 pypi
freetype 2.11.0 h70c0345_0 defaults
giflib 5.2.1 h7b6447c_0 defaults
glob2 0.7 pyhd3eb1b0_0 defaults
gmp 6.2.1 h295c915_3 defaults
gnutls 3.6.15 he1e5248_0 defaults
h5py 3.7.0 pypi_0 pypi
icu 58.2 he6710b0_3 defaults
idna 3.3 pyhd3eb1b0_0 https://repo.anaconda.com/pkgs/main
intel-openmp 2022.0.1 h06a4308_3633 defaults
ipython 8.3.0 py38h06a4308_0 defaults
jedi 0.18.1 py38h06a4308_1 defaults
jinja2 2.11.3 pyhd3eb1b0_0 defaults
jpeg 9b h024ee3a_2 defaults
kiwisolver 1.4.3 pypi_0 pypi
lame 3.100 h7b6447c_0 defaults
lcms2 2.12 h3be6417_0 defaults
ld_impl_linux-64 2.35.1 h7274673_9 https://repo.anaconda.com/pkgs/main
libarchive 3.4.2 h62408e4_0 defaults
libffi 3.3 he6710b0_2 https://repo.anaconda.com/pkgs/main
libgcc-ng 9.3.0 h5101ec6_17 https://repo.anaconda.com/pkgs/main
libgfortran-ng 7.5.0 ha8ba4b0_17 defaults
libgfortran4 7.5.0 ha8ba4b0_17 defaults
libgomp 9.3.0 h5101ec6_17 https://repo.anaconda.com/pkgs/main
libiconv 1.16 h7f8727e_2 defaults
libidn2 2.3.2 h7f8727e_0 defaults
liblief 0.11.5 h295c915_1 defaults
libopenblas 0.3.18 hf726d26_0 defaults
libpng 1.6.37 hbc83047_0 defaults
libstdcxx-ng 9.3.0 hd4cf53a_17 https://repo.anaconda.com/pkgs/main
libtasn1 4.16.0 h27cfd23_0 defaults
libtiff 4.1.0 h2733197_1 defaults
libunistring 0.9.10 h27cfd23_0 defaults
libuv 1.40.0 h7b6447c_0 defaults
libwebp 1.2.0 h89dd481_0 defaults
libxml2 2.9.14 h74e7548_0 defaults
lz4-c 1.9.3 h295c915_1 defaults
markupsafe 2.0.1 py38h27cfd23_0 defaults
matplotlib 3.5.2 pypi_0 pypi
matplotlib-inline 0.1.2 pyhd3eb1b0_2 defaults
mkl 2020.2 256 defaults
mkl-include 2022.0.1 h06a4308_117 defaults
mkl-service 2.3.0 py38he904b0f_0 defaults
mkl_fft 1.3.0 py38h54f3939_0 defaults
mkl_random 1.1.1 py38h0573a6f_0 defaults
mmcv-full 1.4.0 pypi_0 pypi
mmdeploy 0.6.0 dev_0 <develop>
mmdet 2.24.1 dev_0 <develop>
multiprocess 0.70.13 pypi_0 pypi
ncurses 6.3 h7f8727e_2 https://repo.anaconda.com/pkgs/main
nettle 3.7.3 hbbd107a_1 defaults
ninja 1.10.2 h06a4308_5 defaults
ninja-base 1.10.2 hd09550d_5 defaults
numpy 1.19.2 py38h54aff64_0 defaults
numpy-base 1.19.2 py38hfa32c7d_0 defaults
onnx 1.12.0 pypi_0 pypi
onnxruntime-gpu 1.8.1 pypi_0 pypi
opencv-python 4.6.0.66 pypi_0 pypi
openh264 2.1.1 h4ff587b_0 defaults
openssl 1.1.1o h7f8727e_0 defaults
packaging 21.3 pypi_0 pypi
parso 0.8.3 pyhd3eb1b0_0 defaults
patchelf 0.13 h295c915_0 defaults
pexpect 4.8.0 pyhd3eb1b0_3 defaults
pickleshare 0.7.5 pyhd3eb1b0_1003 defaults
pillow 9.0.1 py38h22f2fdc_0 defaults
pip 21.2.4 py38h06a4308_0 defaults
pkginfo 1.8.2 pyhd3eb1b0_0 defaults
prompt-toolkit 3.0.20 pyhd3eb1b0_0 defaults
protobuf 3.20.1 pypi_0 pypi
psutil 5.8.0 py38h27cfd23_1 defaults
ptyprocess 0.7.0 pyhd3eb1b0_2 defaults
pure_eval 0.2.2 pyhd3eb1b0_0 defaults
py-lief 0.11.5 py38h295c915_1 defaults
pycocotools 2.0.4 pypi_0 pypi
pycosat 0.6.3 py38h7b6447c_1 defaults
pycparser 2.21 pyhd3eb1b0_0 https://repo.anaconda.com/pkgs/main
pygments 2.11.2 pyhd3eb1b0_0 defaults
pyopenssl 22.0.0 pyhd3eb1b0_0 https://repo.anaconda.com/pkgs/main
pyparsing 3.0.9 pypi_0 pypi
pysocks 1.7.1 py38h06a4308_0 defaults
python 3.8.13 h12debd9_0 defaults
python-dateutil 2.8.2 pypi_0 pypi
python-libarchive-c 2.9 pyhd3eb1b0_1 defaults
pytorch 1.8.0 py3.8_cuda10.2_cudnn7.6.5_0 pytorch
pytz 2022.1 py38h06a4308_0 defaults
pyyaml 6.0 py38h7f8727e_1 defaults
readline 8.1.2 h7f8727e_1 https://repo.anaconda.com/pkgs/main
requests 2.27.1 pyhd3eb1b0_0 https://repo.anaconda.com/pkgs/main
ripgrep 12.1.1 0 defaults
ruamel_yaml 0.15.100 py38h27cfd23_0 defaults
setuptools 61.2.0 py38h06a4308_0 defaults
six 1.16.0 pyhd3eb1b0_1 https://repo.anaconda.com/pkgs/main
soupsieve 2.3.1 pyhd3eb1b0_0 defaults
sqlite 3.38.2 hc218d9a_0 https://repo.anaconda.com/pkgs/main
stack_data 0.2.0 pyhd3eb1b0_0 defaults
tensorrt 7.2.3.4 pypi_0 pypi
terminaltables 3.1.10 pypi_0 pypi
tk 8.6.11 h1ccaba5_0 https://repo.anaconda.com/pkgs/main
torchvision 0.9.0 py38_cu102 pytorch
tqdm 4.63.0 pyhd3eb1b0_0 https://repo.anaconda.com/pkgs/main
traitlets 5.1.1 pyhd3eb1b0_0 defaults
typing 3.10.0.0 py38h06a4308_0 defaults
typing_extensions 4.1.1 pyh06a4308_0 defaults
tzdata 2022a hda174b7_0 https://repo.anaconda.com/pkgs/main
urllib3 1.26.8 pyhd3eb1b0_0 https://repo.anaconda.com/pkgs/main
wcwidth 0.2.5 pyhd3eb1b0_0 defaults
wheel 0.37.1 pyhd3eb1b0_0 https://repo.anaconda.com/pkgs/main
xz 5.2.5 h7b6447c_0 https://repo.anaconda.com/pkgs/main
yaml 0.2.5 h7b6447c_0 https://repo.anaconda.com/pkgs/main
yapf 0.32.0 pypi_0 pypi
zlib 1.2.12 h7f8727e_1 https://repo.anaconda.com/pkgs/main
zstd 1.4.9 haebb681_0 defaults
@dwSun Hi could remove import _prepare_onnx_paddings__tensorrt from https://github.com/open-mmlab/mmdeploy/blob/master/mmdeploy/pytorch/ops/init.py and try again? It seems something wrong with this rewriting.
@dwSun Hi could remove
import _prepare_onnx_paddings__tensorrtfrom https://github.com/open-mmlab/mmdeploy/blob/master/mmdeploy/pytorch/ops/init.py and try again? It seems something wrong with this rewriting.
Torch2Onnx succeed, but onnx2tensorrt failed.
root@b76702ecd763:~/workspace/mmdeploy# python ${MMDEPLOY_DIR}/tools/deploy.py /code/openmm-lab/mmdeploy/configs/mmdet/_base_/base_tensorrt_dynamic-320x321-1344x1344.py /code/mm_training/efficientnet/efficientnet.py /code/mm_training/efficientnet/best_bbox_mAP_epoch_69.pth /code/mm_training/efficientnet/test_data/SXCQ20160410420140.JPG --work-dir /code/mm_training/efficientnet/tensorrt --device cuda --show --dump-info
[2022-07-13 03:14:49.170] [mmdeploy] [info] [model.cpp:95] Register 'DirectoryModel'
[2022-07-13 03:14:51.605] [mmdeploy] [info] [model.cpp:95] Register 'DirectoryModel'
/root/workspace/mmdetection/mmdet/datasets/utils.py:66: UserWarning: "ImageToTensor" pipeline is replaced by "DefaultFormatBundle" for batch inference. It is recommended to manually replace it in the test data pipeline in your config file.
warnings.warn(
[2022-07-13 03:15:01.827] [mmdeploy] [info] [model.cpp:95] Register 'DirectoryModel'
2022-07-13 03:15:01,863 - mmdeploy - INFO - Start pipeline mmdeploy.apis.pytorch2onnx.torch2onnx in subprocess
load checkpoint from local path: /code/mm_training/best_bbox_mAP_epoch_34.pth
/root/workspace/mmdetection/mmdet/datasets/utils.py:66: UserWarning: "ImageToTensor" pipeline is replaced by "DefaultFormatBundle" for batch inference. It is recommended to manually replace it in the test data pipeline in your config file.
warnings.warn(
2022-07-13 03:15:13,361 - mmdeploy - WARNING - DeprecationWarning: get_onnx_config will be deprecated in the future.
2022-07-13 03:15:13,362 - mmdeploy - INFO - Export PyTorch model to ONNX: /code/mm_training/tensorrt/end2end.onnx.
/root/workspace/mmdeploy/mmdeploy/core/optimizers/function_marker.py:158: TracerWarning: Converting a tensor to a Python integer might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
ys_shape = tuple(int(s) for s in ys.shape)
/opt/conda/lib/python3.8/site-packages/mmcv/cnn/bricks/conv2d_adaptive_padding.py:49: TracerWarning: Converting a tensor to a Python float might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
output_h = math.ceil(img_h / stride_h)
/opt/conda/lib/python3.8/site-packages/mmcv/cnn/bricks/conv2d_adaptive_padding.py:50: TracerWarning: Converting a tensor to a Python float might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
output_w = math.ceil(img_w / stride_w)
/opt/conda/lib/python3.8/site-packages/mmcv/cnn/bricks/conv2d_adaptive_padding.py:52: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
max((output_h - 1) * self.stride[0] +
/opt/conda/lib/python3.8/site-packages/mmcv/cnn/bricks/conv2d_adaptive_padding.py:55: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
max((output_w - 1) * self.stride[1] +
/opt/conda/lib/python3.8/site-packages/mmcv/cnn/bricks/conv2d_adaptive_padding.py:57: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
if pad_h > 0 or pad_w > 0:
/root/workspace/mmdeploy/mmdeploy/codebase/mmdet/models/dense_heads/base_dense_head.py:95: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
assert cls_score.size()[-2:] == bbox_pred.size()[-2:]
/root/workspace/mmdeploy/mmdeploy/pytorch/functions/topk.py:56: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
if k > size:
/root/workspace/mmdeploy/mmdeploy/codebase/mmdet/core/bbox/delta_xywh_bbox_coder.py:39: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
assert pred_bboxes.size(0) == bboxes.size(0)
/root/workspace/mmdeploy/mmdeploy/codebase/mmdet/core/bbox/delta_xywh_bbox_coder.py:41: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
assert pred_bboxes.size(1) == bboxes.size(1)
/root/workspace/mmdeploy/mmdeploy/codebase/mmdet/core/post_processing/bbox_nms.py:259: TracerWarning: Converting a tensor to a Python integer might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
dets, labels = TRTBatchedNMSop.apply(boxes, scores, int(scores.shape[-1]),
/root/workspace/mmdeploy/mmdeploy/mmcv/ops/nms.py:178: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
out_boxes = min(num_boxes, after_topk)
/opt/conda/lib/python3.8/site-packages/torch/onnx/symbolic_opset9.py:2603: UserWarning: Exporting aten::index operator of advanced indexing in opset 11 is achieved by combination of multiple ONNX operators, including Reshape, Transpose, Concat, and Gather. If indices include negative values, the exported graph will produce incorrect results.
warnings.warn("Exporting aten::index operator of advanced indexing in opset " +
2022-07-13 03:15:57,533 - mmdeploy - INFO - Execute onnx optimize passes.
2022-07-13 03:15:57,534 - 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-07-13 03:15:58,647 - mmdeploy - INFO - Finish pipeline mmdeploy.apis.pytorch2onnx.torch2onnx
[2022-07-13 03:16:01.775] [mmdeploy] [info] [model.cpp:95] Register 'DirectoryModel'
2022-07-13 03:16:01,811 - mmdeploy - INFO - Start pipeline mmdeploy.backend.tensorrt.onnx2tensorrt.onnx2tensorrt in subprocess
2022-07-13 03:16:02,116 - mmdeploy - INFO - Successfully loaded tensorrt plugins from /root/workspace/mmdeploy/mmdeploy/lib/libmmdeploy_tensorrt_ops.so
[TensorRT] WARNING: /workspace/TensorRT/t/oss-cicd/oss/parsers/onnx/onnx2trt_utils.cpp:227: Your ONNX model has been generated with INT64 weights, while TensorRT does not natively support INT64. Attempting to cast down to INT32.
[TensorRT] WARNING: /workspace/TensorRT/t/oss-cicd/oss/parsers/onnx/onnx2trt_utils.cpp:255: One or more weights outside the range of INT32 was clamped
[TensorRT] WARNING: /workspace/TensorRT/t/oss-cicd/oss/parsers/onnx/onnx2trt_utils.cpp:255: One or more weights outside the range of INT32 was clamped
Process Process-3:
Traceback (most recent call last):
File "/opt/conda/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap
self.run()
File "/opt/conda/lib/python3.8/multiprocessing/process.py", line 108, in run
self._target(*self._args, **self._kwargs)
File "/root/workspace/mmdeploy/mmdeploy/apis/core/pipeline_manager.py", line 107, in __call__
ret = func(*args, **kwargs)
File "/root/workspace/mmdeploy/mmdeploy/backend/tensorrt/onnx2tensorrt.py", line 79, in onnx2tensorrt
from_onnx(
File "/root/workspace/mmdeploy/mmdeploy/backend/tensorrt/utils.py", line 113, in from_onnx
raise RuntimeError(f'Failed to parse onnx, {error_msgs}')
RuntimeError: Failed to parse onnx, In node 61 (importPad): UNSUPPORTED_NODE: Assertion failed: inputs.at(1).is_weights()
2022-07-13 03:16:14,900 - mmdeploy - ERROR - `mmdeploy.backend.tensorrt.onnx2tensorrt.onnx2tensorrt` with Call id: 1 failed. exit.
@dwSun We have not supported EfficientNet from mmdet according to https://mmdeploy.readthedocs.io/en/latest/03-benchmark/supported_models.html#supported-models. There might be something wrong with F.pad in https://github.com/open-mmlab/mmcv/blob/f4167fe1e3d106cd641708d269ddbff568393437/mmcv/cnn/bricks/conv2d_adaptive_padding.py#L60.
only supported mmcls efficientnet with static HW with https://github.com/open-mmlab/mmdeploy/pull/1260