xnn.common.train.callbacks.ModelCheckpoint#
- class xnn.common.train.callbacks.ModelCheckpoint(monitor=None, mode=None, dirpath=None, filename='best.pt', save_last=True, every_n_epochs=0)[source]#
Bases:
CallbackSaves the best model by a monitored value, the last model, and optional periodic snapshots.
- Parameters:
monitor (str or None, optional) – The value to monitor; defaults to the trainer’s (
trainer.monitor).mode (str or None, optional) –
"min"or"max"; defaults to the trainer’s.dirpath (str or None, optional) – Directory of the checkpoints; defaults to
cfg.output_dir.filename (str, optional) – Name of the best checkpoint. Defaults to
"best.pt".save_last (bool, optional) – Also write
last.ptafter the last epoch. Defaults toTrue.every_n_epochs (int, optional) – When
> 0, also writeepoch_<n>.ptevery n epochs. Defaults to0.
- Variables: