@@ -5200,7 +5200,6 @@ bool llama_model::load_tensors(llama_model_loader & ml) {
52005200
52015201 for (int i = 0; i < n_layer; ++i) {
52025202 auto & layer = layers[i];
5203- const int64_t n_ff_cur = hparams.n_ff_arr[i];
52045203
52055204 layer.attn_norm = create_tensor(tn(LLM_TENSOR_ATTN_NORM, "weight", i), { n_embd }, 0);
52065205
@@ -5220,16 +5219,10 @@ bool llama_model::load_tensors(llama_model_loader & ml) {
52205219
52215220 // MoE branch
52225221 const int64_t n_ff_exp = hparams.n_ff_exp;
5223- if (n_ff_exp == n_ff_cur) {
5224- layer.ffn_gate_inp = create_tensor(tn(LLM_TENSOR_FFN_GATE_INP, "weight", i), { n_embd, n_expert }, 0);
5225- layer.ffn_gate_exps = create_tensor(tn(LLM_TENSOR_FFN_GATE_EXPS, "weight", i), { n_embd, n_ff_exp, n_expert }, 0);
5226- layer.ffn_down_exps = create_tensor(tn(LLM_TENSOR_FFN_DOWN_EXPS, "weight", i), { n_ff_exp, n_embd, n_expert }, 0);
5227- layer.ffn_up_exps = create_tensor(tn(LLM_TENSOR_FFN_UP_EXPS, "weight", i), { n_embd, n_ff_exp, n_expert }, 0);
5228- } else {
5229- layer.ffn_gate = create_tensor(tn(LLM_TENSOR_FFN_GATE, "weight", i), { n_embd, n_ff_cur }, 0);
5230- layer.ffn_down = create_tensor(tn(LLM_TENSOR_FFN_DOWN, "weight", i), { n_ff_cur,n_embd }, 0);
5231- layer.ffn_up = create_tensor(tn(LLM_TENSOR_FFN_UP, "weight", i), { n_embd, n_ff_cur }, 0);
5232- }
5222+ layer.ffn_gate_inp = create_tensor(tn(LLM_TENSOR_FFN_GATE_INP, "weight", i), { n_embd, n_expert }, 0);
5223+ layer.ffn_gate_exps = create_tensor(tn(LLM_TENSOR_FFN_GATE_EXPS, "weight", i), { n_embd, n_ff_exp, n_expert }, 0);
5224+ layer.ffn_down_exps = create_tensor(tn(LLM_TENSOR_FFN_DOWN_EXPS, "weight", i), { n_ff_exp, n_embd, n_expert }, 0);
5225+ layer.ffn_up_exps = create_tensor(tn(LLM_TENSOR_FFN_UP_EXPS, "weight", i), { n_embd, n_ff_exp, n_expert }, 0);
52335226 }
52345227 } break;
52355228 default:
@@ -17134,7 +17127,7 @@ struct llm_build_smallthinker : public llm_graph_context{
1713417127 Kcur = ggml_reshape_3d(ctx0, Kcur, n_embd_head, n_head_kv, n_tokens);
1713517128 Vcur = ggml_reshape_3d(ctx0, Vcur, n_embd_head, n_head_kv, n_tokens);
1713617129
17137- if(il % hparams.n_no_rope_layer_step) {
17130+ if(hparams.n_no_rope_layer_step == n_layer || il % hparams.n_no_rope_layer_step != 0 ) {
1713817131 Qcur = ggml_rope_ext(ctx0, Qcur, inp_pos, nullptr, n_rot, rope_type, n_ctx_orig, freq_base, freq_scale,
1713917132 ext_factor, attn_factor, beta_fast, beta_slow);
1714017133
0 commit comments