How to average model over epochs


I trained a model with a tensorflow.keras.Model object. I want to average the model parameters over the last ~10 epochs and then use the average model to predict on my test set.

Is there a simple way to do this?


Thanks! This is exactly what I’m looking for.

Is there a way to average over just the last N epochs instead of all of the epochs?

If I train the model normally and then call again with an AverageModelCheckpoint, then will it average over all epochs or just the ones from the second call to