Skip to content

Commit ed5fbaf

Browse files
danbevarthw
authored andcommitted
llama : rename n_embed to n_embd in rwkv6_time_mix (ggml-org#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 5fe91d5 commit ed5fbaf

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
@@ -9575,7 +9575,7 @@ static struct ggml_tensor * llm_build_rwkv6_time_mix(
95759575
struct ggml_tensor * cur,
95769576
struct ggml_tensor * x_prev,
95779577
struct ggml_tensor ** wkv_state) {
9578-
size_t n_embed = cur->ne[0];
9578+
size_t n_embd = cur->ne[0];
95799579
size_t n_seq_tokens = cur->ne[1];
95809580
size_t n_seqs = cur->ne[2];
95819581

@@ -9586,8 +9586,8 @@ static struct ggml_tensor * llm_build_rwkv6_time_mix(
95869586

95879587
struct ggml_tensor * sx = ggml_sub(ctx, x_prev, cur);
95889588

9589-
sx = ggml_reshape_2d(ctx, sx, n_embed, n_tokens);
9590-
cur = ggml_reshape_2d(ctx, cur, n_embed, n_tokens);
9589+
sx = ggml_reshape_2d(ctx, sx, n_embd, n_tokens);
9590+
cur = ggml_reshape_2d(ctx, cur, n_embd, n_tokens);
95919591

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

@@ -9612,11 +9612,11 @@ static struct ggml_tensor * llm_build_rwkv6_time_mix(
96129612
xxx
96139613
);
96149614

9615-
struct ggml_tensor *mw = ggml_view_2d(ctx, xxx, n_embed, n_tokens, xxx->nb[1], 0);
9616-
struct ggml_tensor *mk = ggml_view_2d(ctx, xxx, n_embed, n_tokens, xxx->nb[1], n_embed * n_tokens * sizeof(float));
9617-
struct ggml_tensor *mv = ggml_view_2d(ctx, xxx, n_embed, n_tokens, xxx->nb[1], n_embed * n_tokens * 2 * sizeof(float));
9618-
struct ggml_tensor *mr = ggml_view_2d(ctx, xxx, n_embed, n_tokens, xxx->nb[1], n_embed * n_tokens * 3 * sizeof(float));
9619-
struct ggml_tensor *mg = ggml_view_2d(ctx, xxx, n_embed, n_tokens, xxx->nb[1], n_embed * n_tokens * 4 * sizeof(float));
9615+
struct ggml_tensor *mw = ggml_view_2d(ctx, xxx, n_embd, n_tokens, xxx->nb[1], 0);
9616+
struct ggml_tensor *mk = ggml_view_2d(ctx, xxx, n_embd, n_tokens, xxx->nb[1], n_embd * n_tokens * sizeof(float));
9617+
struct ggml_tensor *mv = ggml_view_2d(ctx, xxx, n_embd, n_tokens, xxx->nb[1], n_embd * n_tokens * 2 * sizeof(float));
9618+
struct ggml_tensor *mr = ggml_view_2d(ctx, xxx, n_embd, n_tokens, xxx->nb[1], n_embd * n_tokens * 3 * sizeof(float));
9619+
struct ggml_tensor *mg = ggml_view_2d(ctx, xxx, n_embd, n_tokens, xxx->nb[1], n_embd * n_tokens * 4 * sizeof(float));
96209620

96219621
struct ggml_tensor * xw = ggml_add(
96229622
ctx,
@@ -9685,7 +9685,7 @@ static struct ggml_tensor * llm_build_rwkv6_time_mix(
96859685
)
96869686
);
96879687

9688-
w = ggml_add(ctx, w, ggml_reshape_1d(ctx, layer->time_mix_decay, n_embed));
9688+
w = ggml_add(ctx, w, ggml_reshape_1d(ctx, layer->time_mix_decay, n_embd));
96899689
w = ggml_exp(ctx, ggml_neg(ctx, ggml_exp(ctx, w)));
96909690
w = ggml_reshape_4d(ctx, w, 1, head_size, head_count, n_tokens);
96919691

@@ -9694,21 +9694,21 @@ static struct ggml_tensor * llm_build_rwkv6_time_mix(
96949694
r = ggml_transpose(ctx, r);
96959695

96969696
struct ggml_tensor * wkv_output = ggml_rwkv_wkv(ctx, k, v, r, layer->time_mix_first, w, *wkv_state);
9697-
cur = ggml_view_1d(ctx, wkv_output, n_embed * n_tokens, 0);
9698-
*wkv_state = ggml_view_1d(ctx, wkv_output, n_embed * head_size * n_seqs, n_embed * n_tokens * sizeof(float));
9697+
cur = ggml_view_1d(ctx, wkv_output, n_embd * n_tokens, 0);
9698+
*wkv_state = ggml_view_1d(ctx, wkv_output, n_embd * head_size * n_seqs, n_embd * n_tokens * sizeof(float));
96999699

97009700
// group norm with head_count groups
9701-
cur = ggml_reshape_3d(ctx, cur, n_embed / head_count, head_count, n_tokens);
9701+
cur = ggml_reshape_3d(ctx, cur, n_embd / head_count, head_count, n_tokens);
97029702
cur = ggml_norm(ctx, cur, 64e-5f);
97039703

97049704
// Convert back to regular vectors.
9705-
cur = ggml_reshape_2d(ctx, cur, n_embed, n_tokens);
9705+
cur = ggml_reshape_2d(ctx, cur, n_embd, n_tokens);
97069706
cur = ggml_add(ctx, ggml_mul(ctx, cur, layer->time_mix_ln), layer->time_mix_ln_b);
97079707

97089708
cur = ggml_mul(ctx, cur, g);
97099709
cur = llm_build_lora_mm(lctx, ctx, layer->time_mix_output, cur);
97109710

9711-
return ggml_reshape_3d(ctx, cur, n_embed, n_seq_tokens, n_seqs);
9711+
return ggml_reshape_3d(ctx, cur, n_embd, n_seq_tokens, n_seqs);
97129712
}
97139713

97149714
static struct ggml_tensor * llm_build_rwkv6_channel_mix(

0 commit comments

Comments
 (0)