# This script should train for one step and store the events file in model_dir:
model_dir = '/tmp/test'
shutil.rmtree(model_dir, ignore_errors=True)
estimator = tf.estimator.Estimator(
model_fn,
params=params,
model_dir=model_dir)
estimator.train(input_fn=make_input_fn(None), steps=1)
现在如果我运行ls /tmp/test
我会看到:
但是,如果我用同一个内核再次运行同一个脚本(例如,在我的jupyter笔记本的同一个实例中),我会看到:
[quant@home tmp]$ ls test/
checkpoint graph.pbtxt model.ckpt-1.data-00000-of-00001 model.ckpt-1.index model.ckpt-1.meta
如果我更改了我的目录名(例如改为/tmp/test2
),事件文件将再次打印,但只是第一次。在
很明显,在某个地方有某种状态被捕获,但是在哪里,如何完全重置我的估计器?在
我也注意到了一些类似的行为。但我还是不能用Python来清理这些东西。在
正如我所观察到的,在事件文件创建之后,只要我不删除它,这个文件仍然会不断更新。删除后,不会创建新的事件文件。在
到目前为止,我有三个解决方案: 1重新启动Jupyter会话,这有点不方便。 2继续使用不同的目录。 三。保留事件文件(这取决于您的情况)
相关问题 更多 >
编程相关推荐