mirror of
https://github.com/ikawrakow/ik_llama.cpp.git
synced 2026-08-12 22:29:39 +04:00
fix: adjust token count for MTP draft generation in kv cache update (#2181)
This commit is contained in:
@@ -6949,6 +6949,10 @@ static int32_t llama_kv_cache_update_internal(struct llama_context & lctx) {
|
||||
// TODO: extract to a function
|
||||
// build worst-case graph
|
||||
int n_tokens = (int)std::min(lctx.cparams.n_ctx, lctx.cparams.n_ubatch);
|
||||
// MTP draft generation consumes one token and one hidden-state vector per decode step.
|
||||
if (lctx.cparams.mtp_op_type == MTP_OP_DRAFT_GEN) {
|
||||
n_tokens = 1;
|
||||
}
|
||||
int n_past = lctx.cparams.n_ctx - n_tokens;
|
||||
llama_token token = llama_token_bos(&lctx.model); // not actually used by llama_build_graph, but required to choose between token and embedding inputs graph
|
||||
llama_batch reserve_batch = llama_batch_get_one(&token, n_tokens, n_past, 0);
|
||||
|
||||
Reference in New Issue
Block a user