mapping_networks.callbacks.Callback¶
- class mapping_networks.callbacks.Callback¶
Base class for training lifecycle callbacks.
All hooks are no-ops by default — subclass and override the ones you need. Callbacks receive the trainer instance so they can inspect or modify state (e.g. set
trainer.should_stop = Truefor early termination).Hook execution order within each event:
on_fit_startFor each epoch: a.
on_epoch_startb. For each batch:on_batch_start→on_batch_endc.on_validation_start→on_validation_endd.on_epoch_endon_fit_end
- __init__()¶
Methods
__init__()on_batch_end(trainer, batch_idx, loss_output)Called after processing each batch with the loss output.
on_batch_start(trainer, batch_idx)Called before processing each batch.
on_epoch_end(trainer, epoch, metrics)Called at the end of each epoch with aggregated metrics.
on_epoch_start(trainer, epoch)Called at the beginning of each epoch.
on_fit_end(trainer)Called once at the end of
fit().on_fit_start(trainer)Called once at the beginning of
fit().on_validation_end(trainer, metrics)Called after the validation loop with validation metrics.
on_validation_start(trainer)Called before the validation loop.