如何更改最大检查点

时间:2018-10-18 11:03:03

标签: tensorflow

我使用此代码练习如何保存模型权重。但是,我遇到了问题。它仅保存5个检查点。我想将最大检查点数更改为10。

checkpoint_path = "training_2/cp-{epoch:04d}.ckpt"
checkpoint_dir = os.path.dirname(checkpoint_path)

cp_callback = tf.keras.callbacks.ModelCheckpoint(checkpoint_path,
                                                 save_weights_only=True,
                                                 period=5,
                                                 verbose=1)

model = create_model()
model.fit(train_images, 
          train_labels,
          epochs=50,
          validation_data=(test_images, test_labels),
          callbacks=[cp_callback],
          verbose=1)

0 个答案:

没有答案