diff --git a/gpttype_adapter.cpp b/gpttype_adapter.cpp index 6c9900018..67ff62766 100644 --- a/gpttype_adapter.cpp +++ b/gpttype_adapter.cpp @@ -2758,7 +2758,7 @@ ModelLoadResult gpttype_load_model(const load_model_inputs inputs, FileFormat in printf("\nThis architecture has explicitly disabled the BOS token - if you need it, you must add it manually.\n"); add_bos_token = false; } - if (file_format == FileFormat::GGUF_GENERIC && file_format_meta.model_architecture == GGUFArch::ARCH_GLM4) { + if (file_format == FileFormat::GGUF_GENERIC && (file_format_meta.model_architecture == GGUFArch::ARCH_GLM4 || file_format_meta.model_architecture == GGUFArch::ARCH_DEEPSEEK2)) { std::string temp = gpttype_get_chat_template(); if (temp.find("[gMASK]") != std::string::npos) { printf("GLM-4 will have no automatic BOS token.\n"); @@ -3728,7 +3728,8 @@ generation_outputs gpttype_generate(const generation_inputs inputs) //need to add a cursed hack to improve coherency for GLM4, by ensuring injection for gmask, sop and an extra space //any complaints please direct them to henky - if (file_format == FileFormat::GGUF_GENERIC && file_format_meta.model_architecture == GGUFArch::ARCH_GLM4) { + //deepseek2 is actually used for glm 4.7 flash + if (file_format == FileFormat::GGUF_GENERIC && (file_format_meta.model_architecture == GGUFArch::ARCH_GLM4 || file_format_meta.model_architecture == GGUFArch::ARCH_DEEPSEEK2)) { std::string temp = gpttype_get_chat_template(); if (temp.find("[gMASK]") != std::string::npos) { if (addedmemory == "") { diff --git a/model_adapter.cpp b/model_adapter.cpp index 8a0260f8e..69793a220 100644 --- a/model_adapter.cpp +++ b/model_adapter.cpp @@ -404,6 +404,10 @@ std::string gguf_get_model_arch(const std::string & gguf_filename) { fileformatmeta->model_architecture = GGUFArch::ARCH_GLM4; } + else if(modelarch=="deepseek2") + { + fileformatmeta->model_architecture = GGUFArch::ARCH_DEEPSEEK2; + } else if(modelarch=="gpt-oss") { fileformatmeta->model_architecture = GGUFArch::ARCH_GPTOSS; diff --git a/model_adapter.h b/model_adapter.h index 506a912c8..98ee2f551 100644 --- a/model_adapter.h +++ b/model_adapter.h @@ -64,6 +64,7 @@ enum GGUFArch ARCH_GLM4 = 9, ARCH_GEMMA3N = 10, ARCH_GPTOSS = 11, + ARCH_DEEPSEEK2 = 12, }; struct FileFormatExtraMeta