From 080749909e7e28a33775de8118d5faec8a9d3dfc Mon Sep 17 00:00:00 2001 From: ddh0 Date: Tue, 30 Dec 2025 15:47:14 -0600 Subject: [PATCH] minor style fixes no functional changes --- include/llama.h | 1 + src/llama-sampling.cpp | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/include/llama.h b/include/llama.h index 90f9045ef1..1de1a5f38d 100644 --- a/include/llama.h +++ b/include/llama.h @@ -1334,6 +1334,7 @@ extern "C" { /// @param seed RNG seed /// /// ref: https://github.com/ggml-org/llama.cpp/pull/17927 + /// LLAMA_API struct llama_sampler * llama_sampler_init_adaptive_p( float target, float decay, diff --git a/src/llama-sampling.cpp b/src/llama-sampling.cpp index 34910e56bf..553faa3c14 100644 --- a/src/llama-sampling.cpp +++ b/src/llama-sampling.cpp @@ -2346,7 +2346,9 @@ struct llama_sampler * llama_sampler_init_dry_testing(int32_t context_size, floa // of selected tokens, used to compute an adapted target at each sampling step. // // see llama.h for a full description of the sampler +// // ref: https://github.com/ggml-org/llama.cpp/pull/17927 +// struct llama_sampler_adaptive_p { const float target; // target probability (0.0 - 1.0; negative = disabled) const float decay; // EMA decay; history ~= 1/(1-decay) tokens (0.0 - 0.99) @@ -2414,12 +2416,12 @@ static void llama_sampler_adaptive_p_apply(struct llama_sampler * smpl, llama_to } static void llama_sampler_adaptive_p_reset(struct llama_sampler * smpl) { - auto * ctx = (llama_sampler_adaptive_p *) smpl->ctx; + auto * ctx = (llama_sampler_adaptive_p *) smpl->ctx; // ctx->target and ctx->decay never change after init, so it's safe to keep them as is. // original_probs is completely overwritten on every call to _apply. // so we only need to reset the EMA state. - ctx->weighted_sum = ctx->target / (1.0f - ctx->decay); - ctx->total_weight = 1.0f / (1.0f - ctx->decay); + ctx->weighted_sum = ctx->target / (1.0f - ctx->decay); + ctx->total_weight = 1.0f / (1.0f - ctx->decay); } static struct llama_sampler * llama_sampler_adaptive_p_clone(const struct llama_sampler * smpl) {