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

RMS Normalization and Skip RMS Normalization fusion optimizations #1974

Merged
merged 12 commits into from
Dec 14, 2024
Prev Previous commit
Next Next commit
Fix lint warnings
gramalingam committed Dec 9, 2024
commit b64f2225d07b4c8018259d7045b01be1ac014b61
3 changes: 3 additions & 0 deletions onnxscript/rewriter/onnxruntime/xformers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
from __future__ import annotations
2 changes: 1 addition & 1 deletion onnxscript/rewriter/onnxruntime/xformers/_test_models.py
Original file line number Diff line number Diff line change
@@ -70,8 +70,8 @@
model, inputs, input_names=input_names, dynamo=True, fallback=True
)
# ORT Transformer optimizations are applied after basic optimization.
onnxscript.optimizer.optimize(exported.model)
onnxscript.optimizer.optimize(exported.model) # type: ignore[union-attr]
return exported.model
Fixed Show fixed Hide fixed

def get_inputs(self):
if not hasattr(self, "_inputs"):
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ def _skip_norm_pattern(op, input, skip, gamma, epsilon, stash_type):
def _skip_normalization(op, input, skip, gamma, epsilon, stash_type):
if stash_type.value != 1: # FLOAT type
return None
normalized, mean, inv_std_var, skip_sum = op.SkipSimplifiedLayerNormalization(
normalized, _mean, _inv_std_var, skip_sum = op.SkipSimplifiedLayerNormalization(
input,
skip,
gamma,