danielhanchen commited on
Commit
3dad819
·
verified ·
1 Parent(s): e4fb4db

Update chat_template.jinja

Browse files
Files changed (1) hide show
  1. chat_template.jinja +12 -3
chat_template.jinja CHANGED
@@ -1,6 +1,10 @@
 
1
  {%- set thinking_prompt = 'You are a deep thinking AI, you may use extremely long chains of thought to deeply consider the problem and deliberate with yourself via systematic reasoning processes to help come to a correct solution prior to answering. You should enclose your thoughts and internal monologue inside <think> </think> tags, and then provide your solution or response to the problem.' %}
2
  {%- set standard_prompt = 'You are Hermes, created by Nous Research.' %}
3
- {%- if not thinking is defined %}{% set thinking = false %}{% endif %}
 
 
 
4
  {%- if not keep_cots is defined %}{% set keep_cots = false %}{% endif %}
5
  {%- if thinking %}{%- set system_prompt = thinking_prompt %}{%- else %}{%- set system_prompt = standard_prompt %}{%- endif %}
6
  {%- if tools %}
@@ -32,7 +36,9 @@
32
  {%- set content = message['content'] -%}
33
  {%- if thinking %}
34
  {%- if not keep_cots %}
35
- {%- set content = '<think> </think>' + content.split('</think>', 1)[1] -%}
 
 
36
  {%- endif %}
37
  {%- endif %}
38
  {{- '\n' + content + '<|eot_id|>' }}
@@ -43,7 +49,9 @@
43
  {%- set content = message['content'] -%}
44
  {%- if thinking %}
45
  {%- if not keep_cots %}
46
- {%- set content = '<think> </think>' + content.split('</think>', 1)[1] -%}
 
 
47
  {%- endif %}
48
  {%- endif %}
49
  {{- '\n' + content }}
@@ -74,3 +82,4 @@
74
  {%- if add_generation_prompt %}
75
  {{- '<|start_header_id|>assistant<|end_header_id|>\n\n' }}
76
  {%- endif %}
 
 
1
+ {#- Unsloth template fixes #}
2
  {%- set thinking_prompt = 'You are a deep thinking AI, you may use extremely long chains of thought to deeply consider the problem and deliberate with yourself via systematic reasoning processes to help come to a correct solution prior to answering. You should enclose your thoughts and internal monologue inside <think> </think> tags, and then provide your solution or response to the problem.' %}
3
  {%- set standard_prompt = 'You are Hermes, created by Nous Research.' %}
4
+ {%- if enable_thinking is defined and enable_thinking is false %}{% set thinking = false %}
5
+ {%- elif enable_thinking is defined and enable_thinking is true %}{% set thinking = true %}
6
+ {%- elif not thinking is defined %}{% set thinking = false %}
7
+ {% endif %}
8
  {%- if not keep_cots is defined %}{% set keep_cots = false %}{% endif %}
9
  {%- if thinking %}{%- set system_prompt = thinking_prompt %}{%- else %}{%- set system_prompt = standard_prompt %}{%- endif %}
10
  {%- if tools %}
 
36
  {%- set content = message['content'] -%}
37
  {%- if thinking %}
38
  {%- if not keep_cots %}
39
+ {%- set splitted = content.split('</think>') -%}
40
+ {%- set second_part = splitted[1:] | join('</think>') -%}
41
+ {%- set content = '<think> </think>' + second_part -%}
42
  {%- endif %}
43
  {%- endif %}
44
  {{- '\n' + content + '<|eot_id|>' }}
 
49
  {%- set content = message['content'] -%}
50
  {%- if thinking %}
51
  {%- if not keep_cots %}
52
+ {%- set splitted = content.split('</think>') -%}
53
+ {%- set second_part = splitted[1:] | join('</think>') -%}
54
+ {%- set content = '<think> </think>' + second_part -%}
55
  {%- endif %}
56
  {%- endif %}
57
  {{- '\n' + content }}
 
82
  {%- if add_generation_prompt %}
83
  {{- '<|start_header_id|>assistant<|end_header_id|>\n\n' }}
84
  {%- endif %}
85
+ {#- Copyright 2025-present Unsloth. Apache 2.0 License. #}