Giter Site home page Giter Site logo

Comments (4)

taishan1994 avatar taishan1994 commented on May 19, 2024

实验条件:4卡 Ubuntu 背景:项目的其他 训练脚本 都能运行复现成功,所以框架环境应该没问题,只有下面的脚本执行有问题 运行命令:CUDA_VISIBLE_DEVICES=0,1 python multi-gpu-dataparallel-cls.py 报错如下: warnings.warn('Was asked to gather along dimension 0, but all ' image

我的排查过程: 我把模型的输出(logits, label = self.on_step(batch_data) loss = self.criterion(logits, label)这两行的结果变量)打印了一下,然后手动计算loss,发现确实是inf 然后我把同样的输入在 model(不打开 数据并行)单卡测试,发现loss正常, 然后把通常的输入在 model(打开 数据并行)上双卡测试,发现loss确实 inf. 一直没有排查出原因,还请大佬指教

可能的解决方法:
1、调小学习率。
2、代码中增加梯度裁剪策略。

from pytorch-distributed-nlp.

jiakechong1991 avatar jiakechong1991 commented on May 19, 2024

实验如下(单一变量操作):

  1. 把学习率从 learning_rate = 3e-5 改成 1e-5和3e-7 报错不变
  2. 把梯度加上裁剪,代码如下:
    image
    报错如下:
    image

大佬,疑惑一个问题:

  1. 同样的模型,同样的输入,为啥单卡时,输出的logits和多卡的输出logits不同呢?dataparallel不就是 每个GPU加载同样的模型吗?

感谢大佬百忙之中指教

from pytorch-distributed-nlp.

taishan1994 avatar taishan1994 commented on May 19, 2024

我也不知道是什么原因了。

from pytorch-distributed-nlp.

jiakechong1991 avatar jiakechong1991 commented on May 19, 2024

感谢,我再研究下,如果解决就贴在这里

from pytorch-distributed-nlp.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.