Commit 288115043 for llama.cpp
commit 2881150433e320c3167fd54745d37b993863da2c
Author: anujj <ajalota@nvidia.com>
Date: Sat Nov 28 15:39:28 2026 +0530
model : expand Inkling 2 tau after embeddings (#33186)
* model : inkling2 expand tau after the embeddings
* model : build inkling2 embeddings before tau
diff --git a/src/models/inkling2.cpp b/src/models/inkling2.cpp
index 25d4df7c0..4ccc84694 100644
--- a/src/models/inkling2.cpp
+++ b/src/models/inkling2.cpp
@@ -279,12 +279,6 @@ ggml_tensor * llama_model_inkling2::graph::build_inputs() {
ggml_tensor * inp_pos = build_inp_pos();
inp_out_ids = build_inp_out_ids();
- // log-scaled positions: 1 + alpha*log(max(1, (pos + 1)/floor)), multiplies q and r of the full-attention layers
- tau = ggml_scale_bias(ctx0, ggml_cast(ctx0, inp_pos, GGML_TYPE_F32), 1.0f, 1.0f);
- tau = ggml_log(ctx0, ggml_clamp(ctx0, ggml_scale(ctx0, tau, 1.0f/hparams.n_log_scale_floor), 1.0f, INFINITY));
- tau = ggml_reshape_3d(ctx0, ggml_scale_bias(ctx0, tau, hparams.f_log_scale_alpha, 1.0f), 1, 1, n_tokens);
- ggml_build_forward_expand(gf, tau);
-
ggml_tensor * cur = build_inp_embd(model.tok_embd);
// important: do not normalize raw embeddings input (i.e. encoded image embeddings)
@@ -292,6 +286,12 @@ ggml_tensor * llama_model_inkling2::graph::build_inputs() {
cur = build_norm(cur, model.tok_norm, nullptr, LLM_NORM_RMS, -1);
}
+ // log-scaled positions: 1 + alpha*log(max(1, (pos + 1)/floor)), multiplies q and r of the full-attention layers
+ tau = ggml_scale_bias(ctx0, ggml_cast(ctx0, inp_pos, GGML_TYPE_F32), 1.0f, 1.0f);
+ tau = ggml_log(ctx0, ggml_clamp(ctx0, ggml_scale(ctx0, tau, 1.0f/hparams.n_log_scale_floor), 1.0f, INFINITY));
+ tau = ggml_reshape_3d(ctx0, ggml_scale_bias(ctx0, tau, hparams.f_log_scale_alpha, 1.0f), 1, 1, n_tokens);
+ ggml_build_forward_expand(gf, tau);
+
return cur;
}