Files

23 lines
742 B
Diff

diff --git a/src/llama-chat.cpp b/src/llama-chat.cpp
index c83e6b5ba0d4..d08ce353a113 100644
--- a/src/llama-chat.cpp
+++ b/src/llama-chat.cpp
@@ -89,11 +89,17 @@ llm_chat_template llm_chat_template_from_str(const std::string & name) {
}
llm_chat_template llm_chat_detect_template(const std::string & tmpl) {
+#if 0
try {
return llm_chat_template_from_str(tmpl);
} catch (const std::out_of_range &) {
// ignore
}
+#endif
+ auto chat_template = LLM_CHAT_TEMPLATES.find(tmpl);
+ if (chat_template != LLM_CHAT_TEMPLATES.end()) {
+ return chat_template->second;
+ }
auto tmpl_contains = [&tmpl](const char * haystack) -> bool {
return tmpl.find(haystack) != std::string::npos;