1. 多卡训练模型
- 如果使用torch.nn.DataParallel(model)多卡并行训练模型的话需要注意:
model = torch.nn.DataParallel(model).module # 必须这样设置模型,不加module的话,模型训练会出现“module must have its parameters and buffers on device cuda:0 but found one o”
model = torch.nn.DataParallel(model).module # 必须这样设置模型,不加module的话,模型训练会出现“module must have its parameters and buffers on device cuda:0 but found one o”
本文标题:踩过的pytorch坑
本文链接:https://www.haomeiwen.com/subject/vtuzdltx.html
网友评论