deepspeedai / deepspeedai/DeepSpeed

Warning: NaN or Inf found in input tensor when running DeepSpeedExamples/BingBertSquad.

Open
#324 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
43.1k
Forks
5k
Avg merge
4d 15h
Merged PRs (30d)
112

Description

Hi Deepspeed team,

I run DeepSpeedExamples/BingBertSquad on my machine with 2 GPUs. I follow the instruction https://www.deepspeed.ai/tutorials/bert-finetuning/ and can get a reproduce when I run the run_squad_baseline.sh.

However, when I changed the deepspeed_bsz24_config.json file, it gave me the following warning and I could only get 'loss=nan'. Besides, if I used the original config file, it gave me the same result.

[INFO] [deepspeed_utils.py:118:_handle_overflow] rank 0 detected overflow nan in tensor 0:0 shape torch.Size([30528, 1024]) | 3/29324 [00:00<2:33:39, 3.18it/s]
[2020-08-20 14:38:13,808] [INFO] [zero_optimizer_stage1.py:621:step] [deepspeed] OVERFLOW! Skipping step. Attempted loss scale: 4294967296, reducing to 2147483648.0
Warning: NaN or Inf found in input tensor.
Warning: NaN or Inf found in input tensor.

The config file is like this:

{
"train_batch_size": 12,
"train_micro_batch_size_per_gpu": 3,
"steps_per_print": 10,
"optimizer": {
"type": "Adam",
"params": {
"lr": 3e-5,
"weight_decay": 0.0,
"bias_correction": false
}
},
"gradient_clipping": 1.0,
"fp16": {
"enabled": true
},
"zero_optimization": {
"stage": 1
}
}

Could you help me fix it?
Thanks!

Tony

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running DeepSpeedExamples/BingBertSquad with run_squad_baseline.sh and compare the original and modified deepspeed_bsz24_config.json settings. Trace the reported overflow in the tensor and verify that training completes without NaN or Inf warnings and produces finite loss values.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
distributed-systems, machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.