s-yanev commited on
Commit
f46b7c8
·
verified ·
1 Parent(s): cc0298a

Revert remplate

Browse files

Reverting back the changes of the jinja template from this PR -https://huggingface.co/QuantTrio/GLM-4.7-AWQ/discussions/7
Sadly the model is breaking when structured output is requested and thinking is enabled. Making the model to only produce thinking block.
If structured output is needed, best will be to put it in the system prompt - this is also what GLM suggest as well.
Sorry for the confusion.

Files changed (1) hide show
  1. chat_template.jinja +2 -27
chat_template.jinja CHANGED
@@ -1,17 +1,14 @@
1
  [gMASK]<sop>
2
- {%- if tools and not (structured_output is defined and structured_output.enabled) -%}
3
  <|system|>
4
  # Tools
5
-
6
  You may call one or more functions to assist with the user query.
7
-
8
  You are provided with function signatures within <tools></tools> XML tags:
9
  <tools>
10
  {% for tool in tools %}
11
  {{ tool | tojson(ensure_ascii=False) }}
12
  {% endfor %}
13
  </tools>
14
-
15
  For each function call, output the function name and arguments within the following XML format:
16
  <tool_call>{function-name}<arg_key>{arg-key-1}</arg_key><arg_value>{arg-value-1}</arg_value><arg_key>{arg-key-2}</arg_key><arg_value>{arg-value-2}</arg_value>...</tool_call>{%- endif -%}
17
  {%- macro visible_text(content) -%}
@@ -78,29 +75,7 @@ For each function call, output the function name and arguments within the follow
78
  <tool_response>{{ tr.output if tr.output is defined else tr }}</tool_response>{% endfor -%}
79
  {% endif -%}
80
  {%- elif m.role == 'system' -%}
81
- <|system|>
82
- {%- if structured_output is defined and structured_output.enabled and loop.index0 == 0 -%}
83
- # Structured Output
84
-
85
- You are a structured output engine.
86
-
87
- Output ONLY valid JSON. Follow the JSON schema exactly.
88
-
89
- Do not output:
90
- - markdown
91
- - prose
92
- - explanations
93
- - XML
94
- - comments
95
- - chain-of-thought
96
-
97
- JSON Schema:
98
- {{ structured_output.schema | tojson(indent=2) }}
99
-
100
- {{ visible_text(m.content) }}
101
- {%- else -%}
102
- {{ visible_text(m.content) }}
103
- {%- endif -%}
104
  {%- endif -%}
105
  {%- endfor -%}
106
  {%- if add_generation_prompt -%}
 
1
  [gMASK]<sop>
2
+ {%- if tools -%}
3
  <|system|>
4
  # Tools
 
5
  You may call one or more functions to assist with the user query.
 
6
  You are provided with function signatures within <tools></tools> XML tags:
7
  <tools>
8
  {% for tool in tools %}
9
  {{ tool | tojson(ensure_ascii=False) }}
10
  {% endfor %}
11
  </tools>
 
12
  For each function call, output the function name and arguments within the following XML format:
13
  <tool_call>{function-name}<arg_key>{arg-key-1}</arg_key><arg_value>{arg-value-1}</arg_value><arg_key>{arg-key-2}</arg_key><arg_value>{arg-value-2}</arg_value>...</tool_call>{%- endif -%}
14
  {%- macro visible_text(content) -%}
 
75
  <tool_response>{{ tr.output if tr.output is defined else tr }}</tool_response>{% endfor -%}
76
  {% endif -%}
77
  {%- elif m.role == 'system' -%}
78
+ <|system|>{{ visible_text(m.content) }}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
  {%- endif -%}
80
  {%- endfor -%}
81
  {%- if add_generation_prompt -%}