base
- class OnStepCallbackWithTiming(train_timing: CallbackTiming = None, val_timing: CallbackTiming = None, name: str = 'auto')[source]
Base class for timed callbacks, which execute at certain intervals.
They execute on step, during training and validation, at independently specified timings.
- __init__(train_timing: CallbackTiming = None, val_timing: CallbackTiming = None, name: str = 'auto') None[source]
Initializes the callback. The name is used for logging.
- Parameters:
train_timing – The
CallbackTimingobject specifying how often the callback is to be called during training.val_timing – The
CallbackTimingobject specifying how often the callback is to be called during validation.name – The name of the callback. If
"auto", the class name is used, minus “Log” if the class name starts with that.
- execute(trainer: Trainer, pl_module: MLDFTLitModule, outputs: Tensor | Mapping[str, Any] | None, batch: Any, split: str) None[source]
Executes the callback, e.g. logs a figure to tensorboard.
- Parameters:
pl_module – The lightning module.
trainer – The lightning trainer.
outputs – The outputs of the lightning module.
batch – The batch data.
split – The split, either
"train"or"val".
- on_train_batch_end(trainer: Trainer, pl_module: MLDFTLitModule, outputs: Tensor | Mapping[str, Any] | None, batch: Any, batch_idx: int) None[source]
Executes the callback via
execute(), if the timing matches.
- on_validation_batch_end(trainer: Trainer, pl_module: MLDFTLitModule, outputs: Tensor | Mapping[str, Any] | None, batch: Any, batch_idx: int, **kwargs) None[source]
Executes the callback via
execute(), if the timing matches.Can happen only for the first validation batch.