Update gemma.py

This commit is contained in:
Daniel Han-Chen 2024-02-25 04:17:16 +11:00
commit 147d129772

View file

@ -110,8 +110,8 @@ class FastGemmaRotaryEmbedding(torch.nn.Module):
emb = torch.cat((freqs, freqs), dim=-1)
seq_len = position_ids.shape[1]
new_cos = emb.cos().to(dtype=x.dtype)[:,:seq_len]
new_sin = emb.sin().to(dtype=x.dtype)[:,:seq_len]
new_cos = emb.cos().to(dtype=x.dtype)[:,:length]
new_sin = emb.sin().to(dtype=x.dtype)[:,:length]
print(new_cos, new_cos.shape)
print(old_cos, old_cos.shape)