Tensorflow 检查点模型被删除 [英] Tensorflow checkpoint models getting deleted

查看:51
本文介绍了Tensorflow 检查点模型被删除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在每 10 个时期后使用以下代码使用 tensorflow 检查点:

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))

问题是,随着新文件的生成,之前的 5 个模型文件会被自动删除.

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

推荐答案

这是预期的行为,tf.train.Saver 说默认情况下会保留 5 个最近的检查点文件.要调整它,请将 max_to_keep 设置为所需的值.

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.

这篇关于Tensorflow 检查点模型被删除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆