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 Hanb9fe2588e510
diff --git a/unsloth/models/llama.py b/unsloth/models/llama.pyindex 38ad6062db5..cfeeab08001 100644--- a/unsloth/models/llama.py+++ b/unsloth/models/llama.py@@ -993,6 +993,9 @@ def CausalLM_fast_forward(fast_forward_inference):logits = self.lm_head(hidden_states[:, -num_logits_to_keep:, :].to(lm_head.dtype))else:RETURN_LOGITS = os.environ.get("UNSLOTH_RETURN_LOGITS", "0") == "1"+ # < 1024 Normal Unsloth uses less VRAM!+ if bsz*q_len <= 1024: RETURN_LOGITS = True+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)loss = fused_linear_cross_entropy(