fix comment and match old behaviour

This commit is contained in:
Datta Nimmaturi 2026-03-13 04:50:06 +00:00
commit c4f01056ae
2 changed files with 5 additions and 4 deletions

View file

@ -250,7 +250,7 @@ def determine_attention_implementation(model_class, config):
and (model_class is not None)
and getattr(model_class, "_supports_flex_attn", False)
):
# GPT-OSS, Mllama and Gemma3 use eager/sdpa attention during
# 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.
# Mllama: _update_causal_mask uses make_flex_block_causal_mask which

View file

@ -623,9 +623,10 @@ class FastBaseModel:
if not ("attn_implementation" in kwargs):
kwargs["attn_implementation"] = attn_impl
if not supports_sdpa and kwargs.get("attn_implementation") == "sdpa":
print(
f"Unsloth: {model_type_arch.title()} does not support SDPA - switching to fast eager."
)
if os.environ.get("UNSLOTH_ENABLE_FLEX_ATTENTION", "1") == "0":
print(
f"Unsloth: {model_type_arch.title()} does not support SDPA - switching to fast eager."
)
del kwargs["attn_implementation"]
bnb_config = None