Boojum commited on
Commit
f941945
·
verified ·
1 Parent(s): 2c4052f

Upload folder using huggingface_hub

Browse files
chat_template.jinja CHANGED
@@ -195,7 +195,7 @@
195
  {#- System Message Construction ============================================ #}
196
  {%- macro build_system_message() -%}
197
  {%- if model_identity is not defined %}
198
- {%- set model_identity = "You are Boojum, a large language model trained by Boojum." %}
199
  {%- endif %}
200
  {{- model_identity + "\n" }}
201
  {{- "Knowledge cutoff: 2024-06\n" }}
@@ -204,7 +204,7 @@
204
  {%- set reasoning_effort = "medium" %}
205
  {%- endif %}
206
  {{- "Reasoning: " + reasoning_effort + "\n\n" }}
207
- {%- if builtin_tools %}
208
  {{- "# Tools\n\n" }}
209
  {%- set available_builtin_tools = namespace(browser=false, python=false) %}
210
  {%- for tool in builtin_tools %}
@@ -231,7 +231,10 @@
231
  {{- "<|end|>" }}
232
 
233
  {#- Extract developer message #}
234
- {%- if messages[0].role == "developer" or messages[0].role == "system" %}
 
 
 
235
  {%- set developer_message = messages[0].content %}
236
  {%- set loop_messages = messages[1:] %}
237
  {%- else %}
@@ -245,9 +248,11 @@
245
  {%- if developer_message %}
246
  {{- "# Instructions\n\n" }}
247
  {{- developer_message }}
248
- {{- "\n\n" }}
249
  {%- endif %}
250
  {%- if tools -%}
 
 
 
251
  {{- "# Tools\n\n" }}
252
  {{- render_tool_namespace("functions", tools) }}
253
  {%- endif -%}
@@ -260,11 +265,6 @@
260
  {#- At this point only assistant/user/tool messages should remain #}
261
  {%- if message.role == 'assistant' -%}
262
  {#- Checks to ensure the messages are being passed in the format we expect #}
263
- {%- if "content" in message %}
264
- {%- if "<|channel|>analysis<|message|>" in message.content or "<|channel|>final<|message|>" in message.content %}
265
- {{- raise_exception("You have passed a message containing <|channel|> tags in the content field. Instead of doing this, you should pass analysis messages (the string between '<|message|>' and '<|end|>') in the 'thinking' field, and final messages (the string between '<|message|>' and '<|end|>') in the 'content' field.") }}
266
- {%- endif %}
267
- {%- endif %}
268
  {%- if "thinking" in message %}
269
  {%- if "<|channel|>analysis<|message|>" in message.thinking or "<|channel|>final<|message|>" in message.thinking %}
270
  {{- raise_exception("You have passed a message containing <|channel|> tags in the thinking field. Instead of doing this, you should pass analysis messages (the string between '<|message|>' and '<|end|>') in the 'thinking' field, and final messages (the string between '<|message|>' and '<|end|>') in the 'content' field.") }}
@@ -296,7 +296,11 @@
296
  {{- "<|start|>assistant to=" }}
297
  {{- "functions." + tool_call.name + "<|channel|>commentary " }}
298
  {{- (tool_call.content_type if tool_call.content_type is defined else "json") + "<|message|>" }}
299
- {{- tool_call.arguments|tojson }}
 
 
 
 
300
  {{- "<|call|>" }}
301
  {%- set last_tool_call.name = tool_call.name %}
302
  {%- elif loop.last and not add_generation_prompt %}
@@ -308,7 +312,11 @@
308
  {#- <|return|> indicates the end of generation, but <|end|> does not #}
309
  {#- <|return|> should never be an input to the model, but we include it as the final token #}
310
  {#- when training, so the model learns to emit it. #}
311
- {{- "<|start|>assistant<|channel|>final<|message|>" + message.content + "<|return|>" }}
 
 
 
 
312
  {%- else %}
313
  {#- CoT is dropped during all previous turns, so we never render it for inference #}
314
  {{- "<|start|>assistant<|channel|>final<|message|>" + message.content + "<|end|>" }}
@@ -319,7 +327,11 @@
319
  {{- raise_exception("Message has tool role, but there was no previous assistant message with a tool call!") }}
320
  {%- endif %}
321
  {{- "<|start|>functions." + last_tool_call.name }}
322
- {{- " to=assistant<|channel|>commentary<|message|>" + message.content|tojson + "<|end|>" }}
 
 
 
 
323
  {%- elif message.role == 'user' -%}
324
  {{- "<|start|>user<|message|>" + message.content + "<|end|>" }}
325
  {%- endif -%}
@@ -328,4 +340,4 @@
328
  {#- Generation prompt #}
329
  {%- if add_generation_prompt -%}
330
  <|start|>assistant
331
- {%- endif -%}
 
195
  {#- System Message Construction ============================================ #}
196
  {%- macro build_system_message() -%}
197
  {%- if model_identity is not defined %}
198
+ {%- set model_identity = "You are Boo, a large language model trained by Boojum." %}
199
  {%- endif %}
200
  {{- model_identity + "\n" }}
201
  {{- "Knowledge cutoff: 2024-06\n" }}
 
204
  {%- set reasoning_effort = "medium" %}
205
  {%- endif %}
206
  {{- "Reasoning: " + reasoning_effort + "\n\n" }}
207
+ {%- if builtin_tools is defined and builtin_tools is not none %}
208
  {{- "# Tools\n\n" }}
209
  {%- set available_builtin_tools = namespace(browser=false, python=false) %}
210
  {%- for tool in builtin_tools %}
 
231
  {{- "<|end|>" }}
232
 
233
  {#- Extract developer message #}
234
+ {%- if developer_instructions is defined and developer_instructions is not none %}
235
+ {%- set developer_message = developer_instructions %}
236
+ {%- set loop_messages = messages %}
237
+ {%- elif messages[0].role == "developer" or messages[0].role == "system" %}
238
  {%- set developer_message = messages[0].content %}
239
  {%- set loop_messages = messages[1:] %}
240
  {%- else %}
 
248
  {%- if developer_message %}
249
  {{- "# Instructions\n\n" }}
250
  {{- developer_message }}
 
251
  {%- endif %}
252
  {%- if tools -%}
253
+ {%- if developer_message %}
254
+ {{- "\n\n" }}
255
+ {%- endif %}
256
  {{- "# Tools\n\n" }}
257
  {{- render_tool_namespace("functions", tools) }}
258
  {%- endif -%}
 
265
  {#- At this point only assistant/user/tool messages should remain #}
266
  {%- if message.role == 'assistant' -%}
267
  {#- Checks to ensure the messages are being passed in the format we expect #}
 
 
 
 
 
268
  {%- if "thinking" in message %}
269
  {%- if "<|channel|>analysis<|message|>" in message.thinking or "<|channel|>final<|message|>" in message.thinking %}
270
  {{- raise_exception("You have passed a message containing <|channel|> tags in the thinking field. Instead of doing this, you should pass analysis messages (the string between '<|message|>' and '<|end|>') in the 'thinking' field, and final messages (the string between '<|message|>' and '<|end|>') in the 'content' field.") }}
 
296
  {{- "<|start|>assistant to=" }}
297
  {{- "functions." + tool_call.name + "<|channel|>commentary " }}
298
  {{- (tool_call.content_type if tool_call.content_type is defined else "json") + "<|message|>" }}
299
+ {%- if tool_call.arguments is string %}
300
+ {{- tool_call.arguments }}
301
+ {%- else %}
302
+ {{- tool_call.arguments|tojson }}
303
+ {%- endif %}
304
  {{- "<|call|>" }}
305
  {%- set last_tool_call.name = tool_call.name %}
306
  {%- elif loop.last and not add_generation_prompt %}
 
312
  {#- <|return|> indicates the end of generation, but <|end|> does not #}
313
  {#- <|return|> should never be an input to the model, but we include it as the final token #}
314
  {#- when training, so the model learns to emit it. #}
315
+ {{- "<|start|>assistant<|channel|>final<|message|>" + message.content + "<|end|>" }}
316
+ {%- elif "thinking" in message %}
317
+ {#- CoT is dropped during all previous turns, so we never render it for inference #}
318
+ {{- "<|start|>assistant<|channel|>analysis<|message|>" + message.thinking + "<|end|>" }}
319
+ {%- set last_tool_call.name = none %}
320
  {%- else %}
321
  {#- CoT is dropped during all previous turns, so we never render it for inference #}
322
  {{- "<|start|>assistant<|channel|>final<|message|>" + message.content + "<|end|>" }}
 
327
  {{- raise_exception("Message has tool role, but there was no previous assistant message with a tool call!") }}
328
  {%- endif %}
329
  {{- "<|start|>functions." + last_tool_call.name }}
330
+ {%- if message.content is string %}
331
+ {{- " to=assistant<|channel|>commentary<|message|>" + message.content + "<|end|>" }}
332
+ {%- else %}
333
+ {{- " to=assistant<|channel|>commentary<|message|>" + message.content|tojson + "<|end|>" }}
334
+ {%- endif %}
335
  {%- elif message.role == 'user' -%}
336
  {{- "<|start|>user<|message|>" + message.content + "<|end|>" }}
337
  {%- endif -%}
 
340
  {#- Generation prompt #}
341
  {%- if add_generation_prompt -%}
342
  <|start|>assistant
343
+ {%- endif -%}
model-00001-of-00003.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6c9464e1dc2ecd2b9c4f303d65735cbbb303f18a124c243d0fc429f543c9f201
3
+ size 3020222560
model-00002-of-00003.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f4ac98c42d12fa86220bc3134fc362f124e055b75c9c79fa905beda4324195fa
3
+ size 3027275952
model-00003-of-00003.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:463e1018ab71ed2367e638900015b2ac6432d9fcf285306176165f4df3a4fea4
3
+ size 2323593336
model.safetensors.index.json CHANGED
The diff for this file is too large to render. See raw diff