Metric Tracker#

class MetricTracker(metrics_to_track=None)[source]#

Bases: Callback

Lightning Callback for Metric Tracking.

Tracks specified metrics during training.

Parameters:

metrics_to_track (list[str], optional) – List of metrics to track. Defaults to train loss.

setup(trainer, pl_module, stage)[source]#

Called when fit, validate, test, predict, or tune begins.

Parameters:
on_train_epoch_end(trainer, pl_module)[source]#

Collect and track metrics at the end of each training epoch.

Parameters:
  • trainer (pytorch_lightning.Trainer) – The trainer object managing the training process.

  • pl_module – The model being trained (not used here).

property metrics#

Aggregate collected metrics over all epochs.

Returns:

A dictionary containing aggregated metric values.

Return type:

dict