distributed_strategy ¶
Distributed model strategies for the modular trainer.
Classes¶
fastvideo.train.utils.distributed_strategy.DelegatingDistributedDataParallel ¶
Bases: DistributedDataParallel
DDP wrapper that preserves a model plugin's public attributes.
FastVideo model plugins access architecture attributes and helper methods such as latent_seq_len and normalize through transformer. Native PyTorch DDP exposes these on module only; this adapter delegates unknown attributes while retaining the standard DDP forward/reducer.
Functions:¶
fastvideo.train.utils.distributed_strategy.build_replicated_model_from_scratch ¶
build_replicated_model_from_scratch(model_cls: type[_ModelT], init_params: dict[str, Any], *, device: device, default_dtype: dtype, seed: int) -> _ModelT
Initialize one deterministic, full model replica on the local device.
Model plugins call :func:wrap_module_ddp only after applying their trainable/frozen parameter policy. This is required because DDP builds its gradient reducer from the parameters that require gradients at wrap time.
Source code in fastvideo/train/utils/distributed_strategy.py
fastvideo.train.utils.distributed_strategy.normalize_distributed_strategy ¶
Normalize and validate a modular-training strategy name.
Source code in fastvideo/train/utils/distributed_strategy.py
fastvideo.train.utils.distributed_strategy.unwrap_ddp_module ¶
Return the underlying module for DDP, otherwise return the input.
fastvideo.train.utils.distributed_strategy.wrap_module_ddp ¶
wrap_module_ddp(module: _ModelT, *, device: device, broadcast_buffers: bool = False) -> DelegatingDistributedDataParallel
Wrap a full model replica like official MMAudio's DDP runner.