Upload folder using huggingface_hub
Browse files- chat_template.jinja +1 -1
- tokenizer_config.json +2 -1
chat_template.jinja
CHANGED
|
@@ -56,7 +56,7 @@ For each function call, output the function name and arguments within the follow
|
|
| 56 |
{%- set parts = content.split('</think>') %}
|
| 57 |
{% for part in parts %}
|
| 58 |
{%- if loop.index0 == 0 -%}
|
| 59 |
-
{%- set reasoning_content = part.split("<think>")
|
| 60 |
{%- set reasoning_content = reasoning_content.lstrip('\n').rstrip('\n') -%}
|
| 61 |
{%- else -%}
|
| 62 |
{%- set content = part.lstrip('\n') %}
|
|
|
|
| 56 |
{%- set parts = content.split('</think>') %}
|
| 57 |
{% for part in parts %}
|
| 58 |
{%- if loop.index0 == 0 -%}
|
| 59 |
+
{%- set reasoning_content = (part.split("<think>")|last) %}
|
| 60 |
{%- set reasoning_content = reasoning_content.lstrip('\n').rstrip('\n') -%}
|
| 61 |
{%- else -%}
|
| 62 |
{%- set content = part.lstrip('\n') %}
|
tokenizer_config.json
CHANGED
|
@@ -323,5 +323,6 @@
|
|
| 323 |
"padding_side": "left",
|
| 324 |
"remove_space": false,
|
| 325 |
"tokenizer_class": "PreTrainedTokenizerFast",
|
| 326 |
-
"unk_token": null
|
|
|
|
| 327 |
}
|
|
|
|
| 323 |
"padding_side": "left",
|
| 324 |
"remove_space": false,
|
| 325 |
"tokenizer_class": "PreTrainedTokenizerFast",
|
| 326 |
+
"unk_token": null,
|
| 327 |
+
"chat_template": "{# Unsloth template fixes #}[gMASK]<sop>\n{%- if tools -%}\n<|system|>\n# 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>\n{% for tool in tools %}\n{{ tool | tojson|string }}\n{% endfor %}\n</tools>\n\nFor each function call, output the function name and arguments within the following XML format:\n<tool_call>{function-name}\n<arg_key>{arg-key-1}</arg_key>\n<arg_value>{arg-value-1}</arg_value>\n<arg_key>{arg-key-2}</arg_key>\n<arg_value>{arg-value-2}</arg_value>\n...\n</tool_call>{%- endif -%}\n{%- macro visible_text(content) -%}\n {%- if content is string -%}\n {{- content }}\n {%- elif content is iterable and content is not mapping -%}\n {%- for item in content -%}\n {%- if item is mapping and item.type == 'text' -%}\n {{- item.text }}\n {%- elif item is string -%}\n {{- item }}\n {%- endif -%}\n {%- endfor -%}\n {%- else -%}\n {{- content }}\n {%- endif -%}\n{%- endmacro -%}\n{%- set ns = namespace(last_user_index=-1) %}\n{%- for m in messages %}\n {%- if m.role == 'user' %}\n {% set ns.last_user_index = loop.index0 -%}\n {%- endif %}\n{%- endfor %}\n{% for m in messages %}\n{%- if m.role == 'user' -%}<|user|>\n{%- set content = visible_text(m.content)|string %}{{ content }}\n{{- '/nothink' if (enable_thinking is defined and not enable_thinking and not content.endswith(\"/nothink\")) else '' -}}\n{%- elif m.role == 'assistant' -%}\n<|assistant|>\n{%- set reasoning_content = '' %}\n{%- set content = visible_text(m.content)|string %}\n{%- if m.reasoning_content is defined and m.reasoning_content is string %}\n {%- set reasoning_content = m.reasoning_content %}\n{%- else %}\n {# Unsloth template fixes - must change to for loop since llama.cpp will error out if not #}\n {%- set parts = content.split('</think>') %}\n {% for part in parts %}\n {%- if loop.index0 == 0 -%}\n {%- set reasoning_content = (part.split(\"<think>\")|last) %}\n {%- set reasoning_content = reasoning_content.lstrip('\\n').rstrip('\\n') -%}\n {%- else -%}\n {%- set content = part.lstrip('\\n') %}\n {%- endif %}\n {%- endfor %}\n{%- endif %}\n{%- if loop.index0 > ns.last_user_index and reasoning_content -%}\n{{ '\\n<think>' + reasoning_content.strip() + '</think>'}}\n{%- else -%}\n{{ '\\n<think></think>' }}\n{%- endif -%}\n{%- if content.strip() -%}\n{{ '\\n' + content.strip() }}\n{%- endif -%}\n{% if m.tool_calls %}\n{% for tc in m.tool_calls %}\n{%- if tc.function %}\n {%- set tc = tc.function %}\n{%- endif %}\n{{ '\\n<tool_call>' + tc.name }}\n{% set _args = tc.arguments %}\n{%- if _args is not mapping -%}\n {%- set _args = {} %}\n{%- endif -%}\n{% for k, v in _args|items %}\n<arg_key>{{ k }}</arg_key>\n<arg_value>{{ v | tojson|string if v is not string else v }}</arg_value>\n{% endfor %}\n</tool_call>{% endfor %}\n{% endif %}\n{%- elif m.role == 'tool' -%}\n{%- if m.content is string -%}\n{%- if loop.first or (messages[loop.index0 - 1].role != \"tool\") %}\n {{- '<|observation|>' }}\n{%- endif %}\n{{- '\\n<tool_response>\\n' }}\n{{- m.content }}\n{{- '\\n</tool_response>' }}\n{%- else -%}\n<|observation|>{% for tr in m.content %}\n\n<tool_response>\n{{ tr.output if tr.output is defined else tr }}\n</tool_response>{% endfor -%}\n{% endif -%}\n{%- elif m.role == 'system' -%}\n<|system|>\n{{ visible_text(m.content)|string }}\n{%- endif -%}\n{%- endfor -%}\n{%- if add_generation_prompt -%}\n <|assistant|>{{- '\\n<think></think>' if (enable_thinking is defined and not enable_thinking) else '' -}}\n{%- endif -%}{# Copyright 2025-present Unsloth. Apache 2.0 License. #}"
|
| 328 |
}
|