Skip to content

Commit cdd4a93

Browse files
cebtenzzreolexiyb
authored andcommitted
cuda : fix RoPE after ggml-org#2268 (ggml-org#3897)
1 parent 5cf4114 commit cdd4a93

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

ggml-cuda.cu

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4539,7 +4539,7 @@ static __global__ void rope(
45394539
const int i2 = row/p_delta_rows;
45404540

45414541
const int p = has_pos ? pos[i2] : 0;
4542-
const float theta_base = p*powf(freq_base, -col/ncols);
4542+
const float theta_base = p*powf(freq_base, -float(col)/ncols);
45434543

45444544
float cos_theta, sin_theta;
45454545
rope_yarn(theta_base, freq_scale, corr_dims, col, ext_factor, attn_factor, &cos_theta, &sin_theta);
@@ -4566,8 +4566,8 @@ static __global__ void rope_neox(
45664566
const int i = row*ncols + col/2;
45674567
const int i2 = row/p_delta_rows;
45684568

4569-
// simplified from `(row * ncols + col) * (-1 / ncols)`
4570-
const float cur_rot = -col/ncols - row;
4569+
// simplified from `(ib * ncols + col) * (-1 / ncols)`, where ib is assumed to be zero
4570+
const float cur_rot = -float(col)/ncols;
45714571

45724572
const int p = has_pos ? pos[i2] : 0;
45734573
const float theta_base = p*powf(freq_base, cur_rot);

0 commit comments

Comments
 (0)