我注意到新的 Estimator API 会在训练期间自动保存检查点,并在训练中断时自动从最后一个检查点重新开始。不幸的是,它似乎只保留了最后 5 个检查点。
您知道如何控制训练期间保留的检查点数量吗?
最佳答案
Tensorflow tf.estimator.Estimator需要 config
作为可选参数,可以是 tf.estimator.RunConfig对象来配置运行时设置。您可以按如下方式实现:
# Change maximum number checkpoints to 25
run_config = tf.estimator.RunConfig()
run_config = run_config.replace(keep_checkpoint_max=25)
# Build your estimator
estimator = tf.estimator.Estimator(model_fn,
model_dir=job_dir,
config=run_config,
params=None)
config
参数可用于扩展 DNNClassifier
的所有类( DNNLinearCombinedClassifier
、 LinearClassifier
、 estimator.Estimator
等) .
关于tensorflow - 如何控制 tensorflow 估计器保留的检查点数量?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48028262/