Reputation: 3680
I usually load my Keras models using the load_model() method. Is it possible to obtain the number of epochs a model was trained for after loading it again?
This GitHub issue mentions the following hack:
r = model.fit(X_train,y_train,epochs=5)
n_epochs = len(r.history['loss'])
However, that's not exactly what I want as I would like to obtain the number of epochs from the loaded models.
Upvotes: 1
Views: 2877
Reputation: 572
You cannot obtain the history after loading a model as the saved model keeps only the architecture and the weights. So you can't have the number of epochs of a loaded model. See also this SO question.
Upvotes: 3