-
Notifications
You must be signed in to change notification settings - Fork 547
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add linear layer and ffn config to enable TransformerEngine layers (w…
…ith FP8) (#432) * adding te Linear for fp8 support * integ warning / config auto updt * req updts * updt FC_CLASS_REGISTRY to enable init * updt fc.py * skip running install in readme * Update attention.py * add te layers and linear / ffn config * cleanup * add te linear and fp8 instructions * install help * updt imports * updt yamls * add ffn file * leave ex_ratio alone * updt warning * lint * add default PE * updt tutorial * add tutorial warning * cleanup * updt yaml checks * undo line erase * diable torch._dynamo for te.LayerNormMLP * updt te version * fix conditional
- Loading branch information
Showing
13 changed files
with
328 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -151,6 +151,15 @@ pip install cmake packaging torch # setup.py requires these be installed | |
pip install -e ".[gpu]" # or pip install -e . if no NVIDIA GPU | ||
``` | ||
|
||
### TransformerEngine and amp_fp8 support | ||
NVIDIA H100 GPUs have FP8 support; this additionally requires the following installations: | ||
<!--pytest.mark.skip--> | ||
```bash | ||
pip install flash-attn==1.0.7 --no-build-isolation | ||
pip install git+https://github.com/NVIDIA/[email protected] | ||
``` | ||
|
||
See [here](https://github.com/mosaicml/llm-foundry/blob/main/TUTORIAL.md#TransformerEngine-and-amp_fp8-support) for more details on enabling TransformerEngine layers and amp_fp8. | ||
|
||
### AMD (BETA support) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Copyright 2022 MosaicML LLM Foundry authors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
from torch import nn | ||
|
||
FC_CLASS_REGISTRY = { | ||
'torch': nn.Linear, | ||
} | ||
|
||
try: | ||
import transformer_engine.pytorch as te | ||
FC_CLASS_REGISTRY['te'] = te.Linear | ||
except: | ||
pass |
Oops, something went wrong.