From 6b38b321170e1b1a3653fdbab9d1586dc8668e48 Mon Sep 17 00:00:00 2001 From: Meng Zhang Date: Wed, 4 Oct 2023 15:04:09 -0700 Subject: [PATCH] docs: add chat_template to model spec --- MODEL_SPEC.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/MODEL_SPEC.md b/MODEL_SPEC.md index 32cf371..59a387a 100644 --- a/MODEL_SPEC.md +++ b/MODEL_SPEC.md @@ -15,10 +15,11 @@ tokenizer.json This file provides meta information about the model. An example file appears as follows: -```js +```json { "auto_model": "AutoModelForCausalLM", - "prompt_template": "
{prefix}{suffix}"
+    "prompt_template": "
{prefix}{suffix}",
+    "chat_template":  "{% for message in messages %}{% if message['role'] == 'user' %}{{ '[INST] ' + message['content'] + ' [/INST]' }}{% elif message['role'] == 'assistant' %}{{ message['content'] + ' ' }}{% endif %}{% endfor %}",
 }
 ```
 
@@ -30,6 +31,8 @@ The **prompt_template** field is optional. When present, it is assumed that the
 
 One example for the **prompt_template** is `
{prefix}{suffix}`. In this format, `{prefix}` and `{suffix}` will be replaced with their corresponding values, and the entire prompt will be fed into the LLM.
 
+The **chat_template** field is optional. When it is present, it is assumed that the model supports an instruct/chat-style interaction, and can be passed to `--chat-model`.
+
 ### tokenizer.json
 This is the standard fast tokenizer file created using [Hugging Face Tokenizers](https://github.com/huggingface/tokenizers). Most Hugging Face models already come with it in repository.