-
Notifications
You must be signed in to change notification settings - Fork 374
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
分布式多机多卡训练卡住,超时后报错 #123
Comments
添加了各种配置之后,现在是卡在训练开始的阶段,Epoch为0的训练一直没有开始,但是两台机器的显存占用了,GPU利用率也是100%,但是就是没有开始训练。 查阅了一些资料: 主要做了以下修改:
更新后的启动脚本:
训练脚本脚本:
Node0机器日志:
Node1机器日志:
|
解决了,把PyTorchLighting的Trainer换成了Hug个ingFace的Trainer,就可以多机多卡训练了, |
您好,可以请问一下你是用的torch lightning model吗?我也遇到了这个问题,可以看看你的huggingface trainer怎么写的吗? |
记不太清了,当时的代码没有留存。[手动捂脸哭] |
@Zyriix 你解决了吗 一样的pytorchlighting多机多卡 我也遇到了torch.distributed.init_process_group(self.torch_distributed_backend, rank=global_rank, world_size=world_size)卡住的问题,能问下你那边是怎么解决的吗 |
这个问题一般是因为不同的node之间gather的时候数据不一致导致的,具体来说有这几种可能:
一般检查这两个就可以解决,通常直接把log_dict里的sync关掉,即不使用跨节点的metrics计算会减少这种问题出现的概率 |
你好,我最近训练代码也遇到了相同的问题,感觉应该和您描述很相符,因为在我的程序中,计算图和数据是高度相关的,某些特定数据不会经过部分网络导致各个GPU上的loss不一致,可以加个联系方式进一步聊一下相关问题嘛? |
我也是类似的 特定数据过特定分支,在多机开启syncbn后就会卡住,跟你的情况很像,请问有解决吗 |
这个解决方式可以尝试上面提到的,给每个loss设一个默认值来解决。 除了loss之外,分布式训练还会gather梯度,你们提到的计算图不同可能会导致不同node间的梯度不同,从而使程序一直等待梯度。使用deepspeed stage2好像可以解决这类问题,我不确定,可以尝试。 |
我也是这样的,我跑的moe,不同token走得分支不一样,然后backward的时候就卡住,老哥有解决吗? |
是的,我也是在训练MoE的时候会卡住。我试了一下如果只有1个expert,程序多卡运行没问题。我怀疑是不同卡上选择不同的expert的梯度不同导致的,无法进行反向更新参数?我使用的是deepspeed的stage2也依然没有解决这个问题。 |
我也遇到了相同的问题。deepspeed stage1还能跑一会儿再出错,2的话第一步就会超时。想了个笨办法,就是把有时不会用到的参数的平方和乘个很小的系数加到loss里面去,这样保证他们出现在计算图里面,能够有梯度算出来。试试行不行 |
按照上面的方法,这个问题似乎解决了。不过还有其他错误,继续熬 |
接 #111 ,我们搭建了两个相同环境(500G内存、8块1080Ti 11G显卡)的服务器,想尝试多机多卡训练方案,加载模型成功了,但是并没有开始训练,过了一段时间后应该是超时退出了。
Node0报错如下:
有意思的现象是,Node0报错后退出执行程序,而Node1则直接退出了SSH。
我查阅了一些资料,在finetune_gpt2.py增加了一些配置,但也没有起效果。
查阅内容内容如下:
ultralytics/yolov5#7481
https://www.zhihu.com/question/512132168
https://discuss.pytorch.org/t/nccl-timed-out-when-using-the-torch-distributed-run/153276
https://stackoverflow.com/questions/69693950/error-some-nccl-operations-have-failed-or-timed-out
The text was updated successfully, but these errors were encountered: