我正在使用一个自定义的tf. Estimator
对象来训练神经网络。问题出在训练后事件文件的大小上--它太大了。我已经通过使用tf.Dataset.from_generator()
解决了将数据集的一部分保存为常量的问题。但是,大小仍然很大,在启动tensorboard
时,我收到了这样的消息
W0225 10:38:07.443567 140693578311424 tf_logging.py:120] Found more than one metagraph event per run. Overwriting the metagraph with the newest event.
所以,我想,我在这个事件文件中创建并保存了许多不同的图形。是否可以关闭此保存,或者如何仅保存第一个副本?
要知道,我找到了删除所有默认日志的唯一方法,那就是用
list(map(os.remove, glob.glob(os.path.join(runtime_params['model_dir'], 'events.out.tfevents*'))))
然而,这对我来说是一个糟糕的解决方案,因为我更喜欢保留摘要,理想情况下,是图形的one副本。
从文档中,我可以看到
Estimators 自动将以下内容写入磁盘:
文件检查点,是在training.
的方法吗
发布于 2021-07-07 03:48:23
您需要使用TensorBoard工具来可视化摘要日志的内容。
可以读取和使用事件文件日志。您可以看到此link中的示例提供了有关如何读取写入事件文件的事件的信息。
# This example supposes that the events file contains summaries with a
# summary value tag 'loss'. These could have been added by calling
# `add_summary()`, passing the output of a scalar summary op created with
# with: `tf.compat.v1.summary.scalar('loss', loss_tensor)`.
for e in tf.compat.v1.train.summary_iterator(path to events file):
for v in e.summary.value:
if v.tag == 'loss':
print(v.simple_value)
https://stackoverflow.com/questions/54863255
复制相似问题