lamhieu commited on
Commit
a5f0652
1 Parent(s): 920b6cf

fix: update tokenizer config to support `add_generation_prompt=True` and clarify content

Browse files

Here I have updated it so that for each role it will return the correct tokens id of that role more clearly, trim the spaces and support `add_generation_prompt` config.

Files changed (1) hide show
  1. tokenizer_config.json +1 -1
tokenizer_config.json CHANGED
@@ -116,7 +116,7 @@
116
  }
117
  },
118
  "bos_token": "<s>",
119
- "chat_template": "{{ bos_token }}{% for message in messages %}{% if (message['role'] == 'user') %}{{'<|user|>' + '\n' + message['content'] + '<|end|>' + '\n' + '<|assistant|>' + '\n'}}{% elif (message['role'] == 'assistant') %}{{message['content'] + '<|end|>' + '\n'}}{% endif %}{% endfor %}",
120
  "clean_up_tokenization_spaces": false,
121
  "eos_token": "<|endoftext|>",
122
  "legacy": false,
 
116
  }
117
  },
118
  "bos_token": "<s>",
119
+ "chat_template": "{{ bos_token }}{% for message in messages %}\n{% set content = message['content'] | trim + '<|end|>' %}\n{% if message['role'] == 'user' %}\n{% set content = '<|user|>\n' + content %}\n{% elif message['role'] == 'assistant' %}\n{% set content = '<|assistant|>\n' + content %}\n{% endif %}\n{{ content }}\n{% if loop.last and add_generation_prompt %}\n{{ '<|assistant|>' }}\n{% endif %}\n{% endfor %}",
120
  "clean_up_tokenization_spaces": false,
121
  "eos_token": "<|endoftext|>",
122
  "legacy": false,