繁体   English   中英

tensorflow事件文件仅由估计器首次写入

[英]tensorflow events file only written the first time by estimator

# 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我会看到:

[quant@home tmp]$ ls test/
checkpoint  events.out.tfevents.1529978068.376da96eeba4  graph.pbtxt  model.ckpt-1.data-00000-of-00001  model.ckpt-1.index  model.ckpt-1.meta

但是,如果我再次使用相同的内核(即在我的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 ),则将再次打印事件文件,但这仅是第一次。

显然,某处捕获了一些状态,但是在哪里以及如何完全重置估算器?

我还在Jupyter Notebook中注意到了一些类似的行为。 我正在使用Python类包装所有这些内容,但这仍然不能使其保持“干净”。

据我观察,事件文件创建后,只要不删除它,该文件仍会不断更新。 删除后,将不会创建新的事件文件。

到目前为止,我有三种解决方案:1.重新启动Jupyter会话,这有点不方便。 2.继续使用不同的目录。 3.保留事件文件(取决于您的情况)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM