Qwen4Exp: add MTP (#29761)

* Qwen4Exp: add MTP

* remove has_state member, check via ctx_bufs being non-empty

* consistent naming + less verbose comments

* cont : clean-up recurrent memory

* cont : clean-up comments

---------

Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>
This commit is contained in:
Aman GuptaandGeorgi Gerganov authored and GitHub committed 2026-10-01 14:13:27 +03:00
1 parent 66e0c17ee1
commit c061df1983
13 files changed
+289 -55

No files matched your search

+9
View File
@@ -2709,6 +2709,15 @@ llama_memory_i * llama_model::create_memory(const llama_memory_params & params,
return il < hparams.n_layer() && !hparams.is_recr(il);
};
}
// the MTP draft context holds the MTP block alone: its attention and indexer, no recurrent layer
if (arch == LLM_ARCH_QWEN4EXP && params.ctx_type == LLAMA_CONTEXT_TYPE_MTP) {
filter_attn = [&](uint32_t il) { return il >= hparams.n_layer(); };
filter_recr = [&](uint32_t) { return false; };
if (filter_idx) {
filter_idx = [&](uint32_t il) { return il >= hparams.n_layer(); };
}
}
}
if (hparams.swa_type != LLAMA_SWA_TYPE_NONE) {