NVIDIA / NVIDIA/Megatron-LM

[BUG] Context parallel `nan` loss

Open
#1,764 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
17.9k
Forks
4.5k
Avg merge
4d 6h
Merged PRs (30d)
271

Description

**Describe the bug**

When enabling context parallel and when all the tokens on a single GPU is masked out, the loss and grad becomes NaN.

see also: https://github.com/NVIDIA/NeMo/issues/14488

**To Reproduce**
Use CP > 2 and pad a short training data 2x it's original length

**Expected behavior**
model trains.

**Environment (please complete the following information):**
- Megatron-LM commit ID version 0.31.1
- PyTorch version
- CUDA version
- NCCL version

**Proposed fix**
I've identified the issue. submitting a PR soon

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.