models : fix YaRN regression + consolidate logic (#18006)

* models : fix YaRN regression + consolidate logic

* cont : fix the fix

* cont : remove header

* cont : add header
This commit is contained in:
Georgi Gerganov
2025-12-14 08:34:56 +02:00
committed by GitHub
parent a63cbafbbc
commit 609a2d0268
6 changed files with 40 additions and 46 deletions
-11
View File
@@ -3,7 +3,6 @@
#include "ggml.h"
#include <cassert>
#include <cmath>
void llama_hparams::set_swa_pattern(uint32_t n_pattern, bool dense_first) {
if (dense_first) {
@@ -231,13 +230,3 @@ bool llama_hparams::is_masked_swa(uint32_t n_swa, llama_swa_type swa_type, llama
return false;
}
float llama_hparams::yarn_attn_factor_adjust(float attn_factor, float freq_scale, float ext_factor) {
GGML_ASSERT(ext_factor >= 0.0f);
if (ext_factor != 0.0f) {
attn_factor *= 1.0f / (1.0f + 0.1f * logf(1.0f / freq_scale));
}
return attn_factor;
}