Skip to content

Commit

Permalink
Merge pull request #3183 from alibaba/feature/bugfix
Browse files Browse the repository at this point in the history
LLM:Bugfix: Fix bug for use_template config not valid for response with
  • Loading branch information
jxt1234 authored Jan 28, 2025
2 parents e7c03f4 + c095d50 commit c282156
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions transformers/llm/engine/src/llm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,12 @@ std::string Llm::apply_chat_template(const std::vector<PromptItem>& chat_prompts
auto chat_template = config_->chat_template();
std::string prompt_result;
auto iter = chat_prompts.begin();
if (!config_->use_template()) {
for (; iter != chat_prompts.end(); ++iter) {
prompt_result += iter->second;
}
return prompt_result;
}
for (; iter != chat_prompts.end() - 1; ++iter) {
prompt_result += apply_template(chat_template, iter->second, iter->first);
}
Expand Down

0 comments on commit c282156

Please sign in to comment.