From fc1e59bdf052b5d4c3be8e98c2051e641201ac79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sigbj=C3=B8rn=20Skj=C3=A6ret?= Date: Thu, 1 Jan 2026 23:04:07 +0100 Subject: [PATCH 1/2] remove modern-bert iswa template --- src/llama-model.cpp | 2 +- src/models/models.h | 1 - src/models/modern-bert.cpp | 11 ++--------- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/src/llama-model.cpp b/src/llama-model.cpp index c2cd44de448a..0450db6c9fa3 100644 --- a/src/llama-model.cpp +++ b/src/llama-model.cpp @@ -7457,7 +7457,7 @@ ggml_cgraph * llama_model::build_graph(const llm_graph_params & params) const { } break; case LLM_ARCH_MODERN_BERT: { - llm = std::make_unique>(*this, params); + llm = std::make_unique(*this, params); } break; case LLM_ARCH_NEO_BERT: { diff --git a/src/models/models.h b/src/models/models.h index e2cd4e484f79..e78a788d4bd0 100644 --- a/src/models/models.h +++ b/src/models/models.h @@ -332,7 +332,6 @@ struct llm_build_mistral3 : public llm_graph_context { llm_build_mistral3(const llama_model & model, const llm_graph_params & params); }; -template struct llm_build_modern_bert : public llm_graph_context { llm_build_modern_bert(const llama_model & model, const llm_graph_params & params); }; diff --git a/src/models/modern-bert.cpp b/src/models/modern-bert.cpp index c7809bdedfa8..90884463841d 100644 --- a/src/models/modern-bert.cpp +++ b/src/models/modern-bert.cpp @@ -1,7 +1,6 @@ #include "models.h" -template -llm_build_modern_bert::llm_build_modern_bert(const llama_model & model, const llm_graph_params & params) : llm_graph_context(params) { +llm_build_modern_bert::llm_build_modern_bert(const llama_model & model, const llm_graph_params & params) : llm_graph_context(params) { const int64_t n_embd_head = hparams.n_embd_head_v; const int64_t n_embd_gqa = hparams.n_embd_v_gqa(); @@ -24,13 +23,7 @@ llm_build_modern_bert::llm_build_modern_bert(const llama_model & model, co auto * inp_attn = build_attn_inp_no_cache(); for (int il = 0; il < n_layer; ++il) { - float freq_base_l = 0.0f; - - if constexpr (iswa) { - freq_base_l = model.get_rope_freq_base(cparams, il); - } else { - freq_base_l = freq_base; - } + float freq_base_l = model.get_rope_freq_base(cparams, il); cur = inpL; From bb6550e8f398977df5bf62fca9e503af8e3e543d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sigbj=C3=B8rn=20Skj=C3=A6ret?= Date: Thu, 1 Jan 2026 23:07:35 +0100 Subject: [PATCH 2/2] forgotten --- src/models/modern-bert.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/models/modern-bert.cpp b/src/models/modern-bert.cpp index 90884463841d..6df418ecda28 100644 --- a/src/models/modern-bert.cpp +++ b/src/models/modern-bert.cpp @@ -113,7 +113,3 @@ llm_build_modern_bert::llm_build_modern_bert(const llama_model & model, const ll res->t_embd = cur; ggml_build_forward_expand(gf, cur); } - -// Explicit template instantiations -template struct llm_build_modern_bert; -template struct llm_build_modern_bert;