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 new fusion argument from onnxruntime v1.16.2 #1535

Merged
merged 1 commit into from
Nov 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions optimum/onnxruntime/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,8 @@ class OptimizationConfig:
Do not fuse GroupNorm. Only works for model_type=unet.
disable_packed_kv (`bool`, defaults to `True`):
Do not use packed kv in cross attention. Only works for model_type=unet.
disable_rotary_embeddings (`bool`, defaults to `False`):
Whether to disable Rotary Embedding fusion.
"""

optimization_level: int = 1
Expand Down Expand Up @@ -752,6 +754,9 @@ class OptimizationConfig:
disable_group_norm_fusion: bool = True
disable_packed_kv: bool = True

# ONNX Runtime 1.16.2 arguments
disable_rotary_embeddings: bool = False

def __post_init__(self):
def deprecate_renamed_attribute(old_name, new_name, mapping_func=None):
if getattr(self, old_name, None) is not None:
Expand Down Expand Up @@ -801,6 +806,7 @@ class Box:
"use_raw_attention_mask": "use_raw_attention_mask",
"enable_gemm_fast_gelu_fusion": "enable_gemm_fast_gelu",
"use_multi_head_attention": "use_multi_head_attention",
"disable_rotary_embeddings": "disable_rotary_embeddings",
}
for attr_name, fusion_attr_name in attribute_map.items():
setattr(args, fusion_attr_name, getattr(self, attr_name))
Expand Down
Loading