mmcv: ModuleNotFoundError: No module named 'mmcv.parallel'
您好, 我的程序中涉及:
from mmcv.parallel import MMDataParallel, MMDistributedDataParallel
但出现以下错误:
ModuleNotFoundError: No module named 'mmcv.parallel'
我的版本为:
mmcv 2.0.0rc4
mmengine 0.7.2
mmsegmentation 1.0.0
torch 1.12.1+cu113
torchaudio 0.12.1+cu113
torchvision 0.13.1+cu113
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 17 (3 by maintainers)
同问, 那在v2.0.0中怎么使用parallel包中的相关内容呢?例如, MMDataParallel, MMDistributedDataParallel
from mmcv.parallel import MMDataParallel, MMDistributedDataParallel in older versions from mmengine.model import MMDataParallel, MMDistributedDataParallel in new versions
Hi, the
MMDistributedDataParallelin MMCV has been migrated to MMEngine (https://github.com/open-mmlab/mmengine/blob/426a565908e47f791938baa3a876a87de306b436/mmengine/model/wrappers/distributed.py#L16).If the distributed environment is initialized (see https://mmengine.readthedocs.io/en/latest/common_usage/speed_up_training.html#distributed-training for details about how to launch distributed training), the
MMDistributedDataParallelwill be automatically wrapped for the model.The logic to wrapper the model is in https://github.com/open-mmlab/mmengine/blob/426a565908e47f791938baa3a876a87de306b436/mmengine/runner/runner.py#L408.
Of course, we can pass the
model_wrapper_cfgto thecfgofRunnerin MMEngine to use theMMDistributedDataParallel.In addition, we also provide several documentation to help migration. https://mmengine.readthedocs.io/en/latest/migration/runner.html
Hi, the parallel has been removed from MMCV since v2.0.0. More details can be found at https://github.com/open-mmlab/mmcv/blob/main/docs/en/compatibility.md#v200.
你好,我暂时“解决”了(因为我还是没找到最新版的mmcv的parallel变为什么了,我降低了版本);我现在的版本为:
我的安装命令为:
引起上述问题的原因见:https://mmcv.readthedocs.io/en/latest/compatibility.html
同样的问题,请问您解决了吗