djuna commited on
Commit
afa34f8
1 Parent(s): bf671ab

Allow system prompt

Browse files
Files changed (1) hide show
  1. tokenizer_config.json +2 -2
tokenizer_config.json CHANGED
@@ -1744,10 +1744,10 @@
1744
  "<end_of_turn>"
1745
  ],
1746
  "bos_token": "<bos>",
1747
- "chat_template": "{{ bos_token }}{% if messages[0]['role'] == 'system' %}{{ raise_exception('System role not supported') }}{% endif %}{% for message in messages %}{% if (message['role'] == 'user') != (loop.index0 % 2 == 0) %}{{ raise_exception('Conversation roles must alternate user/assistant/user/assistant/...') }}{% endif %}{% if (message['role'] == 'assistant') %}{% set role = 'model' %}{% else %}{% set role = message['role'] %}{% endif %}{{ '<start_of_turn>' + role + '\n' + message['content'] | trim + '<end_of_turn>\n' }}{% endfor %}{% if add_generation_prompt %}{{'<start_of_turn>model\n'}}{% endif %}",
1748
  "clean_up_tokenization_spaces": false,
1749
  "eos_token": "<eos>",
1750
- "model_max_length": 2048,
1751
  "pad_token": "<pad>",
1752
  "sp_model_kwargs": {},
1753
  "spaces_between_special_tokens": false,
 
1744
  "<end_of_turn>"
1745
  ],
1746
  "bos_token": "<bos>",
1747
+ "chat_template": "{{ bos_token }}{% for message in messages %}{% set system_adjust = 0 if loop.index0 == 0 and message['role'] != 'system' else 0 %}{% if loop.index0 == 0 and message['role'] == 'system' %}{{ '<start_of_turn>user\n'+message['content'] | trim +'\n'}}{% if messages | length > 1 and messages[1]['role'] == 'user' %}{{ messages[1]['content'] | trim }}{% elif messages | length > 1 %}{{ raise_exception('Error: Expected user role after system role.') }}{% endif %}{{ '<end_of_turn>\n' }}{% elif loop.index0 == 1 and message['role'] == 'user' and messages[0]['role'] == 'system' %}{% else %}{% set role = 'model' if message['role'] == 'assistant' else message['role'] %}{% if loop.index0 <= 1 or messages[loop.index0 - 1]['role'] != role %}{{ '<start_of_turn>' }}{{ role }}{{ '\n'+message['content'] | trim }}{{ '<end_of_turn>'+'\n' }}{% elif loop.index0 > 1 %}{{ raise_exception('Error: Consecutive messages with the same role are not allowed.') }}{% endif %}{% endif %}{% endfor %}{% if add_generation_prompt %}{{'<start_of_turn>model'}}{% endif %}",
1748
  "clean_up_tokenization_spaces": false,
1749
  "eos_token": "<eos>",
1750
+ "model_max_length": 1048576,
1751
  "pad_token": "<pad>",
1752
  "sp_model_kwargs": {},
1753
  "spaces_between_special_tokens": false,