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

Add chat template in tokenizer_config.json

Browse files

Add chat template in tokenizer_config.json so that we can use `tokenizer.apply_chat_template` for prompt templating

Files changed (1) hide show
  1. tokenizer_config.json +1 -0
tokenizer_config.json CHANGED
@@ -50,4 +50,5 @@
50
  "sp_model_kwargs": {},
51
  "tokenizer_class": "SEABPETokenizer",
52
  "unk_token": "<unk>"
 
53
  }
 
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 %}"
54
  }