我正在使用谷歌雲ml分佈式樣本來訓練計算機集羣上的模型。輸入和輸出(即rfrecords,檢查點,tfevents)都在gs://(谷歌存儲)在分佈式張量流程中,如何從工作人員寫入摘要
與分佈式示例類似,我使用最後調用的評估步驟,結果寫爲一個總結,以便使用參數hypertuning /在Cloud ML中,或者使用我自己的一堆工具。
但是,爲了檢索性能標準的統計信息,我正在運行幾個評估步驟,因爲我不想限制爲單個值。我想獲得有關性能間隔的信息。特別是,性能的差異對我很重要。我寧願選擇一個平均性能較低的模型,但最好的情況是最好的。
因此,我運行幾個評估步驟。我想要做的是並行化這些評估步驟,因爲現在只有主人正在評估。當使用大型集羣時,它是低效率的來源,任務工作者也要評估。
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."
你可以發佈你看到的錯誤消息嗎? – rhaertel80
您可能需要使用'sess.run(eval_summary)'。在目前,看起來總結作者應該在創建主管時初始化。你可以嘗試添加'summary_writer = tf.train.Supervisor.USE_DEFAULT'來查看是否改變了任何東西? – drpng