Skip to content

Commit d23892e

Browse files
committed
clamp draft result to size to params.n_draft
1 parent 3afb556 commit d23892e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

common/speculative.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,9 @@ llama_tokens common_speculative_gen_draft(
354354
detokenized = replace_to_tgt(spec, detokenized);
355355
LOG_DBG("draft->main detokenized string: '%s'\n", detokenized.c_str());
356356
result = common_tokenize(ctx_tgt, detokenized, false, true);
357+
if (result.size() > (size_t)params.n_draft) {
358+
result.resize(params.n_draft);
359+
}
357360
}
358361
return result;
359362
}

0 commit comments

Comments
 (0)