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.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Update llama.py
Daniel Han9c812cc72aec
diff --git a/unsloth/models/llama.py b/unsloth/models/llama.pyindex 4d8ec1367ea..f19609fa444 100644--- a/unsloth/models/llama.py+++ b/unsloth/models/llama.py@@ -247,7 +247,7 @@ def LlamaAttention_fast_forward_inference(# Grouped query attention_, _, cached_len, _ = Knn.shape- if bsz == 1 or not SDPA_HAS_GQA and n_groups != 1:+ if True:Knn = Knn[:, :, None, :, :].expand(bsz, n_kv_heads, n_groups, cached_len, head_dim)Vnn = Vnn[:, :, None, :, :].expand(bsz, n_kv_heads, n_groups, cached_len, head_dim)Knn = Knn.reshape(bsz, n_heads, cached_len, head_dim)@@ -266,10 +266,7 @@ def LlamaAttention_fast_forward_inference(A[:] = torch_nn_functional_softmax(A, dim = -1, dtype = torch.float32)#.to(A.dtype)A = torch_matmul(A, Vnn, out = Qn)else:- if SDPA_HAS_GQA:- A = scaled_dot_product_attention(Qn, Knn, Vnn, attn_mask = attention_mask, is_causal = False, enable_gqa = True)- else:- A = scaled_dot_product_attention(Qn, Knn, Vnn, attn_mask = attention_mask, is_causal = False)+ A = scaled_dot_product_attention(Qn, Knn, Vnn, attn_mask = attention_mask, is_causal = False)passA = A.transpose(1, 2)A = A.reshape(bsz, 1, attention_size)