chencyudel commited on
Commit
66677da
1 Parent(s): 1f77488

add chat template

Browse files
Files changed (1) hide show
  1. tokenizer_config.json +1 -0
tokenizer_config.json CHANGED
@@ -30,5 +30,6 @@
30
  },
31
  "sp_model_kwargs": {},
32
  "unk_token": null,
 
33
  "tokenizer_class": "LlamaTokenizerFast"
34
  }
 
30
  },
31
  "sp_model_kwargs": {},
32
  "unk_token": null,
33
+ "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' or message['role'] == 'human') != (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 = '<s>system\n' + system_message + '\n' %}{% else %}{% set content = '' %}{% endif %}{% if message['role'] == 'user' or message['role'] == 'human' %}{{ content + '<s>human\n' + message['content'] + '\n' }}{% elif message['role'] == 'assistant' or message['role'] == 'bot' %}{{ '<s>bot\n' + message['content'] + '\n' + eos_token + '\n'}}{% else %}{{ raise_exception('Only user/human and assistant/bot roles are supported!') }}{% endif %}{% endfor %}{% if add_generation_prompt %}{{ '<s>bot\n' }}{% endif %}"
34
  "tokenizer_class": "LlamaTokenizerFast"
35
  }