xianbin jahhs0n commited on
Commit
d7d187c
1 Parent(s): 566afff

Add chat template in tokenizer_config.json (#8)

Browse files

- Add chat template in tokenizer_config.json (b667b1c6a155ca1f56eee248a824190ce08c2987)
- Fix typo in chat template (52168f920c7d1ed06519d0302845a1bdf17624c6)


Co-authored-by: jason <jahhs0n@users.noreply.huggingface.co>

Files changed (1) hide show
  1. tokenizer_config.json +2 -1
tokenizer_config.json CHANGED
@@ -49,5 +49,6 @@
49
  "pad_token": "<|padding|>",
50
  "sp_model_kwargs": {},
51
  "tokenizer_class": "SEABPETokenizer",
52
- "unk_token": "<unk>"
 
53
  }
 
49
  "pad_token": "<|padding|>",
50
  "sp_model_kwargs": {},
51
  "tokenizer_class": "SEABPETokenizer",
52
+ "unk_token": "<unk>",
53
+ "chat_template": "{% 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'] == 'user' %}### USER:\n{{ message['content'] + '\n\n' }}{% elif message['role'] == 'assistant' %}### RESPONSE:\n{{ message['content'] + '\n\n' }}{% else %}{{ raise_exception('Only user and assistant roles are supported!') }}{% endif %}{% endfor %}{% if add_generation_prompt %}### RESPONSE:\n{% endif %}"
54
  }