Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Update gemma2.py

Daniel Han5f2990df0d37
diff --git a/unsloth/models/gemma2.py b/unsloth/models/gemma2.py
index d2bfb78992a..1cbaf5b1693 100644
--- a/unsloth/models/gemma2.py
+++ b/unsloth/models/gemma2.py
@@ -141,7 +141,7 @@ def Gemma2Attention_fast_forward(
# FA uses 1 / sqrt for softmax_scale!
if not hasattr(self, "_flash_attention_softmax_scale"):
- self._flash_attention_softmax_scale = 1.0 / self.config.query_pre_attn_scalar**0.5
+ self._flash_attention_softmax_scale = 1.0 / (self.config.query_pre_attn_scalar**0.5)
pass
Q = Q.transpose(1, 2)