From 1d7d59fdede43c9b3dc452445393cd1473f616fd Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Thu, 13 Feb 2025 16:11:51 -0800 Subject: [PATCH] Update llama.py --- unsloth/models/llama.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/unsloth/models/llama.py b/unsloth/models/llama.py index ec6706e515..511ae5c681 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