Add MTP Support for Gemma 4 (#1744)

* gemma-mtp: build the arch to load the MTP model

* gemma-mtp: fix mtp kv state

* gemma-mtp: refactor some functions and create gguf

* gemma-mtp: make usable for embeddings models variant

* gemma-mtp: fix qwen mtp load in graph split

* gemma-mtp: refactor tensor creation and adjust output tensor handling

* Gemma 4 MTP: improve tensor handling, and adjust split mode logic
This commit is contained in:
Samuel Oliveira Alves
2026-05-10 07:44:20 +03:00
committed by GitHub
parent ab0f22b819
commit c2b8bca807
22 changed files with 1193 additions and 154 deletions
+5
View File
@@ -685,6 +685,11 @@ extern "C" {
LLAMA_API bool llama_model_has_recurrent(const struct llama_model * model);
// Returns true if the model is a Gemma 4 MTP assistant (external frozen-KV speculative drafter)
LLAMA_API bool llama_model_is_gemma4_mtp_assistant(const struct llama_model * model);
LLAMA_API bool llama_is_gemma4_mtp_file(const char * path);
LLAMA_API bool llama_model_is_split_mode_graph(const struct llama_model * model);
// Returns 0 on success