美文网首页
多卡训练推理时报错AttributeError: 'MMDist

多卡训练推理时报错AttributeError: 'MMDist

作者: JIAWEIJIAWEI | 来源:发表于2025-11-04 16:20 被阅读0次

AttributeError: 'MMDistributedDataParallel' object has no attribute '_use_replicated_tensor_module'

在较新的 PyTorch 版本(特别是 1.12+ / 2.x)中,DistributedDataParallel 的内部实现发生了变化,
旧版本 MMCV 的 MMDistributedDataParallel 会去访问一个已经不存在的成员:
快速临时修复(不改环境)

修改下面文件
/root/miniconda3/envs/xxx/lib/python3.10/site-packages/mmcv/parallel/distributed.py
找到这一段(大约 150 行):

self._use_replicated_tensor_module

替换为:

getattr(self, '_use_replicated_tensor_module', False)

或者直接注释引用处,让其默认 False。

相关文章

网友评论

      本文标题:多卡训练推理时报错AttributeError: 'MMDist

      本文链接:https://www.haomeiwen.com/subject/blptfstx.html