Skip to content
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

Add skip layer normalization #3865

Draft
wants to merge 9 commits into
base: add_attention_contrib_op
Choose a base branch
from

Conversation

TedThemistokleous
Copy link
Collaborator

@TedThemistokleous TedThemistokleous commented Mar 4, 2025

Needed to support customer models. Seen in optimized versions of BERT or optimizations using the Onnxruntime toolset

Currently built off the add_attention_contrib_op branch as this is used to parse in an optimized bert model

official Doc here: https://github.com/microsoft/onnxruntime/blob/main/docs/ContribOperators.md#com.microsoft.SkipLayerNormalization

Other useful descriptions (this vs say simplified case)

https://pytorch.org/docs/stable/generated/torch.nn.RMSNorm.html#torch.nn.RMSNorm (also known as simplified)

https://sh-tsang.medium.com/review-layer-normalization-ln-6c2ae88bae47

@TedThemistokleous TedThemistokleous self-assigned this Mar 4, 2025
@TedThemistokleous TedThemistokleous added the Onnx Operators Adding or modifying an Onnx Operator in the MIGraphX codebase label Mar 4, 2025
@TedThemistokleous TedThemistokleous force-pushed the add_skip_layer_normalization branch from 94f3908 to 9709f30 Compare March 7, 2025 00:41
Ted Themistokleous added 3 commits March 7, 2025 01:38
…t to reflect this

Required that both mean and variance outputs are float type and not converted. This works as epsilon as well as this attribute is always float as well. Removes a bunch of extra converts when this operator is reduce precision (Float16/bf,etc)
beta and bias were flipped. Sorted this out and updated parser. captured testing beta path in parser test
Needs to have values checked. Currently working out data. Just grabbed the skip_simplied_layernorm portion and reused this while modying tests to add in beta and bias values

We should be performing the following operation to verify data via numpy

https://pytorch.org/docs/stable/generated/torch.nn.LayerNorm.html
@turneram turneram deleted the branch add_attention_contrib_op March 7, 2025 15:48
@turneram turneram closed this Mar 7, 2025
@turneram turneram deleted the add_skip_layer_normalization branch March 7, 2025 15:48
@TedThemistokleous TedThemistokleous restored the add_skip_layer_normalization branch March 7, 2025 15:50
@TedThemistokleous TedThemistokleous added the roadmap Tasks to finish for a release label Mar 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Onnx Operators Adding or modifying an Onnx Operator in the MIGraphX codebase roadmap Tasks to finish for a release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants