New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
询问DistributedGroupedDataParallel的使用方式 #116
Comments
您对 |
作者您好,我使用了以下代码进行更新 # compute gradient and do SGD/ADAM step
optimizer.zero_grad()
loss.backward()
model.allreduce_params()
optimizer.step() 此外我使用ResNet-20(无任何专家)在CIFAR-10上训练, 在替换DistributedDataParallel和DistributedGroupedDataParallel中,请问呢还有什么需要特别注意的吗 我是使用的代码在https://github.com/naga-karthik/ddp-resnet-cifar/blob/master/mainCIFAR10.py 的基础上修改得到 |
我觉得你的使用方法没有问题. 不用 |
那基本可以判定是 |
好像找到原因了,初始化之后每个机器上的初始值不同,因为 Line 83 in 527e66a
一开始的时候所有的参数都没有grad,所以初始化之后并没有在所有机器上同步参数 修改了这行之后 ResNet-20的结果可以提升到Epoch: 10, Loss: 0.64957, Acc@1: 77.12,正常了 |
作者们您好,我希望使用FastMoE尝试改进ViT在CIFAR-10任务上的结果。
我有2个GPU,我希望为每个FFN提供4个专家,其中2个专家使用GPU0,另外两个使用GPU1,其他部分使用数据并行。
但是我发现修改之后发现效果下降了,于是我使用1个GPU但扩大两倍BatchSize希望模拟2卡的情况,发现效果提升了。
我想询问我对num_expert,world_size,DistributedGroupedDataParallel的理解正确吗,这两个实验应该产生相似的结果吗?谢谢
Describe the bug
使用GPU=2, Batch_Size=256得到ViT-CIFAR10上的Baseline
使用GPU=2, Batch_Size=256,FMoE的参数:num_expert=2, world_size=2, gate=GShardGate上得到的结果弱于Baseline(紫色)
使用GPU=1, Batch_Size=512,FMoE的参数:num_expert=4, world_size=1, gate=GShardGate上得到的结果强于Baseline(粉色)
在其他参数不修改的情况下,两者是否应该得到相似的结果?
相关代码
分布式的初始化代码
The text was updated successfully, but these errors were encountered: