Tostino commited on
Commit
d36dcc7
1 Parent(s): bcba660

Update tokenizer_config.json chat template

Browse files

Update chat template to fix spacing and newlines, properly trim content, change the role names to `assistant`, and `user`.

Files changed (1) hide show
  1. tokenizer_config.json +1 -1
tokenizer_config.json CHANGED
@@ -37,7 +37,7 @@
37
  },
38
  "additional_special_tokens": [],
39
  "bos_token": "<s>",
40
- "chat_template": "<#meta#>\n- Date: {{ (messages|selectattr('role', 'equalto', 'meta-current_date')|list|last).content if (messages|selectattr('role', 'equalto', 'meta-current_date')|list) else '' }}\n- Task: {{ (messages|selectattr('role', 'equalto', 'meta-task_name')|list|last).content if (messages|selectattr('role', 'equalto', 'meta-task_name')|list) else '' }}\n<#system#>\n{{ (messages|selectattr('role', 'equalto', 'system')|list|last).content if (messages|selectattr('role', 'equalto', 'system')|list) else '' }}\n<#chat#>\n{% for message in messages %}\n {% if message['role'] == 'human' %}\n<#user#>\n{{ message['content'] }}\n {% elif message['role'] == 'ai' %}\n<#bot#>\n{{ message['content'] }}\n{% elif message['role'] == 'user_context' %}\n<#user_context#>\n{{ message['content'] }}\n{% endif %}\n{% endfor %}\n{% if add_generation_prompt or (messages[-1]['role'] == 'human' or messages[-1]['role'] == 'user_context') %}\n<#bot#>\n{% endif %}",
41
  "clean_up_tokenization_spaces": false,
42
  "eos_token": "</s>",
43
  "legacy": false,
 
37
  },
38
  "additional_special_tokens": [],
39
  "bos_token": "<s>",
40
+ "chat_template": "<#meta#>\n- Date: {{ (messages|selectattr('role', 'equalto', 'meta-current_date')|list|last).content|trim if (messages|selectattr('role', 'equalto', 'meta-current_date')|list) else '' }}\n- Task: {{ (messages|selectattr('role', 'equalto', 'meta-task_name')|list|last).content|trim if (messages|selectattr('role', 'equalto', 'meta-task_name')|list) else '' }}\n<#system#>\n{{ (messages|selectattr('role', 'equalto', 'system')|list|last).content|trim if (messages|selectattr('role', 'equalto', 'system')|list) else '' }}\n<#chat#>\n{% for message in messages %}\n{% if message['role'] == 'user' %}\n<#user#>\n{{ message['content']|trim -}}\n{% if not loop.last %}\n\n{% endif %}\n{% elif message['role'] == 'assistant' %}\n<#bot#>\n{{ message['content']|trim -}}\n{% if not loop.last %}\n\n{% endif %}\n{% elif message['role'] == 'user_context' %}\n<#user_context#>\n{{ message['content']|trim -}}\n{% if not loop.last %}\n\n{% endif %}\n{% endif %}\n{% endfor %}\n{% if add_generation_prompt and messages[-1]['role'] != 'assistant' %}\n<#bot#>\n{% endif %}",
41
  "clean_up_tokenization_spaces": false,
42
  "eos_token": "</s>",
43
  "legacy": false,