Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] create_process - 82 - visualize onnxruntime model failed. #2842

Open
3 tasks
jiangyuanJ opened this issue Nov 18, 2024 · 0 comments
Open
3 tasks

[Bug] create_process - 82 - visualize onnxruntime model failed. #2842

jiangyuanJ opened this issue Nov 18, 2024 · 0 comments

Comments

@jiangyuanJ
Copy link

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

i use the mmdeploy for mmseg the model inference,but there is a mistake.
AttributeError: module 'ctypes' has no attribute 'DLL'
11/18 16:27:36 - mmengine - ERROR - tools/deploy.py - create_process - 82 - visualize onnxruntime model failed.

Reproduction

python tools/deploy.py configs/mmseg/segmentation_onnxruntime_static-1024x2048.py my_maskformer_r50-d32_8xb2-160k_ade20k-512x512.py iter_10000.pth 100103.jpg --work-dir mmdeploy_models --show --dump-info

Environment

mmdeploy ==1.3.0 
onnxruntime ==1.15.1
onnxruntime-gpu==1.15.1
window10

Error traceback

(openmmlab) C:\Users\xxk\mmdeploy>python tools/deploy.py configs/mmseg/segmentation_onnxruntime_static-1024x2048.py my_maskformer_r50-d32_8xb2-160k_ade20k-512x512.py iter_10000.pth 100103.jpg --work-dir mmdeploy_models --show --dump-info
11/18 16:27:10 - mmengine - WARNING - Failed to search registry with scope "mmseg" 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 "mmseg" is a correct scope, or whether the registry is initialized.
11/18 16:27:10 - mmengine - WARNING - Failed to search registry with scope "mmseg" in the "mmseg_tasks" registry tree. As a workaround, the current "mmseg_tasks" registry in "mmdeploy" is used to build instance. This may cause unexpected failure when running the built modules. Please check whether "mmseg" is a correct scope, or whether the registry is initialized.
11/18 16:27:13 - mmengine - INFO - Start pipeline mmdeploy.apis.pytorch2onnx.torch2onnx in subprocess
11/18 16:27:16 - mmengine - WARNING - Failed to search registry with scope "mmseg" 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 "mmseg" is a correct scope, or whether the registry is initialized.
11/18 16:27:16 - mmengine - WARNING - Failed to search registry with scope "mmseg" in the "mmseg_tasks" registry tree. As a workaround, the current "mmseg_tasks" registry in "mmdeploy" is used to build instance. This may cause unexpected failure when running the built modules. Please check whether "mmseg" is a correct scope, or whether the registry is initialized.
Loads checkpoint by local backend from path: iter_10000.pth
11/18 16:27:16 - mmengine - WARNING - DeprecationWarning: get_onnx_config will be deprecated in the future.
11/18 16:27:16 - mmengine - INFO - Export PyTorch model to ONNX: mmdeploy_models\end2end.onnx.
E:\PyTorch_learning\Miniconda\install\envs\openmmlab\lib\site-packages\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)
E:\PyTorch_learning\Miniconda\install\envs\openmmlab\lib\site-packages\mmdeploy\codebase\mmseg\models\segmentors\base.py:47: 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]
E:\PyTorch_learning\Miniconda\install\envs\openmmlab\lib\site-packages\mmdeploy\codebase\mmseg\models\segmentors\base.py:61: 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 seg_logit.shape[1] == 1:
11/18 16:27:27 - mmengine - INFO - Execute onnx optimize passes.
11/18 16:27:27 - mmengine - WARNING - Can not optimize model, please build torchscipt extension.
More details: https://github.com/open-mmlab/mmdeploy/tree/main/docs/en/experimental/onnx_optimizer.md
============= Diagnostic Run torch.onnx.export version 2.0.1+cu117 =============
verbose: False, log level: Level.ERROR
======================= 0 NONE 0 NOTE 0 WARNING 0 ERROR ========================

11/18 16:27:28 - mmengine - INFO - Finish pipeline mmdeploy.apis.pytorch2onnx.torch2onnx
11/18 16:27:29 - mmengine - INFO - Start pipeline mmdeploy.apis.utils.utils.to_backend in main process
11/18 16:27:29 - mmengine - INFO - Finish pipeline mmdeploy.apis.utils.utils.to_backend
11/18 16:27:29 - mmengine - INFO - visualize onnxruntime model start.
11/18 16:27:35 - mmengine - WARNING - Failed to search registry with scope "mmseg" 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 "mmseg" is a correct scope, or whether the registry is initialized.
11/18 16:27:35 - mmengine - WARNING - Failed to search registry with scope "mmseg" in the "mmseg_tasks" registry tree. As a workaround, the current "mmseg_tasks" registry in "mmdeploy" is used to build instance. This may cause unexpected failure when running the built modules. Please check whether "mmseg" is a correct scope, or whether the registry is initialized.
11/18 16:27:35 - mmengine - WARNING - Failed to search registry with scope "mmseg" in the "backend_segmentors" registry tree. As a workaround, the current "backend_segmentors" registry in "mmdeploy" is used to build instance. This may cause unexpected failure when running the built modules. Please check whether "mmseg" is a correct scope, or whether the registry is initialized.
2024-11-18:16:27:35 - root - ERROR - module 'ctypes' has no attribute 'DLL'
Traceback (most recent call last):
  File "E:\PyTorch_learning\Miniconda\install\envs\openmmlab\lib\site-packages\mmdeploy\utils\utils.py", line 41, in target_wrapper
    result = target(*args, **kwargs)
  File "E:\PyTorch_learning\Miniconda\install\envs\openmmlab\lib\site-packages\mmdeploy\apis\visualize.py", line 65, in visualize_model
    model = task_processor.build_backend_model(
  File "E:\PyTorch_learning\Miniconda\install\envs\openmmlab\lib\site-packages\mmdeploy\codebase\mmseg\deploy\segmentation.py", line 157, in build_backend_model
    model = build_segmentation_model(
  File "E:\PyTorch_learning\Miniconda\install\envs\openmmlab\lib\site-packages\mmdeploy\codebase\mmseg\deploy\segmentation_model.py", line 224, in build_segmentation_model
    backend_segmentor = __BACKEND_MODEL.build(
  File "E:\PyTorch_learning\Miniconda\install\envs\openmmlab\lib\site-packages\mmengine\registry\registry.py", line 570, in build
    return self.build_func(cfg, *args, **kwargs, registry=self)
  File "E:\PyTorch_learning\Miniconda\install\envs\openmmlab\lib\site-packages\mmengine\registry\build_functions.py", line 121, in build_from_cfg
    obj = obj_cls(**args)  # type: ignore
  File "E:\PyTorch_learning\Miniconda\install\envs\openmmlab\lib\site-packages\mmdeploy\codebase\mmseg\deploy\segmentation_model.py", line 44, in __init__
    self._init_wrapper(
  File "E:\PyTorch_learning\Miniconda\install\envs\openmmlab\lib\site-packages\mmdeploy\codebase\mmseg\deploy\segmentation_model.py", line 52, in _init_wrapper
    self.wrapper = BaseBackendModel._build_wrapper(
  File "E:\PyTorch_learning\Miniconda\install\envs\openmmlab\lib\site-packages\mmdeploy\codebase\base\backend_model.py", line 65, in _build_wrapper
    return backend_mgr.build_wrapper(backend_files, device, input_names,
  File "E:\PyTorch_learning\Miniconda\install\envs\openmmlab\lib\site-packages\mmdeploy\backend\onnxruntime\backend_manager.py", line 35, in build_wrapper
    return ORTWrapper(
  File "E:\PyTorch_learning\Miniconda\install\envs\openmmlab\lib\site-packages\mmdeploy\backend\onnxruntime\wrapper.py", line 51, in __init__
    ctypes.DLL(lib_path)
AttributeError: module 'ctypes' has no attribute 'DLL'
11/18 16:27:36 - mmengine - ERROR - tools/deploy.py - create_process - 82 - visualize onnxruntime model failed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant