Sweaterdog commited on
Commit
f6e4d67
·
verified ·
1 Parent(s): 3a12087

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +122 -0
README.md CHANGED
@@ -147,6 +147,128 @@ Which didn't contain anything about being human.
147
 
148
  ***
149
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
150
  # Notes
151
 
152
  The GRaPE Family started all the way back in August of 2025, meaning these models are severely out of date on architecture, and training data.
 
147
 
148
  ***
149
 
150
+ # Thinking in GRaPE Mini
151
+
152
+ GRaPE Mini does have the ability to think. However like Andy-4.1, there is a chat template issue preventing the model from thinking. Use this chat template to have the model think.
153
+ ```
154
+ {%- set image_count = namespace(value=0) %}
155
+ {%- set video_count = namespace(value=0) %}
156
+ {%- macro render_content(content, do_vision_count) %}
157
+     {%- if content is string %}
158
+         {{- content }}
159
+     {%- else %}
160
+         {%- for item in content %}
161
+             {%- if 'image' in item or 'image_url' in item or item.type == 'image' %}
162
+                 {%- if do_vision_count %}
163
+                     {%- set image_count.value = image_count.value + 1 %}
164
+                 {%- endif %}
165
+                 {%- if add_vision_id %}Picture {{ image_count.value }}: {% endif -%}
166
+                 <|vision_start|><|image_pad|><|vision_end|>
167
+             {%- elif 'video' in item or item.type == 'video' %}
168
+                 {%- if do_vision_count %}
169
+                     {%- set video_count.value = video_count.value + 1 %}
170
+                 {%- endif %}
171
+                 {%- if add_vision_id %}Video {{ video_count.value }}: {% endif -%}
172
+                 <|vision_start|><|video_pad|><|vision_end|>
173
+             {%- elif 'text' in item %}
174
+                 {{- item.text }}
175
+             {%- endif %}
176
+         {%- endfor %}
177
+     {%- endif %}
178
+ {%- endmacro %}
179
+ {%- if tools %}
180
+     {{- '<|im_start|>system\n' }}
181
+     {%- if messages[0].role == 'system' %}
182
+         {{- render_content(messages[0].content, false) + '\n\n' }}
183
+     {%- endif %}
184
+     {{- "# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
185
+     {%- for tool in tools %}
186
+         {{- "\n" }}
187
+         {{- tool | tojson }}
188
+     {%- endfor %}
189
+     {{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
190
+ {%- else %}
191
+     {%- if messages[0].role == 'system' %}
192
+         {{- '<|im_start|>system\n' + render_content(messages[0].content, false) + '<|im_end|>\n' }}
193
+     {%- endif %}
194
+ {%- endif %}
195
+ {%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
196
+ {%- for message in messages[::-1] %}
197
+     {%- set index = (messages|length - 1) - loop.index0 %}
198
+     {%- if ns.multi_step_tool and message.role == "user" %}
199
+         {%- set content = render_content(message.content, false) %}
200
+         {%- if not(content.startswith('<tool_response>') and content.endswith('</tool_response>')) %}
201
+             {%- set ns.multi_step_tool = false %}
202
+             {%- set ns.last_query_index = index %}
203
+         {%- endif %}
204
+     {%- endif %}
205
+ {%- endfor %}
206
+ {%- for message in messages %}
207
+     {%- set content = render_content(message.content, True) %}
208
+     {%- if (message.role == "user") or (message.role == "system" and not loop.first) %}
209
+         {%- if message.role == "user" and loop.last %}
210
+             {{- '<|im_start|>' + message.role + '\n' + content + '\n\n<system_note>Respond by first generating a <think> tag to reason through the user\'s prompt.</system_note><|im_end|>\n' }}
211
+         {%- else %}
212
+             {{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>\n' }}
213
+         {%- endif %}
214
+     {%- elif message.role == "assistant" %}
215
+         {%- set reasoning_content = '' %}
216
+         {%- if message.reasoning_content is string %}
217
+             {%- set reasoning_content = message.reasoning_content %}
218
+         {%- else %}
219
+             {%- if '</think>' in content %}
220
+                 {%- set reasoning_content = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
221
+                 {%- set content = content.split('</think>')[-1].lstrip('\n') %}
222
+             {%- endif %}
223
+         {%- endif %}
224
+         {%- if loop.index0 > ns.last_query_index %}
225
+             {%- if loop.last or (not loop.last and reasoning_content) %}
226
+                 {{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }}
227
+             {%- else %}
228
+                 {{- '<|im_start|>' + message.role + '\n' + content }}
229
+             {%- endif %}
230
+         {%- else %}
231
+             {{- '<|im_start|>' + message.role + '\n' + content }}
232
+         {%- endif %}
233
+         {%- if message.tool_calls %}
234
+             {%- for tool_call in message.tool_calls %}
235
+                 {%- if (loop.first and content) or (not loop.first) %}
236
+                     {{- '\n' }}
237
+                 {%- endif %}
238
+                 {%- if tool_call.function %}
239
+                     {%- set tool_call = tool_call.function %}
240
+                 {%- endif %}
241
+                 {{- '<tool_call>\n{"name": "' }}
242
+                 {{- tool_call.name }}
243
+                 {{- '", "arguments": ' }}
244
+                 {%- if tool_call.arguments is string %}
245
+                     {{- tool_call.arguments }}
246
+                 {%- else %}
247
+                     {{- tool_call.arguments | tojson }}
248
+                 {%- endif %}
249
+                 {{- '}\n</tool_call>' }}
250
+             {%- endfor %}
251
+         {%- endif %}
252
+         {{- '<|im_end|>\n' }}
253
+     {%- elif message.role == "tool" %}
254
+         {%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
255
+             {{- '<|im_start|>user' }}
256
+         {%- endif %}
257
+         {{- '\n<tool_response>\n' }}
258
+         {{- content }}
259
+         {{- '\n</tool_response>' }}
260
+         {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
261
+             {{- '<|im_end|>\n' }}
262
+         {%- endif %}
263
+     {%- endif %}
264
+ {%- endfor %}
265
+ {%- if add_generation_prompt %}
266
+     {{- '<|im_start|>assistant\n' }}
267
+ {%- endif %}
268
+ ```
269
+
270
+ ***
271
+
272
  # Notes
273
 
274
  The GRaPE Family started all the way back in August of 2025, meaning these models are severely out of date on architecture, and training data.