File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -552,6 +552,17 @@ common_chat_templates_ptr common_chat_templates_init(
552
552
default_template_src = CHATML_TEMPLATE_SRC;
553
553
}
554
554
}
555
+
556
+ // TODO @ngxson : this is a temporary hack to prevent chat template from throwing an error
557
+ // Ref: https://github.com/ggml-org/llama.cpp/pull/15230#issuecomment-3173959633
558
+ if (default_template_src.find (" <|channel|>" ) != std::string::npos
559
+ // search for the error message and patch it
560
+ && default_template_src.find (" in message.content or" ) != std::string::npos) {
561
+ string_replace_all (default_template_src,
562
+ " {%- if \" <|channel|>analysis<|message|>\" in message.content or \" <|channel|>final<|message|>\" in message.content %}" ,
563
+ " {%- if false %}" );
564
+ }
565
+
555
566
std::string token_bos = bos_token_override;
556
567
std::string token_eos = eos_token_override;
557
568
bool add_bos = false ;
You can’t perform that action at this time.
0 commit comments