mjschock commited on
Commit
0b2bf25
·
verified ·
1 Parent(s): 10b80cb

Add base model with custom chat template

Browse files
Files changed (1) hide show
  1. chat_template.jinja +4 -1
chat_template.jinja CHANGED
@@ -1,4 +1,7 @@
1
  <|im_start|>{% for message in messages %}{% if message['role'] == 'system' %}System: {% for line in message['content'] %}{% if line['type'] == 'text' %}{{line['text']}}{% endif %}{% endfor %}<|im_end|>
2
  {% elif message['role'] == 'tool' %}Tool: {% for line in message['content'] %}{% if line['type'] == 'text' %}{{line['text']}}{% endif %}{% endfor %}<end_of_utterance>
3
- {% else %}{{message['role'] | capitalize}}{% if message['content'][0]['type'] == 'image' %}{{':'}}{% else %}{% if message['role'] == 'assistant' and message['content'][0]['type'] == 'text' and message['content'][0]['text'].strip().startswith('<') %}{{':'}}{% else %}{{': '}}{% endif %}{% endif %}{% if message['role'] == 'assistant' %}{% generation %}{% for line in message['content'] %}{% if line['type'] == 'text' %}{{line['text']}}{% elif line['type'] == 'image' %}{{ '<image>' }}{% endif %}{% endfor %}{% endgeneration %}{% else %}{% for line in message['content'] %}{% if line['type'] == 'text' %}{{line['text']}}{% elif line['type'] == 'image' %}{{ '<image>' }}{% endif %}{% endfor %}{% endif %}<end_of_utterance>
 
 
 
4
  {% endif %}{% endfor %}{% if add_generation_prompt %}{{ 'Assistant:' }}{% endif %}
 
1
  <|im_start|>{% for message in messages %}{% if message['role'] == 'system' %}System: {% for line in message['content'] %}{% if line['type'] == 'text' %}{{line['text']}}{% endif %}{% endfor %}<|im_end|>
2
  {% elif message['role'] == 'tool' %}Tool: {% for line in message['content'] %}{% if line['type'] == 'text' %}{{line['text']}}{% endif %}{% endfor %}<end_of_utterance>
3
+ {% elif message['role'] == 'assistant' and message.get('tool_calls') %}{{message['role'] | capitalize}}: {% for line in message['content'] %}{% if line['type'] == 'text' %}{{line['text']}}{% elif line['type'] == 'image' %}{{ '<image>' }}{% endif %}{% endfor %}{% if message['tool_calls'] %}<tool_calls>
4
+ {% for tool_call in message['tool_calls'] %}{"id": "{{tool_call['id']}}", "type": "{{tool_call['type']}}", "function": {"name": "{{tool_call['function']['name']}}", "arguments": "{{tool_call['function']['arguments']}}"}}
5
+ {% endfor %}</tool_calls>{% endif %}<end_of_utterance>
6
+ {% else %}{{message['role'] | capitalize}}{% if message['content'][0]['type'] == 'image' %}{{':'}}{% else %}{{': '}}{% endif %}{% if message['role'] == 'assistant' %}{% generation %}{% for line in message['content'] %}{% if line['type'] == 'text' %}{{line['text']}}{% elif line['type'] == 'image' %}{{ '<image>' }}{% endif %}{% endfor %}{% endgeneration %}{% else %}{% for line in message['content'] %}{% if line['type'] == 'text' %}{{line['text']}}{% elif line['type'] == 'image' %}{{ '<image>' }}{% endif %}{% endfor %}{% endif %}<end_of_utterance>
7
  {% endif %}{% endfor %}{% if add_generation_prompt %}{{ 'Assistant:' }}{% endif %}