分布式张量流参数服务器和工人

Distributed tensorflow parameter server and workers

我一直在密切关注 Imagenet 分布式 TF 训练示例。

我无法理解当此示例在 2 个不同的工作人员上 运行 时数据分布是如何发生的?理论上,不同的工作者应该看到数据的不同部分。另外,代码的哪一部分告诉参数传递到参数服务器上?就像在多 gpu 示例中一样,'cpu:0'.

有明确的部分

不同的工作人员通过从单个预处理图像队列中取出小批量图像来查看数据的不同部分。详细地说,在用于训练 Imagenet 模型的分布式设置中,输入图像由多个线程预处理,预处理后的图像存储在单个 RandomShuffleQueue 中。您可以在 this file to see how this is done. The multiple workers are organized as 'Inception towers' and each tower dequeues a mini batch of images from the same queue, and thus get different parts of the input. The picture here answers the second part of your question. Look for slim.variables.VariableDeviceChooser in this 文件中查找 tf.RandomShuffleQueue。那里的逻辑确保 Variable 对象被平均分配给充当参数服务器的工作人员。所有其他进行实际训练的工作人员在步骤开始时获取变量并在步骤结束时更新它们。