Rocketknight1 HF staff commited on
Commit
777d488
1 Parent(s): 953ffc4

Add chat template

Browse files

This PR adds a [chat template](https://huggingface.co/docs/transformers/main/chat_templating) following the ChatML format, which means users can just use `tokenizer.apply_chat_template` to handle chat formatting for them.

Files changed (1) hide show
  1. tokenizer_config.json +1 -0
tokenizer_config.json CHANGED
@@ -45,6 +45,7 @@
45
  },
46
  "additional_special_tokens": [],
47
  "bos_token": "<s>",
 
48
  "clean_up_tokenization_spaces": false,
49
  "eos_token": "<|im_end|>",
50
  "legacy": true,
 
45
  },
46
  "additional_special_tokens": [],
47
  "bos_token": "<s>",
48
+ "chat_template": "{% if not add_generation_prompt is defined %}{% set add_generation_prompt = false %}{% endif %}{% for message in messages %}{{'<|im_start|>' + message['role'] + '\n' + message['content'] + '<|im_end|>' + '\n'}}{% endfor %}{% if add_generation_prompt %}{{ '<|im_start|>assistant\n' }}{% endif %})",
49
  "clean_up_tokenization_spaces": false,
50
  "eos_token": "<|im_end|>",
51
  "legacy": true,