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

ImportError: cannot import name 'PatchEmbed' from 'mmcv.cnn.bricks.transformer' #130

Closed
del-zhenwu opened this issue Feb 7, 2022 · 1 comment
Assignees

Comments

@del-zhenwu
Copy link
Collaborator

Thanks for your bug report. We appreciate it a lot.

Checklist

Describe the bug

Unit test run failed with the latest code, with mmcv v1.4.0

Reproduction

  1. What command or script did you run?
A placeholder for the command.
  1. Did you make any modifications on the code or config? Did you understand what you have modified?

Environment


[2022-02-07T02:37:14.109Z] 2022-02-07 10:37:13,530 - mmdeploy - INFO - TorchVision: 0.10.0+rocm4.2

[2022-02-07T02:37:14.109Z] 2022-02-07 10:37:13,530 - mmdeploy - INFO - OpenCV: 4.5.5

[2022-02-07T02:37:14.109Z] 2022-02-07 10:37:13,530 - mmdeploy - INFO - MMCV: 1.4.0

[2022-02-07T02:37:14.109Z] 2022-02-07 10:37:13,530 - mmdeploy - INFO - MMCV Compiler: GCC 7.3

[2022-02-07T02:37:14.109Z] 2022-02-07 10:37:13,530 - mmdeploy - INFO - MMCV CUDA Compiler: not available

[2022-02-07T02:37:14.109Z] 2022-02-07 10:37:13,530 - mmdeploy - INFO - MMDeployment: 0.1.0+230596b

[2022-02-07T02:37:14.109Z] 2022-02-07 10:37:13,530 - mmdeploy - INFO - 

[2022-02-07T02:37:14.109Z] 

[2022-02-07T02:37:14.109Z] 2022-02-07 10:37:13,531 - mmdeploy - INFO - **********Backend information**********

[2022-02-07T02:37:14.109Z] [2022-02-07 10:37:13.940] [mmdeploy] [info] Register 'DirectoryModel'

[2022-02-07T02:37:14.109Z] 2022-02-07 10:37:13,947 - mmdeploy - INFO - onnxruntime: 1.8.1 ops_is_avaliable : True

[2022-02-07T02:37:14.109Z] 2022-02-07 10:37:13,950 - mmdeploy - INFO - tensorrt: None ops_is_avaliable : False

[2022-02-07T02:37:14.109Z] 2022-02-07 10:37:13,953 - mmdeploy - INFO - ncnn: None ops_is_avaliable : False

[2022-02-07T02:37:14.109Z] 2022-02-07 10:37:13,955 - mmdeploy - INFO - pplnn_is_avaliable: False

[2022-02-07T02:37:14.109Z] 2022-02-07 10:37:13,957 - mmdeploy - INFO - openvino_is_avaliable: False

Error traceback

[2022-02-07T02:41:15.179Z] ____ ERROR collecting tests/test_codebase/test_mmcls/test_classification.py ____

[2022-02-07T02:41:15.179Z] ImportError while importing test module '/opt/mmdeploy/tests/test_codebase/test_mmcls/test_classification.py'.

[2022-02-07T02:41:15.179Z] Hint: make sure your test modules/packages have valid Python names.

[2022-02-07T02:41:15.179Z] Traceback:

[2022-02-07T02:41:15.179Z] /usr/lib/python3.8/importlib/__init__.py:127: in import_module

[2022-02-07T02:41:15.179Z]     return _bootstrap._gcd_import(name[level:], package, level)

[2022-02-07T02:41:15.179Z] tests/test_codebase/test_mmcls/test_classification.py:16: in <module>

[2022-02-07T02:41:15.179Z]     import_codebase(Codebase.MMCLS)

[2022-02-07T02:41:15.179Z] mmdeploy/codebase/__init__.py:30: in import_codebase

[2022-02-07T02:41:15.179Z]     importlib.import_module(f'mmdeploy.codebase.{lib}')

[2022-02-07T02:41:15.179Z] /usr/lib/python3.8/importlib/__init__.py:127: in import_module

[2022-02-07T02:41:15.179Z]     return _bootstrap._gcd_import(name[level:], package, level)

[2022-02-07T02:41:15.179Z] mmdeploy/codebase/mmcls/__init__.py:3: in <module>

[2022-02-07T02:41:15.179Z]     from .models import *  # noqa: F401,F403

[2022-02-07T02:41:15.179Z] mmdeploy/codebase/mmcls/models/__init__.py:2: in <module>

[2022-02-07T02:41:15.179Z]     from .backbones import *  # noqa: F401,F403

[2022-02-07T02:41:15.179Z] mmdeploy/codebase/mmcls/models/backbones/__init__.py:2: in <module>

[2022-02-07T02:41:15.179Z]     from .shufflenet_v2 import shufflenetv2_backbone__forward__ncnn

[2022-02-07T02:41:15.179Z] mmdeploy/codebase/mmcls/models/backbones/shufflenet_v2.py:3: in <module>

[2022-02-07T02:41:15.179Z]     from mmcls.models.utils import channel_shuffle

[2022-02-07T02:41:15.179Z] /usr/local/lib/python3.8/dist-packages/mmcls/models/__init__.py:2: in <module>

[2022-02-07T02:41:15.179Z]     from .backbones import *  # noqa: F401,F403

[2022-02-07T02:41:15.179Z] /usr/local/lib/python3.8/dist-packages/mmcls/models/backbones/__init__.py:27: in <module>

[2022-02-07T02:41:15.179Z]     from .twins import PCPVT, SVT

[2022-02-07T02:41:15.179Z] /usr/local/lib/python3.8/dist-packages/mmcls/models/backbones/twins.py:9: in <module>

[2022-02-07T02:41:15.179Z]     from mmcv.cnn.bricks.transformer import FFN, PatchEmbed

[2022-02-07T02:41:15.179Z] E   ImportError: cannot import name 'PatchEmbed' from 'mmcv.cnn.bricks.transformer' (/usr/local/lib/python3.8/dist-packages/mmcv/cnn/bricks/transformer.py)

Bug fix

If you have already identified the reason, you can provide the information here. If you are willing to create a PR to fix it, please also leave a comment here and that would be much appreciated!

@RunningLeon RunningLeon self-assigned this Feb 7, 2022
@RunningLeon
Copy link
Collaborator

Fixed in PR #131

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

2 participants