diff --git a/src/llama.cpp b/src/llama.cpp index 36c5e681f..8a53df14a 100644 --- a/src/llama.cpp +++ b/src/llama.cpp @@ -5103,6 +5103,7 @@ static void llm_load_vocab( } else if ( tokenizer_pre == "chatglm-bpe") { vocab.type_pre = LLAMA_VOCAB_PRE_TYPE_CHATGLM4; + vocab.special_bos_id = -1; } else if ( tokenizer_pre == "viking") { vocab.type_pre = LLAMA_VOCAB_PRE_TYPE_VIKING; @@ -19828,7 +19829,7 @@ static int32_t llama_chat_apply_template_internal( if (add_ass) { ss << "<|start_header_id|>assistant<|end_header_id|>\n\n"; } - } else if (tmpl == "chatglm3" || tmpl.find("[gMASK]sop") != std::string::npos) { + } else if (tmpl.find("chatglm3") != std::string::npos || tmpl.find("[gMASK]sop") != std::string::npos) { // chatglm3-6b ss << "[gMASK]" << "sop"; for (auto message : chat) { @@ -19838,7 +19839,7 @@ static int32_t llama_chat_apply_template_internal( if (add_ass) { ss << "<|assistant|>"; } - } else if (tmpl == "chatglm4" || tmpl.find("[gMASK]") != std::string::npos) { + } else if (tmpl.find("chatglm4") != std::string::npos || tmpl.find("[gMASK]") != std::string::npos) { ss << "[gMASK]" << ""; for (auto message : chat) { std::string role(message->role);