AMP feature request: context manager to selectively force ops to be in FP16
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 9k
- Forks
- 1.5k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 3
Description
For some networks it's fine/faster to use FP16 ops instead of the safer FP32 ones. For example, in practice it's fine to do the layernorm in FP16 in the Transformer architecture and is a couple percent faster.
Can we add a context manager to selectively perform ops in FP16? Something like:
with amp_handle.force_fp16():
x = torch.nn.functional.layer_norm(...) # FP16 layernorm
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
The issue names no files, tests, or entry points. Start by locating Apex's existing AMP handling and determine how the proposed force_fp16() context manager would affect torch.nn.functional.layer_norm and other operations. Done means the context manager selectively runs requested operations in FP16 without changing operations outside its scope.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100