fix condition
This commit is contained in:
parent
c6bd7a7aef
commit
450e47b2fb
1 changed files with 2 additions and 3 deletions
|
@ -1618,13 +1618,12 @@ std::string common_get_builtin_chat_template(const struct llama_model * model) {
|
|||
static const char * template_key = "tokenizer.chat_template";
|
||||
// call with NULL buffer to get the total size of the string
|
||||
int32_t res = llama_model_meta_val_str(model, template_key, NULL, 0);
|
||||
if (res < 2) {
|
||||
return "";
|
||||
} else {
|
||||
if (res > 0) {
|
||||
std::vector<char> model_template(res + 1, 0);
|
||||
llama_model_meta_val_str(model, template_key, model_template.data(), model_template.size());
|
||||
return std::string(model_template.data(), model_template.size() - 1);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
bool common_chat_verify_template(const std::string & tmpl) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue