From b27f87d6da0c95a41ea5b0ec7ecd4aa4bc82f95f Mon Sep 17 00:00:00 2001 From: mare5x Date: Mon, 8 Jul 2024 16:18:19 +0200 Subject: [PATCH] token healing : fix rebase bug --- common/sampling.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/sampling.cpp b/common/sampling.cpp index e9f828bef..a999b908c 100644 --- a/common/sampling.cpp +++ b/common/sampling.cpp @@ -568,8 +568,6 @@ static llama_token_data_array llama_sampling_prepare_impl( llama_sample_apply_guidance(ctx_main, logits, logits_guidance, params.cfg_scale); } - cur.resize(n_vocab); - // Constrain tokens based on the remaining token healing prefix (if any) const auto & th_prefix = ctx_sampling->token_healing_prefix; if (params.token_healing.enabled && !th_prefix.empty()) { @@ -583,10 +581,12 @@ static llama_token_data_array llama_sampling_prepare_impl( } // N.B. We could also set token constraints by setting rejected tokens' logits to -inf + cur.clear(); for (const llama_token token_id : th_candidates) { - cur[token_id] = llama_token_data{token_id, logits[token_id], 0.0f}; + cur.emplace_back(llama_token_data{token_id, logits[token_id], 0.0f}); } } else { + cur.resize(n_vocab); for (llama_token token_id = 0; token_id < n_vocab; token_id++) { cur[token_id] = llama_token_data{token_id, logits[token_id], 0.0f}; }