Skip to content

Commit 450e47b

Browse files
committed
fix condition
1 parent c6bd7a7 commit 450e47b

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

common/common.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1618,13 +1618,12 @@ std::string common_get_builtin_chat_template(const struct llama_model * model) {
16181618
static const char * template_key = "tokenizer.chat_template";
16191619
// call with NULL buffer to get the total size of the string
16201620
int32_t res = llama_model_meta_val_str(model, template_key, NULL, 0);
1621-
if (res < 2) {
1622-
return "";
1623-
} else {
1621+
if (res > 0) {
16241622
std::vector<char> model_template(res + 1, 0);
16251623
llama_model_meta_val_str(model, template_key, model_template.data(), model_template.size());
16261624
return std::string(model_template.data(), model_template.size() - 1);
16271625
}
1626+
return "";
16281627
}
16291628

16301629
bool common_chat_verify_template(const std::string & tmpl) {

0 commit comments

Comments
 (0)