Shortcuts

分布式训练的迁移

我们已经将MMGeneration 1.x合并至MMagic。以下是针对MMGeneration中分布式训练的迁移事项。

在0.x版中,MMGeneration使用DDPWrapperDynamicRunner来训练对应的静态和动态模型(例如PGGAN和StyleGANv2),但在1.x 版中,我们使用MMEngine提供的MMSeparateDistributedDataParallel来实现分布式训练。

如下是配置前后对比:

0.x版中的静态模型 1.x版中的静态模型
# 使用DDPWrapper
use_ddp_wrapper = True
find_unused_parameters = False

runner = dict(
    type='DynamicIterBasedRunner',
    is_dynamic_ddp=False)
model_wrapper_cfg = dict(
    type='MMSeparateDistributedDataParallel',
    broadcast_buffers=False,
    find_unused_parameters=False)
0.x版中的动态模型 1.x版中的动态模型
use_ddp_wrapper = False
find_unused_parameters = False

# 使用DynamicRunner
runner = dict(
    type='DynamicIterBasedRunner',
    is_dynamic_ddp=True)
model_wrapper_cfg = dict(
    type='MMSeparateDistributedDataParallel',
    broadcast_buffers=False,
    find_unused_parameters=True) # 针对动态模型,设置`find_unused_parameters`标志为True
Read the Docs v: latest
Versions
latest
stable
0.x
Downloads
pdf
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.