Skip to content

Commit

Permalink
rope positions need higher precision (#7)
Browse files Browse the repository at this point in the history
Signed-off-by: Yu Chin Fabian Lim <[email protected]>
  • Loading branch information
fabianlim authored Jul 18, 2024
1 parent ddfc6b1 commit da678a5
Showing 1 changed file with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ def _set_cos_sin_cache(
self, seq_len: int, device: torch.device, dtype: torch.dtype
) -> None:
self.max_seq_len_cached = seq_len
t = torch.arange(
self.max_seq_len_cached, device=device, dtype=self.inv_freq.dtype
)
t = torch.arange(self.max_seq_len_cached, device=device, dtype=torch.float32)

freqs = torch.outer(t, self.inv_freq)
# Different from paper, but it uses a different permutation in order to obtain the same calculation
Expand Down

0 comments on commit da678a5

Please sign in to comment.