Skip to content

Commit 2ffe10a

Browse files
committed
token healing : fix rebase bug
1 parent 5d8401c commit 2ffe10a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

common/sampling.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -568,8 +568,6 @@ static llama_token_data_array llama_sampling_prepare_impl(
568568
llama_sample_apply_guidance(ctx_main, logits, logits_guidance, params.cfg_scale);
569569
}
570570

571-
cur.resize(n_vocab);
572-
573571
// Constrain tokens based on the remaining token healing prefix (if any)
574572
const auto & th_prefix = ctx_sampling->token_healing_prefix;
575573
if (params.token_healing.enabled && !th_prefix.empty()) {
@@ -583,10 +581,12 @@ static llama_token_data_array llama_sampling_prepare_impl(
583581
}
584582

585583
// N.B. We could also set token constraints by setting rejected tokens' logits to -inf
584+
cur.clear();
586585
for (const llama_token token_id : th_candidates) {
587-
cur[token_id] = llama_token_data{token_id, logits[token_id], 0.0f};
586+
cur.emplace_back(llama_token_data{token_id, logits[token_id], 0.0f});
588587
}
589588
} else {
589+
cur.resize(n_vocab);
590590
for (llama_token token_id = 0; token_id < n_vocab; token_id++) {
591591
cur[token_id] = llama_token_data{token_id, logits[token_id], 0.0f};
592592
}

0 commit comments

Comments
 (0)