WZMIAOMIAO / deep-learning-for-image-processing

deep learning for image processing including classification and object-detection etc.
GNU General Public License v3.0
23.36k stars 8.02k forks source link

关于多卡环境下的batch size跟learning rate #712

Open davidpengiupui opened 1 year ago

davidpengiupui commented 1 year ago

System information

Describe the current behavior

Error info / logs 老师您好,听了您的课但还是有一些关于distributed_data _parallel的困惑。比如说我原本在单卡上batch size为32,learning rate为1e-4,那变成双卡后, 在想要跟单卡接近的环境下运行,batch size是不是要对应变成16?另外就是learning rate,我看到网上一些说法是pytorch在distributed_data_parallel下会对两卡的gradient取平均,这样还要把learning rate加倍到2e-4吗?还是维持原来的1e-4?