MultiTrainingCallback
- class MultiTrainingCallback(callbacks: str | TrainingCallback | type[TrainingCallback] | None | Sequence[str | TrainingCallback | type[TrainingCallback] | None] = None, callbacks_kwargs: Mapping[str, Any] | None | Sequence[Mapping[str, Any] | None] = None)[source]
Bases:
TrainingCallback
A wrapper for calling multiple training callbacks together.
Initialize the callback.
Note
the constructor allows “broadcasting” of callbacks, i.e., proving a single callback, but a list of callback kwargs. In this case, for each element of this list the given callback is instantiated.
- Parameters:
callbacks (list[TrainingCallback]) – the callbacks
callbacks_kwargs (TrainingCallbackKwargsHint) – additional keyword-based parameters for instantiating the callbacks
Methods Summary
on_batch
(epoch, batch, batch_loss, **kwargs)Call for training batches.
post_batch
(epoch, batch, **kwargs)Call for training batches.
post_epoch
(epoch, epoch_loss, **kwargs)Call after epoch.
post_train
(losses, **kwargs)Call after training.
pre_batch
(**kwargs)Call before training batch.
pre_step
(**kwargs)Call before the optimizer's step.
register_callback
(callback)Register a callback.
register_training_loop
(training_loop)Register the training loop.
Methods Documentation
- on_batch(epoch: int, batch, batch_loss: float, **kwargs: Any) None [source]
Call for training batches.
- pre_batch(**kwargs: Any) None [source]
Call before training batch.
- Parameters:
kwargs (Any)
- Return type:
None
- pre_step(**kwargs: Any) None [source]
Call before the optimizer’s step.
- Parameters:
kwargs (Any)
- Return type:
None
- register_callback(callback: TrainingCallback) None [source]
Register a callback.
- Parameters:
callback (TrainingCallback)
- Return type:
None
- register_training_loop(training_loop: TrainingLoop) None [source]
Register the training loop.
- Parameters:
training_loop (TrainingLoop)
- Return type:
None