What parameters can be used in filepath for ModelCheckpoints (tf.Keras)?

Viewed 117

I'm trying to train a Keras model and save model weighta at every epoch and patch. I define a checkpoint as follows:

checkpoint_path='model_checkpoints_5000/checkpoints_{epoch:02d}_{batch:04d}'
checkpoint = ModelCheckpoint(filepath = checkpoint_5000_path,frequency = 5000)

and train the model:

model.fit(x=x_train, y=y_train, epochs=3, validation_data=(x_test, y_test),
               batch_size=10, callbacks=[checkpoint])

But right after the forst iteration the error occurs:

KeyError: 'Failed to format this callback filepath: "model_checkpoints_5000/checkpoints_{epoch:02d}_{batch:04d}". Reason: \'batch\'

How can I have python add the batch number to the file name? How to fide the list of other parameters that are available for output?

My setup: Windows 10, jupyter notebook in chrome, Python 3.5.4, Tensorflow 2.3.0, Keras is imported from Tensorflow.

0 Answers
Related