Issue
Some Keras callbacks, like ModelCheckpoint
or ReduceLROnPlateau
, rely on counting the number of epochs that some condition is met until some action is taken.
For certain purposes I need to train a Keras model in several fitting sessions, so something like
for epoch in range(num_epochs):
model.fit(data, epochs=1)
rather than
model.fit(data, epochs=num_epochs)
I was wondering if Keras callbacks work even if I use them across several fitting sessions.
Solution
Each time model.fit(...)
is called callbacks.History
is reset. So no, it will not work like that. While you could log yourself as @kacpo1 mentioned and save each, you may benefit from the train_on_batch(...)
method. This performs a single update and you can set reset_metrics=False
in the method call to retain your metrics.
https://keras.io/api/models/model_training_apis/#trainonbatch-method
Answered By - Aidan Costello
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.