Skip to content

Commit d2969b8

Browse files
author
Olivier Chafik
committed
build common_chat_templates_ptr earlier
1 parent 7ddb454 commit d2969b8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

common/chat.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ common_chat_templates_ptr common_chat_templates_init(
411411
token_bos = get_token(llama_vocab_bos(vocab), "BOS", "bos_token");
412412
token_eos = get_token(llama_vocab_eos(vocab), "EOS", "eos_token");
413413
}
414-
auto * tmpls = new common_chat_templates();
414+
common_chat_templates_ptr tmpls(new common_chat_templates(), common_chat_templates_free);
415415
tmpls->has_explicit_template = has_explicit_template;
416416
try {
417417
tmpls->template_default = std::make_unique<minja::chat_template>(default_template_src, token_bos, token_eos);
@@ -426,7 +426,7 @@ common_chat_templates_ptr common_chat_templates_init(
426426
LOG_ERR("%s: failed to parse tool use chat template (ignoring it): %s\n", __func__, e.what());
427427
}
428428
}
429-
return {tmpls, common_chat_templates_free};
429+
return tmpls;
430430
}
431431

432432
std::string common_chat_format_name(common_chat_format format) {

0 commit comments

Comments
 (0)