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 Han8ae57e25a7af
diff --git a/unsloth/models/llama.py b/unsloth/models/llama.py
index ec6706e5157..511ae5c6816 100644
--- a/unsloth/models/llama.py
+++ b/unsloth/models/llama.py
@@ -724,7 +724,8 @@ def LlamaModel_fast_forward(
past_key_values_length,
sliding_window = getattr(self.config, "sliding_window", None),
)
- attention_mask = attention_mask.to(torch.bool)
+ if attention_mask is not None:
+ attention_mask = attention_mask.to(torch.bool)
pass
hidden_states = inputs_embeds