Update src/llama.cpp for not contain <|end|> or </s>

Co-authored-by: Xuan Son Nguyen <thichthat@gmail.com>
This commit is contained in:
piDack 2024-11-30 10:29:58 +08:00 committed by GitHub
parent 692880535a
commit 5ff563257c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -22085,7 +22085,7 @@ static int32_t llama_chat_apply_template_internal(
if (add_ass) {
ss << "<|assistant|>";
}
} else if(tmpl == "glm-edge" || tmpl_contains("<|assistant|>")){
} else if(tmpl == "glm-edge" || (tmpl_contains("<|assistant|>") && !tmpl_contains("<|end|>") && !tmpl_contains("</s>"))){
for (auto message : chat) {
std::string role(message->role);
ss << "<|" << role << "|>" << "\n" << message->content;