Pytorch 分布式多GPU训练
本文章借鉴于Pytorch官方的TotourialDDP(DistributedDataParallel):多进程,可单机多GPU训练,可跨设备训练DP(DataParallel):单进程,多线程,只可单机多GPU训练,但多GPU训练时内存主要占用第一块GPUimport osimport sysimport tempfileimport torchimport torch.distributed as distimport torch.nn as nnimport torch.optim







