rai_toolbox.mushin.MetricsCallback#
- class rai_toolbox.mushin.MetricsCallback(save_dir='.', filename='metrics.pt')[source]#
Saves validation and test metrics stored in
trainer.callback_metrics
.- Parameters:
- save_dirstr, optional (default=”.”)
- filenamestr, optional (default=”metrics.pt”)
The base filename used to store metrics. For
FITTING
the file is prepended with “fit_” and forTESTING
the file is prepended withtest_
.
Notes
No metrics will be saved during
FITTING
if no validation metrics are calculated. This is a limitation of PyTorch Lightning. Future versions will save the training step metrics when no validation metrics are calculated.Examples
>>> from pytorch_lightning import Trainer >>> from rai_toolbox.mushin import MetricsCallback
>>> metrics_callback = MetricsCallback() >>> trainer = Trainer(callbacks=[metrics_callback])
Methods
__init__
([save_dir, filename])