GPT2-Chinese
GPT2-Chinese copied to clipboard
使用多gpu训练的时候,会有RuntimeError: Gather got an input of invalid size:问题
我查了一下是因为,多gpu计算的时候分配数据造成的,项目里是不是也要加一些类似的处理
你好,这个问题会影响训练吗?直接使用DataParallel确实会影响多卡训练的效率,这个有空的话大家可以自己改一下或者提交PR
确实影响了训练,比如batch_size使用三个卡训练,数据被分成了3,3,2就影响了。使用两个卡,也遇到过类似的报错。
嗯嗯,可以设置batch size为卡数的整数倍吗?
嗯嗯 设置过 但是也有问题。试过batchsize是64 卡数是2------------------ 原始邮件 ------------------ 发件人: "Zeyao Du"[email protected] 发送时间: 2019年12月23日(星期一) 晚上6:33 收件人: "Morizeyao/GPT2-Chinese"[email protected]; 抄送: "256785"[email protected];"Author"[email protected]; 主题: Re: [Morizeyao/GPT2-Chinese] 使用多gpu训练的时候,会有RuntimeError: Gather got an input of invalid size:问题 (#118)
嗯嗯,可以设置batch size为卡数的整数倍吗?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
试过 batch_size=64 2个卡 也还是有这个问题
试试这个? https://github.com/Link-Li/Balanced-DataParallel
我 设置batchsize为卡个数的倍数 就解决了
我又重新做了下 确实是卡的倍数就可以了,不知道第一次是因为什么没训练出来。非常感谢大家帮忙呀~