From 686d9fa4c4085c3d4d2eae188bc9ba9eeb686eeb Mon Sep 17 00:00:00 2001 From: Daniel Han-Chen Date: Mon, 26 Feb 2024 04:27:55 +1100 Subject: [PATCH] Update gemma.py --- unsloth/models/gemma.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/unsloth/models/gemma.py b/unsloth/models/gemma.py index 0107fcf8d3..4cef4972ac 100644 --- a/unsloth/models/gemma.py +++ b/unsloth/models/gemma.py @@ -77,8 +77,8 @@ class FastGemmaRotaryEmbedding(torch.nn.Module): position_ids_expanded = position_ids[:, None, :].float() freqs = (inv_freq_expanded @ position_ids_expanded).transpose(1, 2) emb = torch.cat((freqs, freqs), dim=-1) - self.cos_cached = emb.cos().to(torch.bfloat16) - self.sin_cached = emb.sin().to(torch.bfloat16) + self.cos_cached2 = emb.cos().to(torch.bfloat16) + self.sin_cached2 = emb.sin().to(torch.bfloat16) def forward(self, x, position_ids, seq_len=None): # x: [bs, num_attention_heads, seq_len, head_size] @@ -107,7 +107,7 @@ class FastGemmaRotaryEmbedding(torch.nn.Module): sin_cached = emb.sin().to(dtype=x.dtype) print(cos_cached) - print(self.cos_cached) + print(self.cos_cached2) # return self.cos_cached[:,:length], self.sin_cached[:,:length] return self.cos_cached, self.sin_cached