RuntimeError: Function 'MmBackward' returned nan values in its 0th output.
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 9k
- Forks
- 1.5k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 3
Description
I use
model, optimizer = amp.initialize(model, optimizer,
opt_level='O1'
)
and my loss backwards is handled by
with amp.scale_loss(loss, optimizer) as scaled_loss:
scaled_loss.backward()
Things work well without amp.initialize, so I guess the problem is triggered by the mix precision... Can anyone give me a hint for solving such problem? Thanks!
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the failure around amp.initialize with opt_level='O1' and the amp.scale_loss(loss, optimizer) backward path. Compare the failing mixed-precision run with the working run without AMP, then narrow down the operation producing the MmBackward NaN; done means a reproducible diagnosis and a confirmed fix or documented limitation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, pytorch
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100