DeepSpeedOptimWrapper¶
- class mmengine._strategy.deepspeed.DeepSpeedOptimWrapper(optimizer)[source]¶
- backward(loss, **kwargs)[source]¶
“Perform gradient back propagation.
- Parameters
loss (torch.Tensor) –
- Return type
None
- load_state_dict(state_dict)[source]¶
A wrapper of
Optimizer.load_state_dict
. load the state dict ofoptimizer
.Provide unified
load_state_dict
interface compatible with automatic mixed precision training. Subclass can overload this method to implement the required logic. For example, the state dictionary of GradScaler should be loaded when training withtorch.cuda.amp
.- Parameters
state_dict (dict) – The state dictionary of
optimizer
.- Return type
None