forked from NVIDIA/Megatron-LM
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding basic support for MegaBlocks MoE and dMoE layers. --------- Co-authored-by: Deepak Narayanan <[email protected]>
- Loading branch information
Showing
6 changed files
with
140 additions
and
20 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 |
---|---|---|
|
@@ -3,3 +3,4 @@ __pycache__ | |
build | ||
.coverage_* | ||
*.egg-info | ||
*~ |
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,16 @@ | ||
"""Adapter to expose MegaBlocks package, if available.""" | ||
try: | ||
import megablocks | ||
except ImportError: | ||
megablocks = None | ||
|
||
def megablocks_is_available(): | ||
return megablocks is not None | ||
|
||
def assert_megablocks_is_available(): | ||
assert megablocks_is_available(), ( | ||
'MegaBlocks not available. Please run `pip install megablocks`.') | ||
|
||
moe = megablocks.layers.moe if megablocks_is_available() else None | ||
dmoe = megablocks.layers.dmoe if megablocks_is_available() else None | ||
arguments = megablocks.layers.arguments if megablocks_is_available() else None |
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