From c0f6b6c0cccc0b77abf7f34aaa7992b0c17a866b Mon Sep 17 00:00:00 2001 From: Daniel Han-Chen Date: Sun, 25 Feb 2024 02:31:22 +1100 Subject: [PATCH] Update gemma.py --- unsloth/models/gemma.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unsloth/models/gemma.py b/unsloth/models/gemma.py index 4104dd8df4..7e8d7345bc 100644 --- a/unsloth/models/gemma.py +++ b/unsloth/models/gemma.py @@ -77,7 +77,7 @@ class FastGemmaRotaryEmbedding(torch.nn.Module): freqs = torch.outer(t, self.inv_freq) emb_old = torch.cat((freqs, freqs), dim=-1).to("cuda") - inv_freq_expanded = self.inv_freq[None, :, None].float().expand(position_ids.shape[0], -1, 1) + inv_freq_expanded = self.inv_freq[None, :, None].float().expand(position_ids.shape[0], -1, 1).to("cuda") position_ids_expanded = position_ids[:, None, :].float() freqs = (inv_freq_expanded @ position_ids_expanded).transpose(1, 2) emb_new = torch.cat((freqs, freqs), dim=-1)