From 48ded877f191b9b28072d3517d64194476771b2f Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Tue, 14 Jan 2025 22:32:44 -0800 Subject: [PATCH] Update llama.py --- unsloth/models/llama.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unsloth/models/llama.py b/unsloth/models/llama.py index edd3ddf94f..7c7d66d03d 100644 --- a/unsloth/models/llama.py +++ b/unsloth/models/llama.py @@ -664,7 +664,7 @@ def LlamaModel_fast_forward( # Fix up attention mask by setting elements to 0 # Specifically for DPO - if self._has_no_labels and (attention_mask is not None) and (past_key_values is None) and \ + if getattr(self, "_has_no_labels", False) is True and (attention_mask is not None) and (past_key_values is None) and \ (not train_embed_tokens): # Careful for inference the attention_mask is size (1, kv_seq_len) # Whilst the input_embeds is size (1, 1, 4096)