Utilities for DeepSpeed
class accelerate.DeepSpeedPlugin
< source >( hf_ds_config: Any = None gradient_accumulation_steps: int = None gradient_clipping: float = None zero_stage: int = None is_train_batch_min: str = True offload_optimizer_device: bool = None offload_param_device: bool = None offload_optimizer_nvme_path: str = None offload_param_nvme_path: str = None zero3_init_flag: bool = None zero3_save_16bit_model: bool = None )
This plugin is used to integrate DeepSpeed.
deepspeed_config_process
< source >( prefix = '' mismatches = None config = None must_match = True **kwargs )
Process the DeepSpeed config with the values from the kwargs.
class accelerate.utils.DummyOptim
< source >( params lr = 0.001 weight_decay = 0 **kwargs )
Dummy optimizer presents model parameters or param groups, this is primarily used to follow conventional training loop when optimizer config is specified in the deepspeed config file.
class accelerate.utils.DummyScheduler
< source >( optimizer total_num_steps = None warmup_num_steps = 0 lr_scheduler_callable = None **kwargs )
Parameters
- optimizer (
torch.optim.optimizer.Optimizer
) — The optimizer to wrap. - total_num_steps (int, optional) — Total number of steps.
- warmup_num_steps (int, optional) — Number of steps for warmup.
- lr_scheduler_callable (callable, optional) —
A callable function that creates an LR Scheduler. It accepts only one argument
optimizer
. **kwargs — Other arguments.
Dummy scheduler presents model parameters or param groups, this is primarily used to follow conventional training loop when scheduler config is specified in the deepspeed config file.
class accelerate.utils.DeepSpeedEngineWrapper
< source >( engine )
Internal wrapper for deepspeed.runtime.engine.DeepSpeedEngine. This is used to follow conventional training loop.
class accelerate.utils.DeepSpeedOptimizerWrapper
< source >( optimizer )
Internal wrapper around a deepspeed optimizer.
class accelerate.utils.DeepSpeedSchedulerWrapper
< source >( scheduler optimizers )
Internal wrapper around a deepspeed scheduler.