Optimizer callbacks#
- class SwitchOptimizer(new_optimizers, epoch_switch)[source]#
Bases:
Callback
PINA Implementation of a Lightning Callback to switch optimizer during training.
This callback allows switching between different optimizers during training, enabling the exploration of multiple optimization strategies without interrupting the training process.
- Parameters:
new_optimizers (pina.optim.TorchOptimizer | list) – The model optimizers to switch to. Can be a single
torch.optim.Optimizer
instance or a list of them for multiple model solver.epoch_switch (int) – The epoch at which the optimizer switch occurs.
Example
>>> switch_callback = SwitchOptimizer(new_optimizers=optimizer, >>> epoch_switch=10)