Skip to content

Commit 5a5bce8

Browse files
fix: add sample acceptance
1 parent 07670a2 commit 5a5bce8

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

common/speculative.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,14 @@ llama_token mtp_speculative_gen_draft(
381381

382382
llama_token id = common_sampler_sample(smpl, ctx, last_tok_idx, true);
383383

384+
const auto * cur_p = common_sampler_get_candidates(smpl);
385+
for (int k = 0; k < std::min(3, (int)cur_p->size); ++k) {
386+
LOG_DBG(" - draft candidate %3d, pos %3d: %6d (%8.3f) '%s'\n",
387+
k, 0, cur_p->data[k].id, cur_p->data[k].p, common_token_to_piece(ctx, cur_p->data[k].id).c_str());
388+
}
389+
390+
common_sampler_accept(smpl, id, true);
391+
384392
llama_batch_free(batch);
385393

386394
return id;

0 commit comments

Comments
 (0)