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(
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 }
You can’t perform that action at this time.
0 commit comments