mirror of
https://github.com/ikawrakow/ik_llama.cpp.git
synced 2026-08-12 14:24:03 +04:00
llama: pass rope freq factors to build_std_attention (#2291)
build_llama passes nullptr for the rope_factors_in argument, so rope_freqs.weight never reaches ggml_rope_ext and llama3 rope frequency scaling is not applied. The LLAMA_SPLIT_MODE_GRAPH branch inside build_std_attention falls back to model.layers[il].rope_freqs, so only the standard path is affected.
This commit is contained in:
@@ -46,18 +46,16 @@ ggml_cgraph * llm_build_context::build_llama() {
|
||||
int this_n_swa = this_KQ_mask == KQ_mask_swa ? hparams.n_swa : 0;
|
||||
|
||||
// rope freq factors for llama3; may return nullptr for llama2 and other models
|
||||
//auto rope_factors = build_rope_factors(il);
|
||||
auto rope_factors = build_rope_factors(il);
|
||||
|
||||
// self-attention
|
||||
if (use_rope) {
|
||||
cur = build_std_attention(gf, model.layers[il].attn_norm, inpL,
|
||||
inp_pos, il == n_layer - 1 && n_tokens > 1 ? inp_out_ids : nullptr, nullptr,
|
||||
inp_pos, il == n_layer - 1 && n_tokens > 1 ? inp_out_ids : nullptr, rope_factors,
|
||||
this_KQ_mask, nullptr, nullptr, kq_scale, hparams.f_attention_scale, this_n_swa, il, true, false, true);
|
||||
}
|
||||
else {
|
||||
|
||||
auto rope_factors = build_rope_factors(il);
|
||||
|
||||
// norm
|
||||
cur = llm_build_norm(ctx0, inpL, hparams, model.layers[il].attn_norm, NULL, LLM_NORM_RMS, cb, il);
|
||||
cb(cur, "attn_norm", il);
|
||||
|
||||
Reference in New Issue
Block a user