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 Hanb979a01ba9ac
diff --git a/unsloth/models/llama.py b/unsloth/models/llama.pyindex da3295adfd0..ff52f1cffa3 100644--- a/unsloth/models/llama.py+++ b/unsloth/models/llama.py@@ -949,6 +949,10 @@ def LlamaModel_fast_forward_inference()pass+global global_hidden_states+global global_labels+global_hidden_states = None+global_labels = Nonedef CausalLM_fast_forward(fast_forward_inference):def _CausalLM_fast_forward(@@ -1021,6 +1025,11 @@ def CausalLM_fast_forward(fast_forward_inference):if not RETURN_LOGITS and HAS_CUT_CROSS_ENTROPY and labels is not None:n_items = kwargs.get("num_items_in_batch", None) or kwargs.get("n_items", None)+ global global_hidden_states+ global global_labels+ global_hidden_states = hidden_states+ global_labels = labels+ raiseloss = fused_linear_cross_entropy(hidden_states = hidden_states,lm_weight = lm_head,