Saving the best models during fit()

I am new to Fast.AI, and I LOVE the course and the fastai library.

Since I did not find them here, I created two small classes to save the model with the best validation loss or metrics or the best overall loss during one or more runs of fit() to disk. They are in my github repo at

Usage is described in each file.
May be they re helpful.

Kind regards,

Hi Ernst,

Thanks for the thoughtful addition! However, I think it’s been already committed in a recent merge.

The original post is here, just 2 days before yours!

PS: This is the forum for the old keras course. You’re looking for this --> #part1-v2