From d0b1053897655423f841716f0276e66886481d7b Mon Sep 17 00:00:00 2001 From: MaggotHATE Date: Wed, 9 Oct 2024 00:59:46 +0500 Subject: [PATCH] Fixed incorrect min_keep check --- src/llama-sampling.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/llama-sampling.cpp b/src/llama-sampling.cpp index b152c329a..afecff089 100644 --- a/src/llama-sampling.cpp +++ b/src/llama-sampling.cpp @@ -1109,7 +1109,7 @@ static void llama_sample_xtc_apply(struct llama_sampler * smpl, llama_token_data size_t to_remove = pos_last - (1 + pos_first); - if (to_remove < ctx->min_keep || to_remove < 1) return; + if (cur_p->size - to_remove < ctx->min_keep || to_remove < 1) return; for (size_t i = pos_first + 1; i < cur_p->size - to_remove + 1; ++i) { cur_p->data[i] = cur_p->data[i + to_remove];