From 49cd2118e0f97d58f13d6a6dad091a288d65aba7 Mon Sep 17 00:00:00 2001 From: MaggotHATE Date: Fri, 4 Oct 2024 23:35:47 +0500 Subject: [PATCH] Moved `min_keep` Moved from conditions to a simple check at the end. --- src/llama-sampling.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/llama-sampling.cpp b/src/llama-sampling.cpp index 4372b40c3..d7a18e70e 100644 --- a/src/llama-sampling.cpp +++ b/src/llama-sampling.cpp @@ -1086,8 +1086,7 @@ static void llama_sample_xtc_apply(struct llama_sampler * smpl, llama_token_data || ctx->threshold >= 1.0f || ctx->threshold_max <= 0.0f || ctx->threshold_max <= ctx->threshold - || cur_p->size <= 2 - || ctx->min_keep <= 2) { + || cur_p->size <= 2) { return; } // chance is calculated on init and on each reset @@ -1116,6 +1115,8 @@ static void llama_sample_xtc_apply(struct llama_sampler * smpl, llama_token_data // resizing now that penalized tokens are at the back cur_p->size = cur_p->size - found + 1; + + if (cur_p->size < ctx->min_keep) cur_p->size = ctx->min_keep; } }