Saving checkpoint by val loss AND last checkpoint

I’d like to save a checkpoint for my best model but also keep the latest epoch’s checkpoint for later resuming. Is the right way to do this like so:

>>> checkpoint_callback = ModelCheckpoint(save_last=True)
>>> trainer = Trainer(checkpoint_callback=checkpoint_callback)

The documentation for save_last isn’t clear whether this will overwrite the checkpoint that achieves the best validation loss or not.

by default save_top_k=1, so enabling save_last=True along with that will both save the best model and the model from the last epoch.

1 Like

Super, thank you for the quick and straight-to-the-point explanation.