philperceptron commited on
Commit
efddf86
·
1 Parent(s): da577e8

HF generation markers

Browse files
Files changed (1) hide show
  1. chat_template.jinja +10 -4
chat_template.jinja CHANGED
@@ -67,12 +67,12 @@
67
  {%- endif %}
68
  {%- if loop.index0 > ns.last_query_index %}
69
  {%- if loop.last or (not loop.last and reasoning_content) %}
70
- {{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }}
71
  {%- else %}
72
- {{- '<|im_start|>' + message.role + '\n' + content }}
73
  {%- endif %}
74
  {%- else %}
75
- {{- '<|im_start|>' + message.role + '\n' + content }}
76
  {%- endif %}
77
  {%- if message.tool_calls %}
78
  {%- for tool_call in message.tool_calls %}
@@ -95,7 +95,13 @@
95
  {%- endif %}
96
  {{- '<|im_end|>\n' }}
97
  {%- else %}
98
- {{- render_block_turns(message.role, message.content) }}
 
 
 
 
 
 
99
  {%- if message.tool_calls %}
100
  {{- '<|im_start|>' + message.role + '\n' }}
101
  {%- for tool_call in message.tool_calls %}
 
67
  {%- endif %}
68
  {%- if loop.index0 > ns.last_query_index %}
69
  {%- if loop.last or (not loop.last and reasoning_content) %}
70
+ {{- '<|im_start|>' + message.role + '\n' }}{% generation %}{{- '<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }}{% endgeneration %}
71
  {%- else %}
72
+ {{- '<|im_start|>' + message.role + '\n' }}{% generation %}{{- content }}{% endgeneration %}
73
  {%- endif %}
74
  {%- else %}
75
+ {{- '<|im_start|>' + message.role + '\n' }}{% generation %}{{- content }}{% endgeneration %}
76
  {%- endif %}
77
  {%- if message.tool_calls %}
78
  {%- for tool_call in message.tool_calls %}
 
95
  {%- endif %}
96
  {{- '<|im_end|>\n' }}
97
  {%- else %}
98
+ {%- for content in message.content -%}
99
+ {%- if content['type'] == 'image' or 'image' in content or 'image_url' in content -%}
100
+ {{- '<|im_start|>' + message.role + '\n<image><|im_end|>\n' }}
101
+ {%- elif 'text' in content -%}
102
+ {{- '<|im_start|>' + message.role + '\n' }}{% generation %}{{- content['text'] }}{% endgeneration %}{{- '<|im_end|>\n' }}
103
+ {%- endif -%}
104
+ {%- endfor %}
105
  {%- if message.tool_calls %}
106
  {{- '<|im_start|>' + message.role + '\n' }}
107
  {%- for tool_call in message.tool_calls %}