-
Notifications
You must be signed in to change notification settings - Fork 538
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
76 additions
and
40 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 |
---|---|---|
@@ -1,20 +1,36 @@ | ||
# Copyright 2024 MosaicML LLM Foundry authors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
from typing import Type | ||
from typing import Callable, Type | ||
|
||
import torch | ||
|
||
from llmfoundry.utils.registry_utils import create_registry | ||
|
||
# Layers | ||
_norm_description = """The norms registry is used to register classes that implement normalization layers.""" | ||
norms = create_registry('llmfoundry', | ||
'norms', | ||
generic_type=Type[torch.nn.Module], | ||
entry_points=True, | ||
description=_norm_description) | ||
|
||
_attention_class_description = """The attention_class registry is used to register classes that implement attention layers.""" | ||
attention_class = create_registry('llmfoundry', | ||
'attention_class', | ||
generic_type=Type[torch.nn.Module], | ||
entry_points=True, | ||
description=_attention_class_description) | ||
|
||
_attention_implementation_description = """The attention_implementation registry is used to register functions that implement the attention operation.""" | ||
attention_implementation = create_registry( | ||
'llmfoundry', | ||
'attention_implementation', | ||
generic_type=Callable, | ||
entry_points=True, | ||
description=_attention_implementation_description) | ||
|
||
__all__ = [ | ||
'norms', | ||
'attention_class', | ||
'attention_implementation', | ||
] |
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
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