@@ -3263,28 +3263,28 @@ generation_outputs gpttype_generate(const generation_inputs inputs)
32633263 }
32643264
32653265 // need to add a cursed hack to get coherency for GLM4, by ensuring injection for both sop and gmask
3266- if (file_format == FileFormat::GGUF_GENERIC && file_format_meta.model_architecture == GGUFArch::ARCH_GLM4) {
3267- std::string temp = gpttype_get_chat_template ();
3268- if (temp.find (" [gMASK]<sop>" ) != std::string::npos) {
3269- if (addedmemory == " " ) {
3270- if (kcpp_data->prompt .rfind (" [gMASK]" , 0 ) == 0 ) { // check startswith
3271- kcpp_data->prompt .erase (0 , 7 );
3272- }
3273- if (kcpp_data->prompt .rfind (" <sop>" , 0 ) == 0 ) { // check startswith
3274- kcpp_data->prompt .erase (0 , 5 );
3275- }
3276- addedmemory = " [gMASK]<sop>" ;
3277- } else {
3278- if (addedmemory.rfind (" [gMASK]" , 0 ) == 0 ) { // check startswith
3279- addedmemory.erase (0 , 7 );
3280- }
3281- if (addedmemory.rfind (" <sop>" , 0 ) == 0 ) { // check startswith
3282- addedmemory.erase (0 , 5 );
3283- }
3284- addedmemory = " [gMASK]<sop>" + addedmemory;
3285- }
3286- }
3287- }
3266+ // if (file_format == FileFormat::GGUF_GENERIC && file_format_meta.model_architecture == GGUFArch::ARCH_GLM4) {
3267+ // std::string temp = gpttype_get_chat_template();
3268+ // if (temp.find("[gMASK]<sop>") != std::string::npos) {
3269+ // if (addedmemory == "") {
3270+ // if (kcpp_data->prompt.rfind("[gMASK]", 0) == 0) { //check startswith
3271+ // kcpp_data->prompt.erase(0, 7);
3272+ // }
3273+ // if (kcpp_data->prompt.rfind("<sop>", 0) == 0) { //check startswith
3274+ // kcpp_data->prompt.erase(0, 5);
3275+ // }
3276+ // addedmemory = "[gMASK]<sop>";
3277+ // } else {
3278+ // if (addedmemory.rfind("[gMASK]", 0) == 0) { //check startswith
3279+ // addedmemory.erase(0, 7);
3280+ // }
3281+ // if (addedmemory.rfind("<sop>", 0) == 0) { //check startswith
3282+ // addedmemory.erase(0, 5);
3283+ // }
3284+ // addedmemory = "[gMASK]<sop>" + addedmemory;
3285+ // }
3286+ // }
3287+ // }
32883288
32893289 bool stream_sse = inputs.stream_sse ;
32903290 bool allow_regular_prints = (!is_quiet && debugmode!=-1 );
0 commit comments