File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -568,8 +568,6 @@ static llama_token_data_array llama_sampling_prepare_impl(
568
568
llama_sample_apply_guidance (ctx_main, logits, logits_guidance, params.cfg_scale );
569
569
}
570
570
571
- cur.resize (n_vocab);
572
-
573
571
// Constrain tokens based on the remaining token healing prefix (if any)
574
572
const auto & th_prefix = ctx_sampling->token_healing_prefix ;
575
573
if (params.token_healing .enabled && !th_prefix.empty ()) {
@@ -583,10 +581,12 @@ static llama_token_data_array llama_sampling_prepare_impl(
583
581
}
584
582
585
583
// N.B. We could also set token constraints by setting rejected tokens' logits to -inf
584
+ cur.clear ();
586
585
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 }) ;
588
587
}
589
588
} else {
589
+ cur.resize (n_vocab);
590
590
for (llama_token token_id = 0 ; token_id < n_vocab; token_id++) {
591
591
cur[token_id] = llama_token_data{token_id, logits[token_id], 0 .0f };
592
592
}
You can’t perform that action at this time.
0 commit comments