Skip to content

Commit acb2c32

Browse files
authored
llama : rename n_embed to n_embd in rwkv6_time_mix (#9504)
This commit renames n_embed to n_embd in llm_build_rwkv6_time_mix. The motivation for this change is consistency with the other rwkv6 functions like build_rwkv6 (and other parts of the code base).
1 parent a6a3a5c commit acb2c32

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

src/llama.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9571,7 +9571,7 @@ static struct ggml_tensor * llm_build_rwkv6_time_mix(
95719571
struct ggml_tensor * cur,
95729572
struct ggml_tensor * x_prev,
95739573
struct ggml_tensor ** wkv_state) {
9574-
size_t n_embed = cur->ne[0];
9574+
size_t n_embd = cur->ne[0];
95759575
size_t n_seq_tokens = cur->ne[1];
95769576
size_t n_seqs = cur->ne[2];
95779577

@@ -9582,8 +9582,8 @@ static struct ggml_tensor * llm_build_rwkv6_time_mix(
95829582

95839583
struct ggml_tensor * sx = ggml_sub(ctx, x_prev, cur);
95849584

9585-
sx = ggml_reshape_2d(ctx, sx, n_embed, n_tokens);
9586-
cur = ggml_reshape_2d(ctx, cur, n_embed, n_tokens);
9585+
sx = ggml_reshape_2d(ctx, sx, n_embd, n_tokens);
9586+
cur = ggml_reshape_2d(ctx, cur, n_embd, n_tokens);
95879587

95889588
struct ggml_tensor * xxx = ggml_add(ctx, ggml_mul(ctx, sx, layer->time_mix_lerp_x), cur);
95899589

@@ -9608,11 +9608,11 @@ static struct ggml_tensor * llm_build_rwkv6_time_mix(
96089608
xxx
96099609
);
96109610

9611-
struct ggml_tensor *mw = ggml_view_2d(ctx, xxx, n_embed, n_tokens, xxx->nb[1], 0);
9612-
struct ggml_tensor *mk = ggml_view_2d(ctx, xxx, n_embed, n_tokens, xxx->nb[1], n_embed * n_tokens * sizeof(float));
9613-
struct ggml_tensor *mv = ggml_view_2d(ctx, xxx, n_embed, n_tokens, xxx->nb[1], n_embed * n_tokens * 2 * sizeof(float));
9614-
struct ggml_tensor *mr = ggml_view_2d(ctx, xxx, n_embed, n_tokens, xxx->nb[1], n_embed * n_tokens * 3 * sizeof(float));
9615-
struct ggml_tensor *mg = ggml_view_2d(ctx, xxx, n_embed, n_tokens, xxx->nb[1], n_embed * n_tokens * 4 * sizeof(float));
9611+
struct ggml_tensor *mw = ggml_view_2d(ctx, xxx, n_embd, n_tokens, xxx->nb[1], 0);
9612+
struct ggml_tensor *mk = ggml_view_2d(ctx, xxx, n_embd, n_tokens, xxx->nb[1], n_embd * n_tokens * sizeof(float));
9613+
struct ggml_tensor *mv = ggml_view_2d(ctx, xxx, n_embd, n_tokens, xxx->nb[1], n_embd * n_tokens * 2 * sizeof(float));
9614+
struct ggml_tensor *mr = ggml_view_2d(ctx, xxx, n_embd, n_tokens, xxx->nb[1], n_embd * n_tokens * 3 * sizeof(float));
9615+
struct ggml_tensor *mg = ggml_view_2d(ctx, xxx, n_embd, n_tokens, xxx->nb[1], n_embd * n_tokens * 4 * sizeof(float));
96169616

96179617
struct ggml_tensor * xw = ggml_add(
96189618
ctx,
@@ -9681,7 +9681,7 @@ static struct ggml_tensor * llm_build_rwkv6_time_mix(
96819681
)
96829682
);
96839683

9684-
w = ggml_add(ctx, w, ggml_reshape_1d(ctx, layer->time_mix_decay, n_embed));
9684+
w = ggml_add(ctx, w, ggml_reshape_1d(ctx, layer->time_mix_decay, n_embd));
96859685
w = ggml_exp(ctx, ggml_neg(ctx, ggml_exp(ctx, w)));
96869686
w = ggml_reshape_4d(ctx, w, 1, head_size, head_count, n_tokens);
96879687

@@ -9690,21 +9690,21 @@ static struct ggml_tensor * llm_build_rwkv6_time_mix(
96909690
r = ggml_transpose(ctx, r);
96919691

96929692
struct ggml_tensor * wkv_output = ggml_rwkv_wkv(ctx, k, v, r, layer->time_mix_first, w, *wkv_state);
9693-
cur = ggml_view_1d(ctx, wkv_output, n_embed * n_tokens, 0);
9694-
*wkv_state = ggml_view_1d(ctx, wkv_output, n_embed * head_size * n_seqs, n_embed * n_tokens * sizeof(float));
9693+
cur = ggml_view_1d(ctx, wkv_output, n_embd * n_tokens, 0);
9694+
*wkv_state = ggml_view_1d(ctx, wkv_output, n_embd * head_size * n_seqs, n_embd * n_tokens * sizeof(float));
96959695

96969696
// group norm with head_count groups
9697-
cur = ggml_reshape_3d(ctx, cur, n_embed / head_count, head_count, n_tokens);
9697+
cur = ggml_reshape_3d(ctx, cur, n_embd / head_count, head_count, n_tokens);
96989698
cur = ggml_norm(ctx, cur, 64e-5f);
96999699

97009700
// Convert back to regular vectors.
9701-
cur = ggml_reshape_2d(ctx, cur, n_embed, n_tokens);
9701+
cur = ggml_reshape_2d(ctx, cur, n_embd, n_tokens);
97029702
cur = ggml_add(ctx, ggml_mul(ctx, cur, layer->time_mix_ln), layer->time_mix_ln_b);
97039703

97049704
cur = ggml_mul(ctx, cur, g);
97059705
cur = llm_build_lora_mm(lctx, ctx, layer->time_mix_output, cur);
97069706

9707-
return ggml_reshape_3d(ctx, cur, n_embed, n_seq_tokens, n_seqs);
9707+
return ggml_reshape_3d(ctx, cur, n_embd, n_seq_tokens, n_seqs);
97089708
}
97099709

97109710
static struct ggml_tensor * llm_build_rwkv6_channel_mix(

0 commit comments

Comments
 (0)