Gemma3 vs gemma3n issue resolve

This commit is contained in:
Datta Nimmaturi 2026-03-12 10:51:57 +00:00
commit c230eb525c

View file

@ -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"):