fix: skip flex_attention for models with non-zero attention_dropout (#4605)

This commit is contained in:
Abhinav 2026-03-26 13:42:23 +05:30 committed by GitHub
commit 74ddef1402
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -234,6 +234,10 @@ def prefer_flex_attn_if_supported(model_class, config):
model_class, "_supports_flex_attn", False
):
return None
attention_dropout = getattr(config, "attention_dropout", 0) or 0
if attention_dropout > 0:
return None
# GPT-OSS, Mllama and Gemma3N use eager/sdpa attention during
# inference since flex attention returns incorrect results or errors out.
# GPT-OSS: left padding issues cause incorrect outputs.