DDPStrategy¶
- class mmengine._strategy.DDPStrategy(*, model_wrapper=None, sync_bn=None, **kwargs)[源代码]¶
Distribution strategy for distributed data parallel training.
- 参数:
model_wrapper (dict) – Dict for model wrapper. Defaults to None.
sync_bn (str) – Type of sync batch norm. Defaults to None. Options are ‘torch’ and ‘mmcv’.
**kwargs – Other arguments for
BaseStrategy
.
- convert_model(model)[源代码]¶
convert all
BatchNorm
layers in the model toSyncBatchNorm
(SyncBN) ormmcv.ops.sync_bn.SyncBatchNorm
(MMSyncBN) layers.- 参数:
model (nn.Module) – Model to be converted.
- 返回:
Converted model.
- 返回类型:
nn.Module
- save_checkpoint(filename, *, save_optimizer=True, save_param_scheduler=True, extra_ckpt=None, callback=None)[源代码]¶
Save checkpoint to given
filename
.- 参数:
- 关键字参数:
save_optimizer (bool) – Whether to save the optimizer to the checkpoint. Defaults to True.
save_param_scheduler (bool) – Whether to save the param_scheduler to the checkpoint. Defaults to True.
extra_ckpt (dict, optional) – Extra checkpoint to save. Defaults to None.
callback (callable, callable) – Callback function to modify the checkpoint before saving the checkpoint. Defaults to None.
- 返回类型:
None