From 7c958ab9e7dc79bd9b72f4d1fc8044fcaca26301 Mon Sep 17 00:00:00 2001 From: Daniel Han-Chen Date: Sun, 25 Feb 2024 04:25:57 +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 45ee3d2b87..b6b6152d4e 100644 --- a/unsloth/models/gemma.py +++ b/unsloth/models/gemma.py @@ -69,7 +69,7 @@ class FastGemmaRotaryEmbedding(torch.nn.Module): self.register_buffer("sin_cached", None, persistent=False) self.inv_freq = 1.0 / ( - self.base ** (torch.arange(0, self.dim, 2, dtype=torch.int64, device=x.device).float() / self.dim) + self.base ** (torch.arange(0, self.dim, 2, dtype=torch.int64, device="cuda").float() / self.dim) ) position_ids = torch.arange(self.max_position_embeddings, device="cuda", dtype=torch.int64).unsqueeze(0) inv_freq_expanded = self.inv_freq[None, :, None].float().expand(1, -1, 1)