open-mmlab / mmdeploy

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

ERROR with turn tensorRT model. #1016

Closed Nuralill closed 1 year ago

Nuralill commented 2 years ago

I want to turn my libra-faster-rcnn model with tensorRT and use C++ SDK run it but failed. I used the following command: python tools/deploy.py configs/mmdet/detection/detection_tensorrt_dynamic-320x320-1344x1344.py ../mmdetection-master/configs/libra_rcnn/libra_faster_rcnn_r50_fpn_1x_coco.py ../mmdetection-master/work_dirs/libra_faster_rcnn_r50_fpn_1x_coco/best_bbox_mAP_epoch_136.pth ../mmdetection-master/demo/1.jpg --work-dir ../mmdeploy_out/mmdet/libra_faster_rcnn_r50_fpn_1x_coco/ --device cuda:0 --dump-info I am sure my enviroment is no problem,because I could successfully turn faster-rcnn model. All I changed is the model from resnet50 to resnet 34. This is my error log: e:\pycharmprojects\mmdetection-master\mmdet\datasets\utils.py:70: UserWarning: "ImageToTensor" pipeline is replaced by "DefaultFormatBundle" for batch inference. It is recommended to ma nually replace it in the test data pipeline in your config file. 'data pipeline in your config file.', UserWarning) 2022-09-07 10:40:25,891 - mmdeploy - INFO - Start pipeline mmdeploy.apis.pytorch2onnx.torch2onnx in subprocess load checkpoint from local path: ../mmdetection-master/work_dirs/libra_faster_rcnn_r50_fpn_1x_coco/best_bbox_mAP_epoch_136.pth e:\pycharmprojects\mmdetection-master\mmdet\datasets\utils.py:70: UserWarning: "ImageToTensor" pipeline is replaced by "DefaultFormatBundle" for batch inference. It is recommended to ma nually replace it in the test data pipeline in your config file. 'data pipeline in your config file.', UserWarning) 2022-09-07 10:40:33,375 - mmdeploy - WARNING - DeprecationWarning: get_onnx_config will be deprecated in the future. 2022-09-07 10:40:33,376 - mmdeploy - INFO - Export PyTorch model to ONNX: ../mmdeploy_out/mmdet/libra_faster_rcnn_r50_fpn_1x_coco/end2end.onnx. 2022-09-07 10:40:33,876 - mmdeploy - WARNING - Can not find torch._C._jit_pass_onnx_deduplicate_initializers, function rewrite will not be applied e:\pycharmprojects\mmdeploy-master\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) e:\pycharmprojects\mmdetection-master\mmdet\models\dense_heads\anchor_head.py:123: UserWarning: DeprecationWarning: anchor_generator is deprecated, please use "prior_generator" instead warnings.warn('DeprecationWarning: anchor_generator is deprecated, ' e:\pycharmprojects\mmdetection-master\mmdet\core\anchor\anchor_generator.py:333: UserWarning: ``grid_anchors`` would be deprecated soon. Please use ``grid_priors`` warnings.warn('``grid_anchors`` would be deprecated soon. ' e:\pycharmprojects\mmdetection-master\mmdet\core\anchor\anchor_generator.py:370: UserWarning: ``single_level_grid_anchors`` would be deprecated soon. Please use ``single_level_grid_prio rs`` '``single_level_grid_anchors`` would be deprecated soon. ' e:\pycharmprojects\mmdeploy-master\mmdeploy\codebase\mmdet\models\dense_heads\rpn_head.py:78: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrec t. 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:] e:\pycharmprojects\mmdeploy-master\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 t he 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: e:\pycharmprojects\mmdeploy-master\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 inco rrect. 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) e:\pycharmprojects\mmdeploy-master\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 inco rrect. 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) e:\pycharmprojects\mmdeploy-master\mmdeploy\codebase\mmdet\deploy\utils.py:47: TracerWarning: Using len to get tensor shape might cause the trace to be incorrect. Recommended usage woul d be tensor.shape[0]. Passing a tensor of different shape might lead to errors or silently give incorrect results. assert len(max_shape) == 2, 'max_shape` should be [h, w]' e:\pycharmprojects\mmdeploy-master\mmdeploy\codebase\mmdet\core\post_processing\bbox_nms.py:259: TracerWarning: Converting a tensor to a Python integer might cause the trace to be incor rect. 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]), e:\pycharmprojects\mmdeploy-master\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 f low 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) e:\pycharmprojects\mmdeploy-master\mmdeploy\mmcv\ops\nms.py:181: TracerWarning: Converting a tensor to a Python integer might cause the trace to be incorrect. We can't record the data f low 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! (batch_size, out_boxes)).to(scores.device)) Process Process-2: Traceback (most recent call last): File "D:\Users\hid\anaconda3\envs\mmdet\lib\site-packages\torch\onnx\symbolic_opset9.py", line 968, in symbolic_fn output_size = _parse_arg(output_size, "is") File "D:\Users\hid\anaconda3\envs\mmdet\lib\site-packages\torch\onnx\symbolic_helper.py", line 84, in _parse_arg "', since it's not constant, please try to make " RuntimeError: Failed to export an ONNX attribute 'onnx::Gather', since it's not constant, please try to make things (e.g., kernel size) static if possible

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "D:\Users\hid\anaconda3\envs\mmdet\lib\multiprocessing\process.py", line 297, in _bootstrap self.run() File "D:\Users\hid\anaconda3\envs\mmdet\lib\multiprocessing\process.py", line 99, in run self._target(*self._args, self._kwargs) File "e:\pycharmprojects\mmdeploy-master\mmdeploy\apis\core\pipeline_manager.py", line 107, in call ret = func(*args, *kwargs) File "e:\pycharmprojects\mmdeploy-master\mmdeploy\apis\pytorch2onnx.py", line 105, in torch2onnx optimize=optimize) File "e:\pycharmprojects\mmdeploy-master\mmdeploy\apis\core\pipeline_manager.py", line 356, in _wrap return self.call_function(funcname, args, kwargs) File "e:\pycharmprojects\mmdeploy-master\mmdeploy\apis\core\pipeline_manager.py", line 326, in call_function return self.call_function_local(func_name, *args, kwargs) File "e:\pycharmprojects\mmdeploy-master\mmdeploy\apis\core\pipeline_manager.py", line 275, in call_function_local return pipe_caller(*args, *kwargs) File "e:\pycharmprojects\mmdeploy-master\mmdeploy\apis\core\pipeline_manager.py", line 107, in call ret = func(args, kwargs) File "e:\pycharmprojects\mmdeploy-master\mmdeploy\apis\onnx\export.py", line 132, in export verbose=verbose) File "D:\Users\hid\anaconda3\envs\mmdet\lib\site-packages\torch\onnx__init.py", line 320, in export custom_opsets, enable_onnx_checker, use_external_data_format) File "D:\Users\hid\anaconda3\envs\mmdet\lib\site-packages\torch\onnx\utils.py", line 111, in export custom_opsets=custom_opsets, use_external_data_format=use_external_data_format) File "D:\Users\hid\anaconda3\envs\mmdet\lib\site-packages\torch\onnx\utils.py", line 729, in _export dynamic_axes=dynamic_axes) File "e:\pycharmprojects\mmdeploy-master\mmdeploy\core\rewriters\rewriter_utils.py", line 379, in wrapper return self.func(self, *args, **kwargs) File "e:\pycharmprojects\mmdeploy-master\mmdeploy\apis\onnx\optimizer.py", line 10, in model_to_graphcustom_optimizer graph, params_dict, torch_out = ctx.origin_func(*args, kwargs) File "D:\Users\hid\anaconda3\envs\mmdet\lib\site-packages\torch\onnx\utils.py", line 501, in _model_to_graph module=module) File "D:\Users\hid\anaconda3\envs\mmdet\lib\site-packages\torch\onnx\utils.py", line 216, in _optimize_graph graph = torch._C._jit_pass_onnx(graph, operator_export_type) File "D:\Users\hid\anaconda3\envs\mmdet\lib\site-packages\torch\onnx__init__.py", line 373, in _run_symbolic_function return utils._run_symbolic_function(*args, *kwargs) File "D:\Users\hid\anaconda3\envs\mmdet\lib\site-packages\torch\onnx\utils.py", line 1032, in _run_symbolic_function return symbolic_fn(g, inputs, attrs) File "D:\Users\hid\anaconda3\envs\mmdet\lib\site-packages\torch\onnx\symbolic_opset9.py", line 970, in symbolic_fn return sym_help._onnx_unsupported("adaptive pooling, since output_size is not constant.") File "D:\Users\hid\anaconda3\envs\mmdet\lib\site-packages\torch\onnx\symbolic_helper.py", line 263, in _onnx_unsupported "Please feel free to request support or submit a pull request on PyTorch GitHub.".format(op_name)) RuntimeError: Unsupported: ONNX export of operator adaptive pooling, since output_size is not constant.. Please feel free to request support or submit a pull request on PyTorch GitHub. 2022-09-07 10:40:41,129 - mmdeploy - ERROR - mmdeploy.apis.pytorch2onnx.torch2onnx with Call id: 0 failed. exit. `

I changed the file \configs\libra_rcnn\libra_faster_rcnn_r50_fpn_1x_coco.py ,and ../faster_rcnn/faster_rcnn_r50_fpn_1x_coco.py all about renset34.

`base = '../faster_rcnn/faster_rcnn_r50_fpn_1x_coco.py'

model settings

model = dict( neck=[ dict( type='FPN', in_channels=[64, 128, 256, 512],#256, 512, 1024, 2048 out_channels=256, num_outs=5), dict( type='BFP', in_channels=256, num_levels=5, refine_level=2, refine_type='non_local') ], roi_head=dict( bbox_head=dict( loss_bbox=dict( delete=True, type='BalancedL1Loss', alpha=0.5, gamma=1.5, beta=1.0, loss_weight=1.0))),

model training and testing settings

train_cfg=dict(
    rpn=dict(sampler=dict(neg_pos_ub=5), allowed_border=-1),
    rcnn=dict(
        sampler=dict(
            _delete_=True,
            type='CombinedSampler',
            num=512,
            pos_fraction=0.25,
            add_gt_as_proposals=True,
            pos_sampler=dict(type='InstanceBalancedPosSampler'),
            neg_sampler=dict(
                type='IoUBalancedNegSampler',
                floor_thr=-1,
                floor_fraction=0,
                num_bins=3)))))

` Please help me!

Nuralill commented 2 years ago

我把libra-fasterrcnn的resnet50改成了resnet34,在模型转化的时候出现了这样的报错 2022-09-07 10:40:41,129 - mmdeploy - ERROR - mmdeploy.apis.pytorch2onnx.torch2onnx with Call id: 0 failed. exit. 我同样转化fasteerrcnn的resnet34时候成功了,请问哪里出错了呢

grimoire commented 2 years ago

Please dump a full config with cfg.dump(dump_path).

Nuralill commented 2 years ago

Could you tell me what should I do concretely?

grimoire commented 2 years ago

You can load the config and dump it into a new file. The full config can help us locate the error.

config_path = 'configs\libra_rcnn\libra_faster_rcnn_r50_fpn_1x_coco.py' # the res34 config you use
config_save_path = ... # the path you want to save
config = mmcv.Config.fromfile(config_path)
config.dump(config_save_path)

Paste the full config here. It would be better if you can tell us your system environments. You can use tools/check_env.py to collect the environments.

By the way. It is recommended to wrap the code into a code block like this in the issue.

reiffd7 commented 4 months ago

Was this error resolved? I am experiencing the same error when trying to deploy libra-retinanet:

model = dict(
    type='RetinaNet',
    data_preprocessor=dict(
        type='DetDataPreprocessor',
        mean=[103.53, 116.28, 123.675],
        std=[57.375, 57.12, 58.395],
        bgr_to_rgb=False,
        pad_size_divisor=32),
    backbone=dict(
        type='RegNet',
        arch='regnetx_400mf',
        out_indices=(0, 1, 2, 3),
        frozen_stages=1,
        norm_cfg=dict(type='BN', requires_grad=True),
        norm_eval=True,
        style='pytorch',
        init_cfg=dict(type='Pretrained', checkpoint='open-mmlab://regnetx_400mf')),
    neck=[
        dict(
            type='FPN',
            in_channels=[32, 64, 160, 384],
            out_channels=256,
            start_level=1,
            add_extra_convs='on_input',
            num_outs=5),
        dict(
            type='BFP',
            in_channels=256,
            num_levels=5,
            refine_level=1,
            refine_type='non_local')
    ],
    bbox_head=dict(
        type='RetinaHead',
        num_classes=1,
        in_channels=256,
        stacked_convs=4,
        feat_channels=256,
        anchor_generator=dict(
            type='AnchorGenerator',
            octave_base_scale=4,
            scales_per_octave=3,
            ratios=[0.5, 1.0, 2.0],
            strides=[8, 16, 32, 64, 128]),
        bbox_coder=dict(
            type='DeltaXYWHBBoxCoder',
            target_means=[.0, .0, .0, .0],
            target_stds=[1.0, 1.0, 1.0, 1.0]),
        loss_cls=dict(
            type='FocalLoss',
            use_sigmoid=True,
            gamma=0.0,
            alpha=0.25,
            loss_weight=1.0),
        loss_bbox=dict(
            type='BalancedL1Loss',
            alpha=0.5,
            gamma=1.5,
            beta=0.11,
            loss_weight=1.0)),
    # model training and testing settings
    train_cfg=dict(
        assigner=dict(
            type='MaxIoUAssigner',
            pos_iou_thr=0.5,
            neg_iou_thr=0.4,
            min_pos_iou=0,
            ignore_iof_thr=-1),
        sampler=dict(
                type='ScoreHLRSampler',
                num=512,
                pos_fraction=0.25,
                neg_pos_ub=-1),  # Focal loss should use PseudoSampler
        allowed_border=-1,
        pos_weight=-1,
        debug=False),
    test_cfg=dict(
        nms_pre=1000,
        min_bbox_size=0,
        score_thr=0.05,
        nms=dict(type='nms', iou_threshold=0.5),
        max_per_img=100)
        )

I think the issue is with the BFP component in the neck. The deployment runs fine without this component. Here is my full error:

Convert PyTorch model to ONNX graph...
05/09 18:44:21 - mmengine - ERROR - /root/workspace/mmdeploy/mmdeploy/apis/core/pipeline_manager.py - __call__ - 94 - Start pipeline mmdeploy.apis.pytorch2onnx.torch2onnx in subprocess
05/09 18:44:22 - mmengine - WARNING - Failed to search registry with scope "mmdet" 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 "mmdet" is a correct scope, or whether the registry is initialized.
05/09 18:44:22 - mmengine - WARNING - Failed to search registry with scope "mmdet" in the "mmdet_tasks" registry tree. As a workaround, the current "mmdet_tasks" registry in "mmdeploy" is used to build instance. This may cause unexpected failure when running the built modules. Please check whether "mmdet" is a correct scope, or whether the registry is initialized.
/usr/local/lib/python3.8/dist-packages/mmdet/models/dense_heads/anchor_head.py:108: UserWarning: DeprecationWarning: `num_anchors` is deprecated, for consistency or also use `num_base_priors` instead
  warnings.warn('DeprecationWarning: `num_anchors` is deprecated, '
Loads checkpoint by local backend from path: /opt/ml/forsight-model-optimization/model_data/person_detection/retinanet_regnetx_400mf_fpn_1x8_1x_person_detection_19_04_2024_subset/models/pytorch/bfp_cross_entropy_epoch_44.pth
05/09 18:44:25 - mmengine - WARNING - DeprecationWarning: get_onnx_config will be deprecated in the future. 
05/09 18:44:25 - mmengine - INFO - Export PyTorch model to ONNX: /opt/ml/forsight-model-optimization/model_data/person_detection/retinanet_regnetx_400mf_fpn_1x8_1x_person_detection_19_04_2024_subset/models/onnx/end2end.onnx.
05/09 18:44:25 - mmengine - WARNING - Can not find torch._C._jit_pass_onnx_autograd_function_process, function rewrite will not be applied
05/09 18:44:25 - mmengine - WARNING - Can not find mmdet.models.utils.transformer.PatchMerging.forward, function rewrite will not be applied
/root/workspace/mmdeploy/mmdeploy/codebase/mmdet/models/detectors/single_stage.py:84: TracerWarning: Iterating over a tensor might cause the trace to be incorrect. Passing a tensor of different shape won't change the number of iterations executed (and might lead to errors or silently give incorrect results).
  img_shape = [int(val) for val in img_shape]
/root/workspace/mmdeploy/mmdeploy/codebase/mmdet/models/detectors/single_stage.py:84: 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!
  img_shape = [int(val) for val in img_shape]
/root/workspace/mmdeploy/mmdeploy/core/optimizers/function_marker.py:160: 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)
/root/workspace/mmdeploy/mmdeploy/codebase/mmdet/models/dense_heads/base_dense_head.py:109: 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:58: 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/models/task_modules/coders/delta_xywh_bbox_coder.py:38: 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/models/task_modules/coders/delta_xywh_bbox_coder.py:40: 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/mmcv/ops/nms.py:451: 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!
  int(scores.shape[-1]),
/root/workspace/mmdeploy/mmdeploy/mmcv/ops/nms.py:148: 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 "/usr/local/lib/python3.8/dist-packages/torch/onnx/symbolic_opset9.py", line 1187, in symbolic_fn
    output_size = symbolic_helper._parse_arg(output_size, "is")
  File "/usr/local/lib/python3.8/dist-packages/torch/onnx/symbolic_helper.py", line 97, in _parse_arg
    raise RuntimeError(
RuntimeError: Failed to export an ONNX attribute 'onnx::Gather', since it's not constant, please try to make things (e.g., kernel size) static if possible

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap
    self.run()
  File "/usr/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 98, 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 131, in export
    torch.onnx.export(
  File "/usr/local/lib/python3.8/dist-packages/torch/onnx/__init__.py", line 350, in export
    return utils.export(
  File "/usr/local/lib/python3.8/dist-packages/torch/onnx/utils.py", line 163, in export
    _export(
  File "/usr/local/lib/python3.8/dist-packages/torch/onnx/utils.py", line 1074, in _export
    graph, params_dict, torch_out = _model_to_graph(
  File "/root/workspace/mmdeploy/mmdeploy/apis/onnx/optimizer.py", line 27, in model_to_graph__custom_optimizer
    graph, params_dict, torch_out = ctx.origin_func(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/torch/onnx/utils.py", line 731, in _model_to_graph
    graph = _optimize_graph(
  File "/usr/local/lib/python3.8/dist-packages/torch/onnx/utils.py", line 308, in _optimize_graph
    graph = _C._jit_pass_onnx(graph, operator_export_type)
  File "/usr/local/lib/python3.8/dist-packages/torch/onnx/__init__.py", line 416, in _run_symbolic_function
    return utils._run_symbolic_function(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/torch/onnx/utils.py", line 1406, in _run_symbolic_function
    return symbolic_fn(g, *inputs, **attrs)
  File "/usr/local/lib/python3.8/dist-packages/torch/onnx/symbolic_helper.py", line 308, in wrapper
    return fn(g, *args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/torch/onnx/symbolic_opset9.py", line 1189, in symbolic_fn
    return symbolic_helper._onnx_unsupported(
  File "/usr/local/lib/python3.8/dist-packages/torch/onnx/symbolic_helper.py", line 454, in _onnx_unsupported
    raise RuntimeError(
RuntimeError: Unsupported: ONNX export of operator adaptive pooling, since output_size is not constant.. Please feel free to request support or submit a pull request on PyTorch GitHub.
^CTraceback (most recent call last):

I'm running the deployment in a docker container with the following Dockerfile:

FROM openmmlab/mmdeploy:ubuntu20.04-cuda11.3-mmdeploy1.1.0
#FROM openmmlab/mmdeploy:ubuntu20.04-cuda11.8-mmdeploy

WORKDIR /root/workspace

RUN pip install joblib
RUN pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 torchaudio==0.12.1 --extra-index-url https://download.pytorch.org/whl/cu113

RUN pip install -U pip
RUN pip install joblib
RUN pip install openmim

RUN pip install fire onnx onnxsim sclblonnx
RUN mim install mmcv==2.1
RUN mim install mmrazor
RUN mim install mmdet>3
RUN mim install mmdeploy==1.3.0

RUN apt-get clean && rm -rf /var/lib/apt/lists/*