The section we are using is the DETECTION section and I have executed the make.sh file in the ops folder. But we still get the following during training ImportError: cannot import name 'MultiScaleDeformableAttention' from 'mmcv.cnn.bricks.transformer' (/home/OD03/anaconda3/ envs/mmdetection/lib/python3.9/site-packages/mmcv/cnn/bricks/transformer.py) .I had a similar problem while looking for information in the mmdet forums. mmdet developers alerted MultiScaleDeformableAttention in MMCV has been moved to mmcv.ops.multi_scale_deform_attn, please update your MMCV and let's update to mmcv full1.7.1 to bypass such issues, but the platform you are developing for has mmcv support up to version 1.5.0, and the mmcv I'm using is the 1.4.2 that you recommend in the readme (our cuda version is 10.2, and our torch version is 1.12.1), and the version of your MMCV that I'm using is the one you recommend in the readme. Obviously your test run works. So I don't think it would be a problem with the mmcv version, I hope to get your answer, thanks!
The specific error is reported as follows.
warnings.warn(
/home/OD03/anaconda3/envs/mmdetection/lib/python3.9/site-packages/mmcv/cnn/bricks/transformer.py:32: UserWarning: Fail to import MultiScaleDeformableAttention from mmcv.ops.multi_scale_deform_attn, You should install mmcv-full if you need this module.
warnings.warn('Fail to import MultiScaleDeformableAttention from '
/home/OD03/anaconda3/envs/mmdetection/lib/python3.9/site-packages/mmdet/models/utils/transformer.py:26: UserWarning: MultiScaleDeformableAttention in MMCV has been moved to mmcv.ops.multi_scale_deform_attn, please update your MMCV
warnings.warn(
Traceback (most recent call last):
File "/home/OD03/anaconda3/envs/mmdetection/lib/python3.9/site-packages/mmdet/models/utils/transformer.py", line 23, in
from mmcv.ops.multi_scale_deform_attn import MultiScaleDeformableAttention
File "/home/OD03/anaconda3/envs/mmdetection/lib/python3.9/site-packages/mmcv/ops/init.py", line 2, in
from .assign_score_withk import assign_score_withk
File "/home/OD03/anaconda3/envs/mmdetection/lib/python3.9/site-packages/mmcv/ops/assign_score_withk.py", line 5, in
ext_module = ext_loader.load_ext(
File "/home/OD03/anaconda3/envs/mmdetection/lib/python3.9/site-packages/mmcv/utils/ext_loader.py", line 13, in load_ext
ext = importlib.import_module('mmcv.' + name)
File "/home/OD03/anaconda3/envs/mmdetection/lib/python3.9/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: libtorch_cuda_cu.so: cannot open shared object file: No such file or directory
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/OD03/下载/ViT-Adapter-main/detection/./train.py", line 11, in
import mmdet_custom # noqa: F401,F403
File "/home/OD03/下载/ViT-Adapter-main/detection/mmdet_custom/init.py", line 2, in
from .models import # noqa: F401,F403
File "/home/OD03/下载/ViT-Adapter-main/detection/mmdet_custom/models/init.py", line 2, in
from .backbones import # noqa: F401,F403
File "/home/OD03/下载/ViT-Adapter-main/detection/mmdet_custom/models/backbones/init.py", line 2, in
from .beit_adapter import BEiTAdapter
File "/home/OD03/下载/ViT-Adapter-main/detection/mmdet_custom/models/backbones/beit_adapter.py", line 8, in
from mmdet.models.builder import BACKBONES
File "/home/OD03/anaconda3/envs/mmdetection/lib/python3.9/site-packages/mmdet/models/init.py", line 2, in
from .backbones import * # noqa: F401,F403
File "/home/OD03/anaconda3/envs/mmdetection/lib/python3.9/site-packages/mmdet/models/backbones/init.py", line 2, in
from .csp_darknet import CSPDarknet
File "/home/OD03/anaconda3/envs/mmdetection/lib/python3.9/site-packages/mmdet/models/backbones/csp_darknet.py", line 11, in
from ..utils import CSPLayer
File "/home/OD03/anaconda3/envs/mmdetection/lib/python3.9/site-packages/mmdet/models/utils/init.py", line 17, in
from .transformer import (DetrTransformerDecoder, DetrTransformerDecoderLayer,
File "/home/OD03/anaconda3/envs/mmdetection/lib/python3.9/site-packages/mmdet/models/utils/transformer.py", line 29, in
from mmcv.cnn.bricks.transformer import MultiScaleDeformableAttention
ImportError: cannot import name 'MultiScaleDeformableAttention' from 'mmcv.cnn.bricks.transformer' (/home/OD03/anaconda3/envs/mmdetection/lib/python3.9/site-packages/mmcv/cnn/bricks/transformer.py)
ERROR:torch.distributed.elastic.multiprocessing.api:failed (exitcode: 1) local_rank: 0 (pid: 16993) of binary: /home/OD03/anaconda3/envs/mmdetection/bin/python
Traceback (most recent call last):
File "/home/OD03/anaconda3/envs/mmdetection/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/home/OD03/anaconda3/envs/mmdetection/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/home/OD03/anaconda3/envs/mmdetection/lib/python3.9/site-packages/torch/distributed/launch.py", line 193, in
main()
File "/home/OD03/anaconda3/envs/mmdetection/lib/python3.9/site-packages/torch/distributed/launch.py", line 189, in main
launch(args)
File "/home/OD03/anaconda3/envs/mmdetection/lib/python3.9/site-packages/torch/distributed/launch.py", line 174, in launch
run(args)
File "/home/OD03/anaconda3/envs/mmdetection/lib/python3.9/site-packages/torch/distributed/run.py", line 752, in run
elastic_launch(
File "/home/OD03/anaconda3/envs/mmdetection/lib/python3.9/site-packages/torch/distributed/launcher/api.py", line 131, in call
return launch_agent(self._config, self._entrypoint, list(args))
File "/home/OD03/anaconda3/envs/mmdetection/lib/python3.9/site-packages/torch/distributed/launcher/api.py", line 245, in launch_agent
raise ChildFailedError(
torch.distributed.elastic.multiprocessing.errors.ChildFailedError:
The section we are using is the DETECTION section and I have executed the make.sh file in the ops folder. But we still get the following during training ImportError: cannot import name 'MultiScaleDeformableAttention' from 'mmcv.cnn.bricks.transformer' (/home/OD03/anaconda3/ envs/mmdetection/lib/python3.9/site-packages/mmcv/cnn/bricks/transformer.py) .I had a similar problem while looking for information in the mmdet forums. mmdet developers alerted
MultiScaleDeformableAttention
in MMCV has been moved tommcv.ops.multi_scale_deform_attn
, please update your MMCV and let's update to mmcv full1.7.1 to bypass such issues, but the platform you are developing for has mmcv support up to version 1.5.0, and the mmcv I'm using is the 1.4.2 that you recommend in the readme (our cuda version is 10.2, and our torch version is 1.12.1), and the version of your MMCV that I'm using is the one you recommend in the readme. Obviously your test run works. So I don't think it would be a problem with the mmcv version, I hope to get your answer, thanks!The specific error is reported as follows. warnings.warn( /home/OD03/anaconda3/envs/mmdetection/lib/python3.9/site-packages/mmcv/cnn/bricks/transformer.py:32: UserWarning: Fail to import
from mmcv.ops.multi_scale_deform_attn import MultiScaleDeformableAttention
File "/home/OD03/anaconda3/envs/mmdetection/lib/python3.9/site-packages/mmcv/ops/init.py", line 2, in
from .assign_score_withk import assign_score_withk
File "/home/OD03/anaconda3/envs/mmdetection/lib/python3.9/site-packages/mmcv/ops/assign_score_withk.py", line 5, in
ext_module = ext_loader.load_ext(
File "/home/OD03/anaconda3/envs/mmdetection/lib/python3.9/site-packages/mmcv/utils/ext_loader.py", line 13, in load_ext
ext = importlib.import_module('mmcv.' + name)
File "/home/OD03/anaconda3/envs/mmdetection/lib/python3.9/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: libtorch_cuda_cu.so: cannot open shared object file: No such file or directory
MultiScaleDeformableAttention
frommmcv.ops.multi_scale_deform_attn
, You should installmmcv-full
if you need this module. warnings.warn('Fail to importMultiScaleDeformableAttention
from ' /home/OD03/anaconda3/envs/mmdetection/lib/python3.9/site-packages/mmdet/models/utils/transformer.py:26: UserWarning:MultiScaleDeformableAttention
in MMCV has been moved tommcv.ops.multi_scale_deform_attn
, please update your MMCV warnings.warn( Traceback (most recent call last): File "/home/OD03/anaconda3/envs/mmdetection/lib/python3.9/site-packages/mmdet/models/utils/transformer.py", line 23, inDuring handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/home/OD03/下载/ViT-Adapter-main/detection/./train.py", line 11, in
import mmdet_custom # noqa: F401,F403
File "/home/OD03/下载/ViT-Adapter-main/detection/mmdet_custom/init.py", line 2, in
from .models import # noqa: F401,F403
File "/home/OD03/下载/ViT-Adapter-main/detection/mmdet_custom/models/init.py", line 2, in
from .backbones import # noqa: F401,F403
File "/home/OD03/下载/ViT-Adapter-main/detection/mmdet_custom/models/backbones/init.py", line 2, in
from .beit_adapter import BEiTAdapter
File "/home/OD03/下载/ViT-Adapter-main/detection/mmdet_custom/models/backbones/beit_adapter.py", line 8, in
from mmdet.models.builder import BACKBONES
File "/home/OD03/anaconda3/envs/mmdetection/lib/python3.9/site-packages/mmdet/models/init.py", line 2, in
from .backbones import * # noqa: F401,F403
File "/home/OD03/anaconda3/envs/mmdetection/lib/python3.9/site-packages/mmdet/models/backbones/init.py", line 2, in
from .csp_darknet import CSPDarknet
File "/home/OD03/anaconda3/envs/mmdetection/lib/python3.9/site-packages/mmdet/models/backbones/csp_darknet.py", line 11, in
from ..utils import CSPLayer
File "/home/OD03/anaconda3/envs/mmdetection/lib/python3.9/site-packages/mmdet/models/utils/init.py", line 17, in
from .transformer import (DetrTransformerDecoder, DetrTransformerDecoderLayer,
File "/home/OD03/anaconda3/envs/mmdetection/lib/python3.9/site-packages/mmdet/models/utils/transformer.py", line 29, in
from mmcv.cnn.bricks.transformer import MultiScaleDeformableAttention
ImportError: cannot import name 'MultiScaleDeformableAttention' from 'mmcv.cnn.bricks.transformer' (/home/OD03/anaconda3/envs/mmdetection/lib/python3.9/site-packages/mmcv/cnn/bricks/transformer.py)
ERROR:torch.distributed.elastic.multiprocessing.api:failed (exitcode: 1) local_rank: 0 (pid: 16993) of binary: /home/OD03/anaconda3/envs/mmdetection/bin/python
Traceback (most recent call last):
File "/home/OD03/anaconda3/envs/mmdetection/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/home/OD03/anaconda3/envs/mmdetection/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/home/OD03/anaconda3/envs/mmdetection/lib/python3.9/site-packages/torch/distributed/launch.py", line 193, in
main()
File "/home/OD03/anaconda3/envs/mmdetection/lib/python3.9/site-packages/torch/distributed/launch.py", line 189, in main
launch(args)
File "/home/OD03/anaconda3/envs/mmdetection/lib/python3.9/site-packages/torch/distributed/launch.py", line 174, in launch
run(args)
File "/home/OD03/anaconda3/envs/mmdetection/lib/python3.9/site-packages/torch/distributed/run.py", line 752, in run
elastic_launch(
File "/home/OD03/anaconda3/envs/mmdetection/lib/python3.9/site-packages/torch/distributed/launcher/api.py", line 131, in call
return launch_agent(self._config, self._entrypoint, list(args))
File "/home/OD03/anaconda3/envs/mmdetection/lib/python3.9/site-packages/torch/distributed/launcher/api.py", line 245, in launch_agent
raise ChildFailedError(
torch.distributed.elastic.multiprocessing.errors.ChildFailedError:
./train.py FAILED
Failures: