metrics_logger

Terminal metrics logging callback.

Functions

metric_mode(key)

"min" or "max" for a metric name — also read by the checkpoint monitor and tools/leaderboard.py, so the direction is defined once.

Classes

BestMetricsPrinter([keys])

Prints metrics to the terminal each epoch and summarises the best at the end.

class BestMetricsPrinter(keys=('train/loss', 'train/mae', 'train/acc1', 'train/mae_argmax', 'train/mae_expected', 'train/acc1_argmax', 'train/acc1_expected', 'val/loss', 'val/mae', 'val/acc1', 'val/mae_argmax', 'val/mae_expected', 'val/acc1_argmax', 'val/acc1_expected'))[source]

Bases: Callback

Prints metrics to the terminal each epoch and summarises the best at the end.

Parameters:

keys (tuple) – Metric keys to track. Defaults to the tempo-estimation metric names; pass a different tuple (e.g. beat-phase’s train/val × loss/acc keys) for other training tasks.

on_fit_end(trainer, pl_module)[source]
on_train_epoch_end(trainer, pl_module)[source]
on_validation_epoch_end(trainer, pl_module)[source]
metric_mode(key)[source]

"min" or "max" for a metric name — also read by the checkpoint monitor and tools/leaderboard.py, so the direction is defined once.

Substring match, so it works on the flattened form the checkpoint filenames carry (valloss) as well as on val/loss.

Parameters:

key (str)

Return type:

str