Jaidchen commited on
Commit
85f197c
·
unverified ·
0 Parent(s):

Publish Focus-Red

Browse files
.gitattributes ADDED
@@ -0,0 +1 @@
 
 
1
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,173 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: transformers
3
+ license: apache-2.0
4
+ license_link: https://huggingface.co/Qwen/Qwen3.8-27B/blob/main/LICENSE
5
+ base_model: Qwen/Qwen3.8-27B
6
+ pipeline_tag: text-generation
7
+ tags:
8
+ - dense
9
+ - coding
10
+ - agentic
11
+ - unimodal
12
+ - repackaged
13
+ ---
14
+
15
+ <center>
16
+ <img style='height: 16em' src='https://cdn-uploads.huggingface.co/production/uploads/63e9a1c4ccae1fe5c622b9f6/zOXMkdhMfeQWxDq6JHj0B.webp'/>
17
+ </center>
18
+
19
+ # Focus-Red
20
+
21
+ repackaged [Qwen 3.8 27B](https://huggingface.co/Qwen/Qwen3.8-27B) with a simplified architecture and minor opinionated improvements
22
+
23
+ - all vision-related components removed
24
+ - reduced storage and memory, faster inference
25
+ - zero loss of output quality
26
+
27
+ ## comparison
28
+
29
+ <table>
30
+ <tr>
31
+ <th></th>
32
+ <th>Qwen 3.8 27B</th>
33
+ <th>Focus-Red</th>
34
+ </tr>
35
+ <tr>
36
+ <td>author</td>
37
+ <td><a href='https://huggingface.co/Qwen'>Alibaba Qwen</a></td>
38
+ <td><a href='https://huggingface.co/Jaidchen'>Jaid</a></td>
39
+ </tr>
40
+ <tr>
41
+ <td>repository</td>
42
+ <td><a href='https://huggingface.co/Qwen/Qwen3.8-27B'>Qwen/Qwen3.8-27B</a></td>
43
+ <td><a href='https://huggingface.co/Jaidchen/Focus-Red'>Jaidchen/Focus-Red</a></td>
44
+ </tr>
45
+ <tr>
46
+ <td>architecture</td>
47
+ <td><code>qwen3_5</code></td>
48
+ <td><code>qwen3_5_text</code></td>
49
+ </tr>
50
+ <tr>
51
+ <td>Transformers handler</td>
52
+ <td>
53
+ <a href='https://huggingface.co/docs/transformers/model_doc/qwen3_5#transformers.Qwen3_5ForConditionalGeneration'><code>Qwen3_5ForConditionalGeneration</code></a>
54
+ </td>
55
+ <td>
56
+ <a href='https://huggingface.co/docs/transformers/model_doc/qwen3_5#transformers.Qwen3_5ForCausalLM'><code>Qwen3_5ForCausalLM</code></a>
57
+ </td>
58
+ </tr>
59
+ <tr>
60
+ <td>tensor entries</td>
61
+ <td>1199</td>
62
+ <td>851</td>
63
+ </tr>
64
+ <tr style='opacity: 50%'>
65
+ <td>tensor type</td>
66
+ <td>bf16</td>
67
+ <td>bf16</td>
68
+ </tr>
69
+ <tr>
70
+ <td>parameters</td>
71
+ <td>27 781 427 952</td>
72
+ <td>26 895 998 464</td>
73
+ </tr>
74
+ <tr style='opacity: 50%'>
75
+ <td>active</td>
76
+ <td>100%</td>
77
+ <td>100%</td>
78
+ </tr>
79
+ <tr style='opacity: 50%'>
80
+ <td>vocabulary size</td>
81
+ <td>248 320</td>
82
+ <td>248 320</td>
83
+ </tr>
84
+ <tr style='opacity: 50%'>
85
+ <td>context size</td>
86
+ <td>262 144</td>
87
+ <td>262 144</td>
88
+ </tr>
89
+ <tr style='opacity: 50%'>
90
+ <td>MTP</td>
91
+ <td>integrated</td>
92
+ <td>detached → <a href='https://huggingface.co/Jaidchen/Focus-Red-MTP'>Focus-Red-MTP</a></td>
93
+ </tr>
94
+ <tr>
95
+ <td>sampling strategy</td>
96
+ <td>random sampling</td>
97
+ <td>greedy/deterministic</td>
98
+ </tr>
99
+ <tr>
100
+ <td>sampling parameters</td>
101
+ <td>
102
+ <div style='font-family: Jaidevka Code, JetBrains Mono, monospace; line-height: initial'>
103
+ <span style='color: hsl(from currentColor 0 100% l)'>do_sample</span>: <span style='color: hsl(from currentColor 50 80% l)'>true</span><br>
104
+ <span style='color: hsl(from currentColor 0 100% l)'>temperature</span>: <span style='color: hsl(from currentColor 50 80% l)'>1.0</span><br>
105
+ <span style='color: hsl(from currentColor 0 100% l)'>top_k</span>: <span style='color: hsl(from currentColor 50 80% l)'>20</span><br>
106
+ <span style='color: hsl(from currentColor 0 100% l)'>top_p</span>: <span style='color: hsl(from currentColor 50 80% l)'>0.95</span></div>
107
+ </td>
108
+ <td>
109
+ <div style='font-family: Jaidevka Code, JetBrains Mono, monospace; line-height: initial'>
110
+ <span style='color: hsl(from currentColor 0 100% l)'>do_sample</span>: <span style='color: hsl(from currentColor 50 80% l)'>false</span><br>
111
+ <span style='color: hsl(from currentColor 0 100% l)'>temperature</span>: <span style='color: hsl(from currentColor 50 80% l)'>0</span><br>
112
+ <span style='color: hsl(from currentColor 0 100% l)'>top_k</span>: <span style='color: hsl(from currentColor 50 80% l)'>1</span><br>
113
+ <span style='color: hsl(from currentColor 0 100% l)'>top_p</span>: <span style='color: hsl(from currentColor 50 80% l)'>1</span></div>
114
+ </div>
115
+ </td>
116
+ </tr>
117
+ <tr>
118
+ <td>input modality</td>
119
+ <td>text, image, video</td>
120
+ <td>text</td>
121
+ </tr>
122
+ <tr>
123
+ <td>model size</td>
124
+ <td>55 562 855 904</td>
125
+ <td>53 791 996 928</td>
126
+ </tr>
127
+ <tr>
128
+ <td>splits</td>
129
+ <td>18</td>
130
+ <td>none</td>
131
+ </tr>
132
+ <tr>
133
+ <td>Jinja template</td>
134
+ <td><a href='https://huggingface.co/Qwen/Qwen3.8-27B/blob/main/chat_template.jinja'>Qwen original</a></td>
135
+ <td><a href='https://github.com/jaidlab/focus-chat-template'>focus-chat-template</a> dist build</td>
136
+ </tr>
137
+ </table>
138
+
139
+ ## pros
140
+
141
+ - reduced storage needs
142
+ - reduced loading time
143
+ - reduced VRAM occupancy, thus more room for context
144
+ - increased inference speed
145
+ - simplified architecture, unlocking some further potential for optimizing low-level procedures
146
+
147
+ ## cons
148
+
149
+ - legally blind
150
+ - Pictures and video frames can still be present in the context without crashing, but their contents are no longer interpreted by the model and won’t do anything else than waste space.
151
+ - If you occasionally rely on those capabilities, I suggest adding a `consult` tool to your harness that calls a vision-enabled subagent model like [Gemini Flash](https://openrouter.ai/~google/gemini-flash-latest) or [GPT](https://openrouter.ai/~openai/gpt-latest).
152
+ - reduced compatibility
153
+ - The simplified architecture is handled by the `Qwen3_5ForCausalLM` class which may not be included in your inference engine. In this case you would need to ask your agent or integrate it yourself.
154
+ - Inference engines confirmed to have native support:
155
+ - [SGLang](https://github.com/sgl-project/sglang) ≥ v0.5.17 (PR [#32401](https://github.com/sgl-project/sglang/pull/32401))
156
+ - [vLLM](https://github.com/vllm-project/vllm) ≥ v0.26.0 (PR [#50210](https://github.com/vllm-project/vllm/pull/50210))
157
+ - The applied coercions may confuse your inference engine in case it has fixed expectations about the model’s architecture and thus lead to unpredictable behavior.
158
+
159
+ ## caveats
160
+
161
+ - model file not split, possibly causing issues if intended to be stored on an HDD from the previous century
162
+ - random sampling disabled by default, less suitable for long-form writing, entertainment and casual chat
163
+
164
+ ## Jinja template
165
+
166
+ This build uses `dist/chat_template.jinja` from [jaidlab/focus-chat-template](https://github.com/jaidlab/focus-chat-template). The template is reproducibly built from Qwen/Qwen3.8-27B's pinned upstream template at commit `1d4bf0f2ff6012fd82039f2fa52739d0dd7c60c0` plus the repository's ordered patch stack.
167
+
168
+ - template SHA-256: `5c381ca45e9538c7a2406331b554ee7d62cf3d0b8c115f17687d4fdd5590a239`
169
+ - template size: 9,710 bytes
170
+
171
+ ## license
172
+
173
+ Apache 2.0 – inherited from [Qwen 3.8 27B](https://huggingface.co/Qwen/Qwen3.8-27B/blob/main/LICENSE)
chat_template.jinja ADDED
@@ -0,0 +1,174 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- macro render_content(content) %}
2
+ {%- if content is string %}
3
+ {{- content }}
4
+ {%- elif content is iterable and content is not mapping %}
5
+ {%- for item in content %}
6
+ {%- if item is mapping %}
7
+ {%- if ('type' in item and (item.type == 'image' or item.type == 'image_url')) or 'image' in item or 'image_url' in item %}
8
+ {{- '[image]' }}
9
+ {%- elif ('type' in item and item.type == 'video') or 'video' in item %}
10
+ {{- '[video]' }}
11
+ {%- elif 'text' in item %}
12
+ {{- item.text }}
13
+ {%- else %}
14
+ {{- raise_exception('Unexpected item type in content.') }}
15
+ {%- endif %}
16
+ {%- else %}
17
+ {{- item | string }}
18
+ {%- endif %}
19
+ {%- endfor %}
20
+ {%- elif content is none or content is undefined %}
21
+ {{- '' }}
22
+ {%- else %}
23
+ {{- raise_exception('Unexpected content type.') }}
24
+ {%- endif %}
25
+ {%- endmacro %}
26
+ {%- if not messages %}
27
+ {{- raise_exception('No messages provided.') }}
28
+ {%- endif %}
29
+ {%- set reasoning_instructions = '' %}
30
+ {%- if enable_thinking is undefined or enable_thinking is true %}
31
+ {%- set resolved_reasoning_effort = reasoning_effort|default('xhigh') %}
32
+ {%- if resolved_reasoning_effort not in ('xhigh', 'medium', 'low') %}
33
+ {{- raise_exception('Unexpected reasoning effort ' ~ reasoning_effort ~ '. Supported types are xhigh (default), medium, and low.') }}
34
+ {%- endif %}
35
+ {%- if resolved_reasoning_effort == 'xhigh' %}
36
+ {%- set reasoning_instructions = 'Reasoning effort is set to xhigh. Please think carefully through the task, validate key assumptions, consider plausible alternatives, and prioritize correctness, consistency, and clarity in the final answer.' %}
37
+ {%- elif resolved_reasoning_effort == 'low' %}
38
+ {%- set reasoning_instructions = 'Reasoning effort is set to low. Keep your thinking brief and focused, moving directly to the conclusion without unnecessary elaboration.' %}
39
+ {%- endif %}
40
+ {%- endif %}
41
+ {%- set _preserve_thinking = preserve_thinking if preserve_thinking is defined else true %}
42
+ {%- set leading = namespace(active=true, count=0, content='') %}
43
+ {%- for message in messages %}
44
+ {%- if leading.active and (message.role == 'system' or message.role == 'developer') %}
45
+ {%- set rendered = render_content(message.content) | trim %}
46
+ {%- if rendered %}
47
+ {%- if leading.content %}
48
+ {%- set leading.content = leading.content + '\n' + rendered %}
49
+ {%- else %}
50
+ {%- set leading.content = rendered %}
51
+ {%- endif %}
52
+ {%- endif %}
53
+ {%- set leading.count = leading.count + 1 %}
54
+ {%- else %}
55
+ {%- set leading.active = false %}
56
+ {%- endif %}
57
+ {%- endfor %}
58
+ {%- set _has_tools = tools is defined and tools and tools is iterable and tools is not mapping %}
59
+ {%- if _has_tools %}
60
+ {{- '<|im_start|>system\n' }}
61
+ {%- if reasoning_instructions %}
62
+ {{- reasoning_instructions + '\n\n' }}
63
+ {%- endif %}
64
+ {{- "# Tools\n\nYou have access to the following functions:\n\n<tools>" }}
65
+ {%- for tool in tools %}
66
+ {{- "\n" }}
67
+ {{- tool | tojson }}
68
+ {%- endfor %}
69
+ {{- "\n</tools>" }}
70
+ {{- '\n\nIf you choose to call a function ONLY reply in the following format with NO suffix:\n\n<tool_call>\n<function=example_function_name>\n<parameter=example_parameter_1>\nvalue_1\n</parameter>\n<parameter=example_parameter_2>\nThis is the value for the second parameter\nthat can span\nmultiple lines\n</parameter>\n</function>\n</tool_call>\n\n<IMPORTANT>\nReminder:\n- Function calls MUST follow the specified format: an inner <function=...></function> block must be nested within <tool_call></tool_call> XML tags\n- Required parameters MUST be specified\n- You may provide optional reasoning for your function call in natural language BEFORE the function call, but NOT after\n- If there is no function call available, answer the question like normal with your current knowledge and do not tell the user about function calls\n</IMPORTANT>' }}
71
+ {%- if leading.content %}
72
+ {{- '\n\n' + leading.content }}
73
+ {%- endif %}
74
+ {{- '<|im_end|>\n' }}
75
+ {%- else %}
76
+ {%- if leading.content %}
77
+ {{- '<|im_start|>system\n' + (reasoning_instructions + '\n\n' if reasoning_instructions else '') + leading.content + '<|im_end|>\n' }}
78
+ {%- elif reasoning_instructions %}
79
+ {{- '<|im_start|>system\n' + reasoning_instructions + '<|im_end|>\n' }}
80
+ {%- endif %}
81
+ {%- endif %}
82
+ {%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
83
+ {%- for message in messages[::-1] %}
84
+ {%- set index = (messages|length - 1) - loop.index0 %}
85
+ {%- if ns.multi_step_tool and message.role == "user" %}
86
+ {%- set content = render_content(message.content)|trim %}
87
+ {%- if not(content.startswith('<tool_response>') and content.endswith('</tool_response>')) %}
88
+ {%- set ns.multi_step_tool = false %}
89
+ {%- set ns.last_query_index = index %}
90
+ {%- endif %}
91
+ {%- endif %}
92
+ {%- endfor %}
93
+ {%- for message in messages %}
94
+ {%- set content = render_content(message.content) | trim %}
95
+ {%- if loop.index0 < leading.count %}
96
+ {%- elif message.role == 'system' or message.role == 'developer' %}
97
+ {{- '<|im_start|>system\n' + content + '<|im_end|>\n' }}
98
+ {%- elif message.role == 'user' %}
99
+ {{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
100
+ {%- elif message.role == "assistant" %}
101
+ {%- set reasoning_content = '' %}
102
+ {%- if message.reasoning_content is defined and message.reasoning_content is string %}
103
+ {%- set reasoning_content = message.reasoning_content %}
104
+ {%- elif message.thinking is defined and message.thinking is string %}
105
+ {%- set reasoning_content = message.thinking %}
106
+ {%- elif content.startswith('</think>') %}
107
+ {%- set content = (content.split('</think>')[1:] | join('</think>')).lstrip('\n') %}
108
+ {%- elif '\n</think>' in content %}
109
+ {%- set reasoning_content = content.split('\n</think>')[0] %}
110
+ {%- if reasoning_content.startswith('<think>\n') %}
111
+ {%- set reasoning_content = reasoning_content[8:] %}
112
+ {%- elif reasoning_content.startswith('<think>') %}
113
+ {%- set reasoning_content = reasoning_content[7:].lstrip('\n') %}
114
+ {%- endif %}
115
+ {%- set content = (content.split('\n</think>')[1:] | join('\n</think>')).lstrip('\n') %}
116
+ {%- endif %}
117
+ {%- set reasoning_content = reasoning_content | trim %}
118
+ {%- if reasoning_content and (_preserve_thinking or loop.index0 > ns.last_query_index) %}
119
+ {{- '<|im_start|>assistant\n<think>\n' + reasoning_content + '\n</think>\n\n' + content }}
120
+ {%- else %}
121
+ {{- '<|im_start|>assistant\n' + content }}
122
+ {%- endif %}
123
+ {%- if message.tool_calls is defined and message.tool_calls and message.tool_calls is iterable and message.tool_calls is not mapping %}
124
+ {%- for tool_call in message.tool_calls %}
125
+ {%- set call = tool_call.function if tool_call.function is defined and tool_call.function is not none else tool_call %}
126
+ {%- if loop.first %}
127
+ {%- if content | trim %}
128
+ {{- '\n\n<tool_call>\n<function=' + call.name + '>\n' }}
129
+ {%- else %}
130
+ {{- '<tool_call>\n<function=' + call.name + '>\n' }}
131
+ {%- endif %}
132
+ {%- else %}
133
+ {{- '\n<tool_call>\n<function=' + call.name + '>\n' }}
134
+ {%- endif %}
135
+ {%- if call.arguments is defined and call.arguments is mapping %}
136
+ {%- for args_name in call.arguments %}
137
+ {%- set args_value = call.arguments[args_name] %}
138
+ {{- '<parameter=' + args_name + '>\n' }}
139
+ {%- set args_value = args_value | tojson | safe if args_value is mapping or (args_value is sequence and args_value is not string) else args_value | string %}
140
+ {{- args_value }}
141
+ {{- '\n</parameter>\n' }}
142
+ {%- endfor %}
143
+ {%- elif call.arguments is defined and call.arguments is string and call.arguments %}
144
+ {{- call.arguments }}
145
+ {{- '\n' }}
146
+ {%- endif %}
147
+ {{- '</function>\n</tool_call>' }}
148
+ {%- endfor %}
149
+ {%- endif %}
150
+ {%- if not (loop.last and continue_final_message is defined and continue_final_message) %}
151
+ {{- '<|im_end|>\n' }}
152
+ {%- endif %}
153
+ {%- elif message.role == 'tool' %}
154
+ {%- set previous_role = messages[loop.index0 - 1].role if loop.index0 > 0 else '' %}
155
+ {%- if previous_role != 'tool' %}
156
+ {{- '<|im_start|>user' }}
157
+ {%- endif %}
158
+ {{- '\n<tool_response>\n' + content + '\n</tool_response>' }}
159
+ {%- set next_role = messages[loop.index0 + 1].role if not loop.last else '' %}
160
+ {%- if loop.last or next_role != 'tool' %}
161
+ {{- '<|im_end|>\n' }}
162
+ {%- endif %}
163
+ {%- else %}
164
+ {{- raise_exception('Unexpected message role: ' + message.role) }}
165
+ {%- endif %}
166
+ {%- endfor %}
167
+ {%- if add_generation_prompt %}
168
+ {{- '<|im_start|>assistant\n' }}
169
+ {%- if enable_thinking is defined and enable_thinking is false %}
170
+ {{- '<think>\n\n</think>\n\n' }}
171
+ {%- else %}
172
+ {{- '<think>\n' }}
173
+ {%- endif %}
174
+ {%- endif %}
config.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"attention_bias":false,"attention_dropout":0,"attn_output_gate":true,"bos_token_id":248044,"dtype":"bfloat16","eos_token_id":248044,"full_attention_interval":4,"head_dim":256,"hidden_act":"silu","hidden_size":5120,"initializer_range":0.02,"intermediate_size":17408,"layer_types":["linear_attention","linear_attention","linear_attention","full_attention","linear_attention","linear_attention","linear_attention","full_attention","linear_attention","linear_attention","linear_attention","full_attention","linear_attention","linear_attention","linear_attention","full_attention","linear_attention","linear_attention","linear_attention","full_attention","linear_attention","linear_attention","linear_attention","full_attention","linear_attention","linear_attention","linear_attention","full_attention","linear_attention","linear_attention","linear_attention","full_attention","linear_attention","linear_attention","linear_attention","full_attention","linear_attention","linear_attention","linear_attention","full_attention","linear_attention","linear_attention","linear_attention","full_attention","linear_attention","linear_attention","linear_attention","full_attention","linear_attention","linear_attention","linear_attention","full_attention","linear_attention","linear_attention","linear_attention","full_attention","linear_attention","linear_attention","linear_attention","full_attention","linear_attention","linear_attention","linear_attention","full_attention"],"linear_conv_kernel_dim":4,"linear_key_head_dim":128,"linear_num_key_heads":16,"linear_num_value_heads":48,"linear_value_head_dim":128,"mamba_ssm_dtype":"float32","max_position_embeddings":262144,"model_type":"qwen3_5_text","num_attention_heads":24,"num_hidden_layers":64,"num_key_value_heads":4,"output_gate_type":"swish","pad_token_id":null,"partial_rotary_factor":0.25,"rms_norm_eps":0.000001,"rope_parameters":{"mrope_interleaved":true,"mrope_section":[11,11,10],"partial_rotary_factor":0.25,"rope_theta":10000000,"rope_type":"default"},"tie_word_embeddings":false,"use_cache":true,"vocab_size":248320,"architectures":["Qwen3_5ForCausalLM"],"transformers_version":"5.8.0.dev0"}
configuration.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"framework":"Pytorch","task":"text-generation"}
generation_config.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"bos_token_id":248044,"do_sample":false,"eos_token_id":[248046,248044],"pad_token_id":248044}
merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:61322963cb0112a58995abf32b8586d623c7616633bbdec59241dd3933a64502
3
+ size 53792149608
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"add_prefix_space":false,"added_tokens_decoder":{"248044":{"content":"<|endoftext|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":true},"248045":{"content":"<|im_start|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":true},"248046":{"content":"<|im_end|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":true},"248047":{"content":"<|object_ref_start|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":true},"248048":{"content":"<|object_ref_end|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":true},"248049":{"content":"<|box_start|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":true},"248050":{"content":"<|box_end|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":true},"248051":{"content":"<|quad_start|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":true},"248052":{"content":"<|quad_end|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":true},"248053":{"content":"<|vision_start|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":true},"248054":{"content":"<|vision_end|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":true},"248055":{"content":"<|vision_pad|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":true},"248056":{"content":"<|image_pad|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":true},"248057":{"content":"<|video_pad|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":true},"248058":{"content":"<tool_call>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":false},"248059":{"content":"</tool_call>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":false},"248060":{"content":"<|fim_prefix|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":false},"248061":{"content":"<|fim_middle|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":false},"248062":{"content":"<|fim_suffix|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":false},"248063":{"content":"<|fim_pad|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":false},"248064":{"content":"<|repo_name|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":false},"248065":{"content":"<|file_sep|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":false},"248066":{"content":"<tool_response>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":false},"248067":{"content":"</tool_response>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":false},"248068":{"content":"<think>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":false},"248069":{"content":"</think>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":false},"248070":{"content":"<|audio_start|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":true},"248071":{"content":"<|audio_end|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":true},"248072":{"content":"<tts_pad>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":true},"248073":{"content":"<tts_text_bos>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":true},"248074":{"content":"<tts_text_eod>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":true},"248075":{"content":"<tts_text_bos_single>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":true},"248076":{"content":"<|audio_pad|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":true}},"additional_special_tokens":["<|im_start|>","<|im_end|>","<|object_ref_start|>","<|object_ref_end|>","<|box_start|>","<|box_end|>","<|quad_start|>","<|quad_end|>","<|vision_start|>","<|vision_end|>","<|vision_pad|>","<|image_pad|>","<|video_pad|>"],"bos_token":null,"chat_template":"{%- macro render_content(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 %}\n {%- if ('type' in item and (item.type == 'image' or item.type == 'image_url')) or 'image' in item or 'image_url' in item %}\n {{- '[image]' }}\n {%- elif ('type' in item and item.type == 'video') or 'video' in item %}\n {{- '[video]' }}\n {%- elif 'text' in item %}\n {{- item.text }}\n {%- else %}\n {{- raise_exception('Unexpected item type in content.') }}\n {%- endif %}\n {%- else %}\n {{- item | string }}\n {%- endif %}\n {%- endfor %}\n {%- elif content is none or content is undefined %}\n {{- '' }}\n {%- else %}\n {{- raise_exception('Unexpected content type.') }}\n {%- endif %}\n{%- endmacro %}\n{%- if not messages %}\n {{- raise_exception('No messages provided.') }}\n{%- endif %}\n{%- set reasoning_instructions = '' %}\n{%- if enable_thinking is undefined or enable_thinking is true %}\n {%- set resolved_reasoning_effort = reasoning_effort|default('xhigh') %}\n {%- if resolved_reasoning_effort not in ('xhigh', 'medium', 'low') %}\n {{- raise_exception('Unexpected reasoning effort ' ~ reasoning_effort ~ '. Supported types are xhigh (default), medium, and low.') }}\n {%- endif %}\n {%- if resolved_reasoning_effort == 'xhigh' %}\n {%- set reasoning_instructions = 'Reasoning effort is set to xhigh. Please think carefully through the task, validate key assumptions, consider plausible alternatives, and prioritize correctness, consistency, and clarity in the final answer.' %}\n {%- elif resolved_reasoning_effort == 'low' %}\n {%- set reasoning_instructions = 'Reasoning effort is set to low. Keep your thinking brief and focused, moving directly to the conclusion without unnecessary elaboration.' %}\n {%- endif %}\n{%- endif %}\n{%- set _preserve_thinking = preserve_thinking if preserve_thinking is defined else true %}\n{%- set leading = namespace(active=true, count=0, content='') %}\n{%- for message in messages %}\n {%- if leading.active and (message.role == 'system' or message.role == 'developer') %}\n {%- set rendered = render_content(message.content) | trim %}\n {%- if rendered %}\n {%- if leading.content %}\n {%- set leading.content = leading.content + '\\n' + rendered %}\n {%- else %}\n {%- set leading.content = rendered %}\n {%- endif %}\n {%- endif %}\n {%- set leading.count = leading.count + 1 %}\n {%- else %}\n {%- set leading.active = false %}\n {%- endif %}\n{%- endfor %}\n{%- set _has_tools = tools is defined and tools and tools is iterable and tools is not mapping %}\n{%- if _has_tools %}\n {{- '<|im_start|>system\\n' }}\n {%- if reasoning_instructions %}\n {{- reasoning_instructions + '\\n\\n' }}\n {%- endif %}\n {{- \"# Tools\\n\\nYou have access to the following functions:\\n\\n<tools>\" }}\n {%- for tool in tools %}\n {{- \"\\n\" }}\n {{- tool | tojson }}\n {%- endfor %}\n {{- \"\\n</tools>\" }}\n {{- '\\n\\nIf you choose to call a function ONLY reply in the following format with NO suffix:\\n\\n<tool_call>\\n<function=example_function_name>\\n<parameter=example_parameter_1>\\nvalue_1\\n</parameter>\\n<parameter=example_parameter_2>\\nThis is the value for the second parameter\\nthat can span\\nmultiple lines\\n</parameter>\\n</function>\\n</tool_call>\\n\\n<IMPORTANT>\\nReminder:\\n- Function calls MUST follow the specified format: an inner <function=...></function> block must be nested within <tool_call></tool_call> XML tags\\n- Required parameters MUST be specified\\n- You may provide optional reasoning for your function call in natural language BEFORE the function call, but NOT after\\n- If there is no function call available, answer the question like normal with your current knowledge and do not tell the user about function calls\\n</IMPORTANT>' }}\n {%- if leading.content %}\n {{- '\\n\\n' + leading.content }}\n {%- endif %}\n {{- '<|im_end|>\\n' }}\n{%- else %}\n {%- if leading.content %}\n {{- '<|im_start|>system\\n' + (reasoning_instructions + '\\n\\n' if reasoning_instructions else '') + leading.content + '<|im_end|>\\n' }}\n {%- elif reasoning_instructions %}\n {{- '<|im_start|>system\\n' + reasoning_instructions + '<|im_end|>\\n' }}\n {%- endif %}\n{%- endif %}\n{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}\n{%- for message in messages[::-1] %}\n {%- set index = (messages|length - 1) - loop.index0 %}\n {%- if ns.multi_step_tool and message.role == \"user\" %}\n {%- set content = render_content(message.content)|trim %}\n {%- if not(content.startswith('<tool_response>') and content.endswith('</tool_response>')) %}\n {%- set ns.multi_step_tool = false %}\n {%- set ns.last_query_index = index %}\n {%- endif %}\n {%- endif %}\n{%- endfor %}\n{%- for message in messages %}\n {%- set content = render_content(message.content) | trim %}\n {%- if loop.index0 < leading.count %}\n {%- elif message.role == 'system' or message.role == 'developer' %}\n {{- '<|im_start|>system\\n' + content + '<|im_end|>\\n' }}\n {%- elif message.role == 'user' %}\n {{- '<|im_start|>' + message.role + '\\n' + content + '<|im_end|>' + '\\n' }}\n {%- elif message.role == \"assistant\" %}\n {%- set reasoning_content = '' %}\n {%- if message.reasoning_content is defined and message.reasoning_content is string %}\n {%- set reasoning_content = message.reasoning_content %}\n {%- elif message.thinking is defined and message.thinking is string %}\n {%- set reasoning_content = message.thinking %}\n {%- elif content.startswith('</think>') %}\n {%- set content = (content.split('</think>')[1:] | join('</think>')).lstrip('\\n') %}\n {%- elif '\\n</think>' in content %}\n {%- set reasoning_content = content.split('\\n</think>')[0] %}\n {%- if reasoning_content.startswith('<think>\\n') %}\n {%- set reasoning_content = reasoning_content[8:] %}\n {%- elif reasoning_content.startswith('<think>') %}\n {%- set reasoning_content = reasoning_content[7:].lstrip('\\n') %}\n {%- endif %}\n {%- set content = (content.split('\\n</think>')[1:] | join('\\n</think>')).lstrip('\\n') %}\n {%- endif %}\n {%- set reasoning_content = reasoning_content | trim %}\n {%- if reasoning_content and (_preserve_thinking or loop.index0 > ns.last_query_index) %}\n {{- '<|im_start|>assistant\\n<think>\\n' + reasoning_content + '\\n</think>\\n\\n' + content }}\n {%- else %}\n {{- '<|im_start|>assistant\\n' + content }}\n {%- endif %}\n {%- if message.tool_calls is defined and message.tool_calls and message.tool_calls is iterable and message.tool_calls is not mapping %}\n {%- for tool_call in message.tool_calls %}\n {%- set call = tool_call.function if tool_call.function is defined and tool_call.function is not none else tool_call %}\n {%- if loop.first %}\n {%- if content | trim %}\n {{- '\\n\\n<tool_call>\\n<function=' + call.name + '>\\n' }}\n {%- else %}\n {{- '<tool_call>\\n<function=' + call.name + '>\\n' }}\n {%- endif %}\n {%- else %}\n {{- '\\n<tool_call>\\n<function=' + call.name + '>\\n' }}\n {%- endif %}\n {%- if call.arguments is defined and call.arguments is mapping %}\n {%- for args_name in call.arguments %}\n {%- set args_value = call.arguments[args_name] %}\n {{- '<parameter=' + args_name + '>\\n' }}\n {%- set args_value = args_value | tojson | safe if args_value is mapping or (args_value is sequence and args_value is not string) else args_value | string %}\n {{- args_value }}\n {{- '\\n</parameter>\\n' }}\n {%- endfor %}\n {%- elif call.arguments is defined and call.arguments is string and call.arguments %}\n {{- call.arguments }}\n {{- '\\n' }}\n {%- endif %}\n {{- '</function>\\n</tool_call>' }}\n {%- endfor %}\n {%- endif %}\n {%- if not (loop.last and continue_final_message is defined and continue_final_message) %}\n {{- '<|im_end|>\\n' }}\n {%- endif %}\n {%- elif message.role == 'tool' %}\n {%- set previous_role = messages[loop.index0 - 1].role if loop.index0 > 0 else '' %}\n {%- if previous_role != 'tool' %}\n {{- '<|im_start|>user' }}\n {%- endif %}\n {{- '\\n<tool_response>\\n' + content + '\\n</tool_response>' }}\n {%- set next_role = messages[loop.index0 + 1].role if not loop.last else '' %}\n {%- if loop.last or next_role != 'tool' %}\n {{- '<|im_end|>\\n' }}\n {%- endif %}\n {%- else %}\n {{- raise_exception('Unexpected message role: ' + message.role) }}\n {%- endif %}\n{%- endfor %}\n{%- if add_generation_prompt %}\n {{- '<|im_start|>assistant\\n' }}\n {%- if enable_thinking is defined and enable_thinking is false %}\n {{- '<think>\\n\\n</think>\\n\\n' }}\n {%- else %}\n {{- '<think>\\n' }}\n {%- endif %}\n{%- endif %}","clean_up_tokenization_spaces":false,"eos_token":"<|im_end|>","errors":"replace","model_max_length":262144,"pad_token":"<|endoftext|>","split_special_tokens":false,"tokenizer_class":"Qwen2Tokenizer","unk_token":null,"add_bos_token":false,"pretokenize_regex":"(?i:'s|'t|'re|'ve|'m|'ll|'d)|[^\\r\\n\\p{L}\\p{N}]?[\\p{L}\\p{M}]+|\\p{N}| ?[^\\s\\p{L}\\p{M}\\p{N}]+[\\r\\n]*|\\s*[\\r\\n]+|\\s+(?!\\S)|\\s+","extra_special_tokens":{"audio_bos_token":"<|audio_start|>","audio_eos_token":"<|audio_end|>","audio_token":"<|audio_pad|>","image_token":"<|image_pad|>","video_token":"<|video_pad|>","vision_bos_token":"<|vision_start|>","vision_eos_token":"<|vision_end|>"}}
vocab.json ADDED
The diff for this file is too large to render. See raw diff