mmcv icon indicating copy to clipboard operation
mmcv copied to clipboard

[Bug] ImportError: cannot import name 'MMDataParallel' from 'mmcv.parallel'

Open zzlyon opened this issue 9 months ago • 3 comments

Prerequisite

  • [x] I have searched Issues and Discussions but cannot get the expected help.
  • [x] The bug has not been fixed in the latest version(https://github.com/open-mmlab/mmcv).

Environment

Reproduces the problem - code sample

Reproduces the problem - command or script

Reproduces the problem - error message

Additional information

I'm supposed to:'from mmcv.parallel import MMDataParallel, MMDistributedDataParallel', it certainly runs error because I know that you have updated mmcv and many are transfered to mmengine, so I searched them in mmengine. I can find 'MMDistributedDataParallel' from the latest version in mmengine.model, however, 'MMDataParallel' can't be found anywhere, is it deleted or repalced by other name? Additionally, others like 'wrap_fp16_model' in mmcv or 'build_detector' in mmdet3d has exactly the same question.

zzlyon avatar Mar 19 '25 01:03 zzlyon

I'm having the same issue. For anyone else also struggling to update their repo to support mmcv 2.0, this document might be helpful: https://mmcv.readthedocs.io/en/latest/get_started/api_reference.html Like OP, I was able to locate MMDistributedDataParallel in mmengine.model.wrappers.distributed.MMDistributedDataParallel according to the document above. However, it doesn't specify where to find MMDataParallel in the newer versions of mmcv. Hope this gets resolved soon 🙏

Kevinpyx avatar Jun 09 '25 22:06 Kevinpyx

Running into a similar issue where I cannot find MMDataParallel, hopefully this can be resolved soon

ltao-s25 avatar Jun 17 '25 00:06 ltao-s25

You can use from mmengine.model import MMDistributedDataParallel but cannot find MMDataParallel

yogi1510 avatar Aug 20 '25 11:08 yogi1510