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 llama.py

Daniel Hanb28f5dfe64f3
diff --git a/unsloth/models/llama.py b/unsloth/models/llama.py
index e0d712164eb..52b4dc2c9fe 100644
--- a/unsloth/models/llama.py
+++ b/unsloth/models/llama.py
@@ -1069,7 +1069,7 @@ def CausalLM_fast_forward(fast_forward_inference):
if labels is not None: labels = labels.to(lm_head_device)
# Output last hidden states without logits if asked
- if model.training and os.environ.get("UNSLOTH_RETURN_HIDDEN_STATES", "0") == "1":
+ if self.training and os.environ.get("UNSLOTH_RETURN_HIDDEN_STATES", "0") == "1":
if num_logits_to_keep != 0:
hidden_states = hidden_states[:, -num_logits_to_keep:, :]
return CausalLMOutputWithPast(