From 5cf355ebae76fd1bd98bb50d39ee189dbd31d9cc Mon Sep 17 00:00:00 2001 From: Xuan Son Nguyen Date: Mon, 4 Mar 2024 12:16:23 +0100 Subject: [PATCH] Updated Templates supported by llama_chat_apply_template (markdown) --- ...-supported-by-llama_chat_apply_template.md | 31 +++++++++++++------ 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/Templates-supported-by-llama_chat_apply_template.md b/Templates-supported-by-llama_chat_apply_template.md index 8775ad3..9611bbe 100644 --- a/Templates-supported-by-llama_chat_apply_template.md +++ b/Templates-supported-by-llama_chat_apply_template.md @@ -1,6 +1,6 @@ The `llama_chat_apply_template()` was added in [#5538](https://github.com/ggerganov/llama.cpp/pull/5538), which allows developers to format the chat into text prompt. By default, this function takes the template stored inside model's metadata `tokenizer.chat_template`. -To reduce the complexity of the implementation, we do **not** include a jinja parser in the project. This function works by matching the supplied template with a list of pre-defined templates hard-coded inside the function. +Please not that, we do **not** include a jinja parser in llama.cpp due to its complexity. Our implementation works by matching the supplied template with a list of pre-defined templates hard-coded inside the function. This is the list of templates currently supported by `llama_apply_chat_template`. If you found another template on huggingface that's not yet supported by llama.cpp, please feel free to open an issue: @@ -47,6 +47,7 @@ for variant in VARIANTS_TO_TEST: ``` +Usage: ./server -m ... --chat-template chatml teknium/OpenHermes-2.5-Mistral-7B <|im_start|>user hello<|im_end|> @@ -56,25 +57,34 @@ response<|im_end|> again<|im_end|> <|im_start|>assistant response<|im_end|> +``` ------------------------------- +``` +Usage: ./server -m ... --chat-template llama2 mistralai/Mistral-7B-Instruct-v0.2 [INST] hello [/INST]response[INST] again [/INST]response ------------------------------- +``` + +``` TheBloke/FusionNet_34Bx2_MoE-AWQ [INST] <> test <> hello [/INST] response [INST] again [/INST] response ------------------------------- +``` + +``` bofenghuang/vigogne-2-70b-chat [INST] <> test <> hello [/INST] response [INST] again [/INST] response ------------------------------- +``` + +``` +Usage: ./server -m ... --chat-template monarch mlabonne/AlphaMonarch-7B system test @@ -86,9 +96,11 @@ response again assistant response +``` ------------------------------- -Gemma +``` +Usage: ./server -m ... --chat-template gemma +google/gemma-7b-it user hello model @@ -97,13 +109,12 @@ response again model response - ------------------------------- ``` Additionally, we also support zephyr template (I cannot find it on huggingface, but have seen in [this list](https://github.com/ggerganov/llama.cpp/blob/c8d847d57efdc0f9bbbf881d48c645e151b36fd8/examples/server/public/promptFormats.js) ) ``` +Usage: ./server -m ... --chat-template zephyr <|system|> test<|endoftext|> <|user|> @@ -114,4 +125,4 @@ response<|endoftext|> again<|endoftext|> <|assistant|> response<|endoftext|> -``` \ No newline at end of file +```