Skip to content
This repository was archived by the owner on Sep 9, 2025. It is now read-only.

Commit da678a5

Browse files
authored
rope positions need higher precision (#7)
Signed-off-by: Yu Chin Fabian Lim <flim@sg.ibm.com>
1 parent ddfc6b1 commit da678a5

File tree

1 file changed

+1
-3
lines changed
  • src/instructlab/dolomite/hf_models/modeling_utils/position_embedding

1 file changed

+1
-3
lines changed

src/instructlab/dolomite/hf_models/modeling_utils/position_embedding/rope.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,7 @@ def _set_cos_sin_cache(
5555
self, seq_len: int, device: torch.device, dtype: torch.dtype
5656
) -> None:
5757
self.max_seq_len_cached = seq_len
58-
t = torch.arange(
59-
self.max_seq_len_cached, device=device, dtype=self.inv_freq.dtype
60-
)
58+
t = torch.arange(self.max_seq_len_cached, device=device, dtype=torch.float32)
6159

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

0 commit comments

Comments
 (0)