Tensorflow checkpoint models getting deleted

99封情书 提交于 2019-12-22 09:38:30

问题


I am using tensorflow checkpointing after every 10 epochs using the following code :

checkpoint_dir = os.path.abspath(os.path.join(out_dir, "checkpoints"))
checkpoint_prefix = os.path.join(checkpoint_dir, "model")
...
if current_step % checkpoint_every == 0:
    path = saver.save(sess, checkpoint_prefix, global_step=current_step)
    print("Saved model checkpoint to {}\n".format(path))

The problem is that, as the new files are getting generated, previous 5 model files are getting deleted automatically.


回答1:


This is the expected behavior, the docs for tf.train.Saver say that by default the 5 most recent checkpoint files are kept. To adjust that, set max_to_keep the the desired value.



来源:https://stackoverflow.com/questions/41018454/tensorflow-checkpoint-models-getting-deleted

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!