Say no to chat templates π ββοΈ (#26)
Browse files- Say no to chat templates π
ββοΈ (2c36c94aea99a50bf2c1b551f8905ef299b5694f)
Co-authored-by: Lewis Tunstall <[email protected]>
- tokenizer_config.json +1 -1
tokenizer_config.json
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
{
|
2 |
-
"chat_template": "{% if messages[0]['role'] == 'system' %}{% set loop_messages = messages[1:] %}{% set system_message = messages[0]['content'] %}{%
|
3 |
"add_bos_token": true,
|
4 |
"add_eos_token": false,
|
5 |
"bos_token": {
|
|
|
1 |
{
|
2 |
+
"chat_template": "{% if messages[0]['role'] == 'system' %}{% set loop_messages = messages[1:] %}{% set system_message = messages[0]['content'] %}{% else %}{% set loop_messages = messages %}{% set system_message = false %}{% endif %}{% for message in loop_messages %}{% if (message['role'] == 'user') != (loop.index0 % 2 == 0) %}{{ raise_exception('Conversation roles must alternate user/assistant/user/assistant/...') }}{% endif %}{% if loop.index0 == 0 and system_message != false %}{% set content = '<<SYS>>\\n' + system_message + '\\n<</SYS>>\\n\\n' + message['content'] %}{% else %}{% set content = message['content'] %}{% endif %}{% if message['role'] == 'user' %}{{ bos_token + '[INST] ' + content | trim + ' [/INST]' }}{% elif message['role'] == 'assistant' %}{{ ' ' + content | trim + ' ' + eos_token }}{% endif %}{% endfor %}",
|
3 |
"add_bos_token": true,
|
4 |
"add_eos_token": false,
|
5 |
"bos_token": {
|