1、问题描述
为了加快大模型的训练速度,采用了分布式训练策略,基于MultiWorkerServerStrategy模式,集群之间采用Ring—Reduce的通信机制,不同节点在同步梯度会借助collective_ops.all_gather方法将梯度进行汇聚收集,汇聚过程出现了:
allreduce_1/CollectiveGather_1 Inconsitent output shapes,got[20],but expected is [22]
allreduce_1/CollectiveGather Inconsitent output shapes,got[16,8],but expected is [20,8]
从而终止了训练继续进行。
2、原因分析
直观看是因为不连续的输出形状,即要求的输出形状对于第一个是[22],却输出了[20],造成了不一致,查阅相关资料发现在tensorflow1.15早期的版本中,底层的源码文件tensorflow/core/kernels/collective_ops.cc

当col_params_.instance.shape.num_elements() == 0时表明是首次批来的时候,记住了output_shape,当第二批次或后面

最低0.47元/天 解锁文章
473

被折叠的 条评论
为什么被折叠?



