Skip to content

Commit 689842a

Browse files
authored
Merge pull request #193 from hlyang1992/master
Add the missing negative sign in the formula.
2 parents 1b51fbc + 2eccd8b commit 689842a

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

labml_nn/transformers/rope/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def _build_cache(self, x: torch.Tensor):
137137
# Get sequence length
138138
seq_len = x.shape[0]
139139

140-
# $\Theta = {\theta_i = 10000^{\frac{2(i-1)}{d}}, i \in [1, 2, ..., \frac{d}{2}]}$
140+
# $\Theta = {\theta_i = 10000^{-\frac{2(i-1)}{d}}, i \in [1, 2, ..., \frac{d}{2}]}$
141141
theta = 1. / (self.base ** (torch.arange(0, self.d, 2).float() / self.d)).to(x.device)
142142

143143
# Create position indexes `[0, 1, ..., seq_len - 1]`

0 commit comments

Comments
 (0)