在分布式tensorflow中,如何写工人的总结
In distributed tensorflow, how to write to summary from workers as well
我正在使用 google cloud ml 分布式样本在计算机集群上训练模型。输入和输出(即 rfrecords、检查点、tfevents)都在 gs://(google 存储)
与分布式样本类似,我使用了一个在最后调用的评估步骤,并将结果写为摘要,以便使用参数超调/在 Cloud ML 中,或使用我自己的堆栈工具。
但我不是对大量数据执行单一评估,而是 运行宁多个评估步骤,以检索有关性能标准的统计信息,因为我不想局限于一个单一的价值。我想获得有关性能间隔的信息。特别是,性能的差异对我来说很重要。我宁愿 select 一个平均性能较低但最坏情况更好的模型。
我因此运行几个评估步骤。我想做的是将这些评估步骤并行化,因为现在只有大师在评估。使用大型集群时,它是效率低下的根源,也是需要评估任务的工作人员。
基本上,主管创建为:
self.sv = tf.train.Supervisor(
graph,
is_chief=self.is_master,
logdir=train_dir(self.args.output_path),
init_op=init_op,
saver=self.saver,
# Write summary_ops by hand.
summary_op=None,
global_step=self.tensors.global_step,
# No saving; we do it manually in order to easily evaluate immediately
# afterwards.
save_model_secs=0)
培训结束时,我打电话给总结作者。 :
# only on master, this is what I want to remove
if self.is_master and not self.should_stop:
# I want to have an idea of statistics of accuracy
# not just the mean, hence I run on 10 batches
for i in range(10):
self.global_step += 1
# I call an evaluator, and extract the accuracy
evaluation_values = self.evaluator.evaluate()
accuracy_value = self.model.accuracy_value(evaluation_values)
# now I dump the accuracy, ready to use within hptune
eval_summary = tf.Summary(value=[
tf.Summary.Value(
tag='training/hptuning/metric', simple_value=accuracy_value)
])
self.sv.summary_computed(session, eval_summary, self.global_step)
我也试过写工人的总结,但是我得到了一个错误:基本上只能从大师那里写总结。有什么简单的方法可以解决吗?错误是:"Writing a summary requires a summary writer."
我猜你会为每个工人自己创建一个单独的摘要编写器,而不是直接写出摘要。
我怀疑您也不会使用主管来进行评估处理。只需在每个工作人员上加载一个会话,以使用最新的检查点进行评估,并写出独立的摘要。
我正在使用 google cloud ml 分布式样本在计算机集群上训练模型。输入和输出(即 rfrecords、检查点、tfevents)都在 gs://(google 存储)
与分布式样本类似,我使用了一个在最后调用的评估步骤,并将结果写为摘要,以便使用参数超调/在 Cloud ML 中,或使用我自己的堆栈工具。
但我不是对大量数据执行单一评估,而是 运行宁多个评估步骤,以检索有关性能标准的统计信息,因为我不想局限于一个单一的价值。我想获得有关性能间隔的信息。特别是,性能的差异对我来说很重要。我宁愿 select 一个平均性能较低但最坏情况更好的模型。
我因此运行几个评估步骤。我想做的是将这些评估步骤并行化,因为现在只有大师在评估。使用大型集群时,它是效率低下的根源,也是需要评估任务的工作人员。
基本上,主管创建为:
self.sv = tf.train.Supervisor(
graph,
is_chief=self.is_master,
logdir=train_dir(self.args.output_path),
init_op=init_op,
saver=self.saver,
# Write summary_ops by hand.
summary_op=None,
global_step=self.tensors.global_step,
# No saving; we do it manually in order to easily evaluate immediately
# afterwards.
save_model_secs=0)
培训结束时,我打电话给总结作者。 :
# only on master, this is what I want to remove
if self.is_master and not self.should_stop:
# I want to have an idea of statistics of accuracy
# not just the mean, hence I run on 10 batches
for i in range(10):
self.global_step += 1
# I call an evaluator, and extract the accuracy
evaluation_values = self.evaluator.evaluate()
accuracy_value = self.model.accuracy_value(evaluation_values)
# now I dump the accuracy, ready to use within hptune
eval_summary = tf.Summary(value=[
tf.Summary.Value(
tag='training/hptuning/metric', simple_value=accuracy_value)
])
self.sv.summary_computed(session, eval_summary, self.global_step)
我也试过写工人的总结,但是我得到了一个错误:基本上只能从大师那里写总结。有什么简单的方法可以解决吗?错误是:"Writing a summary requires a summary writer."
我猜你会为每个工人自己创建一个单独的摘要编写器,而不是直接写出摘要。
我怀疑您也不会使用主管来进行评估处理。只需在每个工作人员上加载一个会话,以使用最新的检查点进行评估,并写出独立的摘要。