fix chat template bug
This commit is contained in:
parent
482bdeaa16
commit
bbe1926fac
1 changed files with 3 additions and 2 deletions
|
@ -5103,6 +5103,7 @@ static void llm_load_vocab(
|
||||||
} else if (
|
} else if (
|
||||||
tokenizer_pre == "chatglm-bpe") {
|
tokenizer_pre == "chatglm-bpe") {
|
||||||
vocab.type_pre = LLAMA_VOCAB_PRE_TYPE_CHATGLM4;
|
vocab.type_pre = LLAMA_VOCAB_PRE_TYPE_CHATGLM4;
|
||||||
|
vocab.special_bos_id = -1;
|
||||||
} else if (
|
} else if (
|
||||||
tokenizer_pre == "viking") {
|
tokenizer_pre == "viking") {
|
||||||
vocab.type_pre = LLAMA_VOCAB_PRE_TYPE_VIKING;
|
vocab.type_pre = LLAMA_VOCAB_PRE_TYPE_VIKING;
|
||||||
|
@ -19828,7 +19829,7 @@ static int32_t llama_chat_apply_template_internal(
|
||||||
if (add_ass) {
|
if (add_ass) {
|
||||||
ss << "<|start_header_id|>assistant<|end_header_id|>\n\n";
|
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
|
// chatglm3-6b
|
||||||
ss << "[gMASK]" << "sop";
|
ss << "[gMASK]" << "sop";
|
||||||
for (auto message : chat) {
|
for (auto message : chat) {
|
||||||
|
@ -19838,7 +19839,7 @@ static int32_t llama_chat_apply_template_internal(
|
||||||
if (add_ass) {
|
if (add_ass) {
|
||||||
ss << "<|assistant|>";
|
ss << "<|assistant|>";
|
||||||
}
|
}
|
||||||
} else if (tmpl == "chatglm4" || tmpl.find("[gMASK]<sop>") != std::string::npos) {
|
} else if (tmpl.find("chatglm4") != std::string::npos || tmpl.find("[gMASK]<sop>") != std::string::npos) {
|
||||||
ss << "[gMASK]" << "<sop>";
|
ss << "[gMASK]" << "<sop>";
|
||||||
for (auto message : chat) {
|
for (auto message : chat) {
|
||||||
std::string role(message->role);
|
std::string role(message->role);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue