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 Han2aae911368cd
diff --git a/unsloth/models/llama.py b/unsloth/models/llama.pyindex 2524ec13123..b7dc68586ca 100644--- a/unsloth/models/llama.py+++ b/unsloth/models/llama.py@@ -843,6 +843,9 @@ def LlamaModel_fast_forward(pass+global past_key_values_all+past_key_values_all = None+# https://github.com/huggingface/transformers/blob/main/src/transformers/models/llama/modeling_llama.py#L825def LlamaModel_fast_forward_inference(self,@@ -855,6 +858,8 @@ def LlamaModel_fast_forward_inference(hidden_states = self.model.embed_tokens(input_ids)hidden_states = hidden_states.to(self.config.torch_dtype)bsz, q_len, hd = hidden_states.shape+ global past_key_values_all+ past_key_values_all = past_key_valuesseq_len = past_key_values[0][0].shape[-2]if bsz != 1:attention_mask = _prepare_4d_causal_attention_mask_for_sdpa(