-
Notifications
You must be signed in to change notification settings - Fork 326
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PyTorch] Normalization ops #1033
Merged
Merged
Changes from all commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
338e193
Add layer norm op
timmoon10 84bc1d7
Add FP8 cast op
timmoon10 0c40c54
Merge branch 'main' into norm-ops
timmoon10 a7f0228
Add tests for linear and layernorm with FP8 output
timmoon10 cb9c455
RMSNorm op
timmoon10 68635ad
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] cb9b4ec
Fix linter warnings
timmoon10 b33f367
Merge branch 'main' into norm-ops
timmoon10 d9fb6f4
Merge branch 'main' into norm-ops
timmoon10 00592d7
Replace LayerNorm module with LayerNorm op
timmoon10 e0a2fd9
Replace RMSNorm module with RMSNorm op
timmoon10 ad32d6a
Add AMP support
timmoon10 92d1f89
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 2197bca
Merge branch 'main' into norm-ops
timmoon10 c27a783
Merge branch 'main' into norm-ops
timmoon10 fb6b7e4
Merge branch 'main' into norm-ops
timmoon10 7be0524
Do not save autograd context if grad mode is disabled
timmoon10 e7c9c67
Merge branch 'main' into norm-ops
timmoon10 91e6a03
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 21086aa
Merge branch 'main' into norm-ops
timmoon10 28bc058
Forward args in pre_forward func to base op class
timmoon10 e6c5d5f
Merge branch 'main' into norm-ops
timmoon10 4fdc3b7
Merge branch 'main' into norm-ops
timmoon10 b1141f5
Merge branch 'main' into norm-ops
timmoon10 4206fa2
Update to use QuantizedTensor class
timmoon10 fd5afe5
Apply suggestions from code review
timmoon10 5b90e4b
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] fd4ef97
Merge branch 'main' into norm-ops
timmoon10 102c64f
Review suggestions from @ptrendx
timmoon10 87ce450
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] fed61f9
Fix linter warnings
timmoon10 393ee66
Merge branch 'main' into norm-ops
timmoon10 556983e
Use weight dtype as default compute dtype
timmoon10 9b508df
Merge branch 'main' into norm-ops
timmoon10 fb16ee9
Merge branch 'main' into norm-ops
timmoon10 34e2985
Merge branch 'main' into norm-ops
timmoon10 7e61399
Fix linter warnings
timmoon10 8b3cf24
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 8ddd539
Merge branch 'main' into norm-ops
timmoon10 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems a little backwards. if
dtype
is supposed to be the new argument name, then why is it inkwargs
? Bothparams_dtype
anddtype
should be regular parameters, there should be a deprecation warning when somebody usesparams_dtype
and also the check for duplicate assignment like the one you have here.Also, similar treatment should be done for hidden_size and sequence_parallel (especially the last one seems to be just gone completely so there should be some explanation that it was unused before or something?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My thinking is that we should forward kwargs directly to
te.ops.LayerNorm
as much as possible so that we only have to change the API in one place if we ever make changes in the future. We include the deprecated options as explicit kwargs since they are specific to the module.This function signature also maintains backward compatibility for users who pass in the options as positional args, e.g.:
TransformerEngine/tests/pytorch/test_onnx_export.py
Lines 676 to 678 in 0ee5ccd