py123d_detection.torch.callbacks¶
Callbacks the training loop adds beyond Lightning’s own.
SaveEpochCheckpoints exists because the stock ModelCheckpoint keeps the best three
by val_loss and overwrites last.ckpt every epoch. That is the right default for getting a
trained model out of a run, and useless for asking what the model looked like halfway through: by
the time a 24-epoch run finishes, epoch 12 is gone. Scoring an intermediate epoch is how you tell
a model that is still improving from one that peaked early and has been drifting since.
Classes
|
Write a checkpoint of its own at the end of each named epoch. |
- class py123d_detection.torch.callbacks.SaveEpochCheckpoints(dirpath, save_epochs)[source]¶
Bases:
CallbackWrite a checkpoint of its own at the end of each named epoch.
save_epochs=[6, 12, 18]leavesepoch_6.ckpt,epoch_12.ckptandepoch_18.ckptindirpath, next to whateverModelCheckpointis doing. Nothing overwrites them.Epochs are counted the way a training log reads them, from 1, so 12 means after twelve epochs of training. Lightning’s own
current_epochis 0-indexed during the epoch, which is where the off-by-one lives; it is converted here so that a config file never has to think about it.- Parameters: