NVIDIA / NVIDIA/apex

How to use fp16 training with masked operations

Open
#93 9 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
9k
Forks
1.5k
Avg merge
2d 4h
Merged PRs (30d)
3

Description

Hello !

I'm working on sequence training with CNNs and for this I've to operate some masked_fill operations over the padding, before softmax for example.

On float32 training, I'm masking with -1e20 value, and it seems to be training fine. Unfortunately, when training with float16 and masking with -1e15, amp loss scaling always returns "NaN" for gradients.

Do you have any idea how to combine masked_fill with amp ?

Thanks,
Morgan

Contributor guide

No contributing guide indexed for this repository

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

The issue names no repository files or tests. Start by reproducing the reported NaN gradients with float16, masked_fill, softmax, and AMP loss scaling, then review the existing discussion for constraints. Done means establishing whether the behavior is a bug or documenting a supported way to combine these operations.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.