Different behavior for model checkpoints if last or best

Hello,

I am trying to monitor a specific metric in my training and save the best model. I also want to save the last model just in case the training failed and I want to resume later. I want a specific behavior when saving checkpoints, for example, logging certain artifacts or metrics. However, I noticed that on_save_checkpoint is called with the save_last option on each epoch, which will save the artifacts on each epoch instead of only the best.

Is there a way to detect if on_save_checkpoint was called for best or last?

Thank you in advance!

Nicolas