From c230eb525c6a59adb3408aaa42021bfdf2d461a1 Mon Sep 17 00:00:00 2001 From: Datta Nimmaturi Date: Thu, 12 Mar 2026 10:51:57 +0000 Subject: [PATCH] Gemma3 vs gemma3n issue resolve --- unsloth/models/_utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/unsloth/models/_utils.py b/unsloth/models/_utils.py index 822b93a465..8ad68a3bbc 100644 --- a/unsloth/models/_utils.py +++ b/unsloth/models/_utils.py @@ -226,7 +226,7 @@ def determine_attention_implementation(model_class, config): model_type = getattr(config, "model_type", "").lower() # 1. Flash Attention 2 - if HAS_FLASH_ATTENTION and model_type not in ("gpt_oss", "mllama") and not model_type.startswith("gemma3"): + if HAS_FLASH_ATTENTION and model_type not in ("gpt_oss", "mllama") and not model_type.startswith("gemma3n"): supports_fa2 = False if model_class is not None: supports_fa2 = getattr(model_class, "_supports_flash_attn_2", False) or getattr(model_class, "_supports_flash_attn", False) @@ -254,7 +254,7 @@ def determine_attention_implementation(model_class, config): # decode q_len=1, causing ValueError. Needs transformers update. # Gemma3N: timm vision wrappers (eg Gemma3nVisionConfig) do not # support flex_attention. - if model_type not in ("gpt_oss", "mllama") and not model_type.startswith("gemma3"): + if model_type not in ("gpt_oss", "mllama") and not model_type.startswith("gemma3n"): if config is not None: setattr(config, "_attn_implementation", "flex_attention") if hasattr(config, "attn_implementation"):