Update run.cpp
This commit is contained in:
parent
a57bb94e29
commit
4daae0bfc7
1 changed files with 2 additions and 2 deletions
|
@ -720,14 +720,14 @@ static int apply_chat_template(const minja::chat_template & tmpl, LlamaData & ll
|
||||||
for (const auto & msg : llama_data.messages) {
|
for (const auto & msg : llama_data.messages) {
|
||||||
messages.push_back({
|
messages.push_back({
|
||||||
{"role", msg.role},
|
{"role", msg.role},
|
||||||
{ "content", msg.content}
|
{"content", msg.content},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
auto result = tmpl.apply(messages, /* tools= */ json(), append);
|
auto result = tmpl.apply(messages, /* tools= */ json(), append);
|
||||||
llama_data.fmtted.resize(result.size() + 1);
|
llama_data.fmtted.resize(result.size() + 1);
|
||||||
memcpy(llama_data.fmtted.data(), result.c_str(), result.size() + 1);
|
memcpy(llama_data.fmtted.data(), result.c_str(), result.size() + 1);
|
||||||
return llama_data.fmtted.size();
|
return result.size();
|
||||||
} catch (const std::exception & e) {
|
} catch (const std::exception & e) {
|
||||||
printe("failed to render the chat template: %s\n", e.what());
|
printe("failed to render the chat template: %s\n", e.what());
|
||||||
return -1;
|
return -1;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue