mmdeploy icon indicating copy to clipboard operation
mmdeploy copied to clipboard

pt->onnx ->engine 中报错,求解决

Open yohnyang opened this issue 1 year ago • 5 comments

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

python mmdeploy/tools/deploy.py mmdeploy/configs/mmdet/detection/detection_tensorrt_dynamic-320x320-1344x1344.py rtmdet_tiny_8xb32-300e_coco.py rtmdet_tiny_8xb32-300e_coco_20220902_112414-78e30dcc.pth mmdetection/demo/demo.jpg --work-dir weights --device cuda --dump-info 03/18 17:01:10 - 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. 03/18 17:01:10 - 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. 03/18 17:01:11 - mmengine - INFO - Start pipeline mmdeploy.apis.pytorch2onnx.torch2onnx in subprocess 03/18 17:01:12 - 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. 03/18 17:01:12 - 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. Loads checkpoint by local backend from path: rtmdet_tiny_8xb32-300e_coco_20220902_112414-78e30dcc.pth The model and loaded state dict do not match exactly

unexpected key in source state_dict: data_preprocessor.mean, data_preprocessor.std

03/18 17:01:12 - mmengine - WARNING - DeprecationWarning: get_onnx_config will be deprecated in the future. 03/18 17:01:12 - mmengine - INFO - Export PyTorch model to ONNX: weights\end2end.onnx. 03/18 17:01:12 - mmengine - WARNING - Can not find torch.nn.functional.scaled_dot_product_attention, function rewrite will not be applied 03/18 17:01:12 - mmengine - WARNING - Can not find mmdet.models.utils.transformer.PatchMerging.forward, function rewrite will not be applied e:\pycharm\open-mmlab\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) D:\program\Anaconda\envs\openmmlab\lib\site-packages\torch\functional.py:504: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\TensorShape.cpp:3191.) return _VF.meshgrid(tensors, **kwargs) # type: ignore[attr-defined] e:\pycharm\open-mmlab\mmdeploy\mmdeploy\mmcv\ops\nms.py:477: 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]), e:\pycharm\open-mmlab\mmdeploy\mmdeploy\mmcv\ops\nms.py:149: 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) 03/18 17:01:18 - mmengine - ERROR - e:\pycharm\open-mmlab\mmdeploy\mmdeploy\apis\core\pipeline_manager.py - pop_mp_output - 80 - mmdeploy.apis.pytorch2onnx.torch2onnx with Call id: 0 failed. exit.

Reproduction

123

Environment

在通过mmdeploy进行模型转换时遇到了这个问题,有没有大佬给指导一下

Error traceback

No response

yohnyang avatar Mar 18 '24 09:03 yohnyang

请问你解决了吗

xianmie avatar Apr 18 '24 03:04 xianmie

pip install onnxruntime==1.8.1

GiovanniFyc avatar Apr 24 '24 10:04 GiovanniFyc

请问你解决了吗?我换成python3.10就出现了这个问题

fat-921 avatar May 07 '24 10:05 fat-921