torch1.6好像不支持了
DataParallel 笔记_jacke121的专栏-CSDN博客
保存模型:
import torch
if __name__ == '__main__':
aaaa=[]
model_path="best.pth"
if isinstance(aaaa,torch.nn.parallel.DistributedDataParallel):
torch.save(aaaa.module.state_dict(),model_path)
else:
torch.save(aaaa.state_dict(), model_path)
其他例子:
本文主要介绍了PyTorch中的DistributedDataParallel使用过程中遇到的问题及解决方案,包括初始化过程、DataLoader设置、模型保存、多GPU训练中的注意事项,以及报错处理等。
订阅专栏 解锁全文
64

被折叠的 条评论
为什么被折叠?



