美文网首页
踩过的pytorch坑

踩过的pytorch坑

作者: 顾北向南 | 来源:发表于2021-05-12 22:16 被阅读0次

    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”

    相关文章

      网友评论

          本文标题:踩过的pytorch坑

          本文链接:https://www.haomeiwen.com/subject/vtuzdltx.html