danielhanchen commited on
Commit
55deeaa
·
verified ·
1 Parent(s): b49b7b6

Add files using upload-large-folder tool

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,364 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - unsloth
4
+ library_name: transformers
5
+ license: apache-2.0
6
+ license_link: https://huggingface.co/Qwen/Qwen3-30B-A3B-FP8/blob/main/LICENSE
7
+ pipeline_tag: text-generation
8
+ base_model:
9
+ - Qwen/Qwen3-30B-A3B-FP8
10
+ ---
11
+
12
+ # Qwen3-30B-A3B-FP8
13
+ <a href="https://chat.qwen.ai/" target="_blank" style="margin: 2px;">
14
+ <img alt="Chat" src="https://img.shields.io/badge/%F0%9F%92%9C%EF%B8%8F%20Qwen%20Chat%20-536af5" style="display: inline-block; vertical-align: middle;"/>
15
+ </a>
16
+
17
+ ## Qwen3 Highlights
18
+
19
+ Qwen3 is the latest generation of large language models in Qwen series, offering a comprehensive suite of dense and mixture-of-experts (MoE) models. Built upon extensive training, Qwen3 delivers groundbreaking advancements in reasoning, instruction-following, agent capabilities, and multilingual support, with the following key features:
20
+
21
+ - **Uniquely support of seamless switching between thinking mode** (for complex logical reasoning, math, and coding) and **non-thinking mode** (for efficient, general-purpose dialogue) **within single model**, ensuring optimal performance across various scenarios.
22
+ - **Significantly enhancement in its reasoning capabilities**, surpassing previous QwQ (in thinking mode) and Qwen2.5 instruct models (in non-thinking mode) on mathematics, code generation, and commonsense logical reasoning.
23
+ - **Superior human preference alignment**, excelling in creative writing, role-playing, multi-turn dialogues, and instruction following, to deliver a more natural, engaging, and immersive conversational experience.
24
+ - **Expertise in agent capabilities**, enabling precise integration with external tools in both thinking and unthinking modes and achieving leading performance among open-source models in complex agent-based tasks.
25
+ - **Support of 100+ languages and dialects** with strong capabilities for **multilingual instruction following** and **translation**.
26
+
27
+ ## Model Overview
28
+
29
+ This repo contains the FP8 version of **Qwen3-30B-A3B**, which has the following features:
30
+ - Type: Causal Language Models
31
+ - Training Stage: Pretraining & Post-training
32
+ - Number of Parameters: 30.5B in total and 3.3B activated
33
+ - Number of Paramaters (Non-Embedding): 29.9B
34
+ - Number of Layers: 48
35
+ - Number of Attention Heads (GQA): 32 for Q and 4 for KV
36
+ - Number of Experts: 128
37
+ - Number of Activated Experts: 8
38
+ - Context Length: 32,768 natively and [131,072 tokens with YaRN](#processing-long-texts).
39
+
40
+ For more details, including benchmark evaluation, hardware requirements, and inference performance, please refer to our [blog](https://qwenlm.github.io/blog/qwen3/), [GitHub](https://github.com/QwenLM/Qwen3), and [Documentation](https://qwen.readthedocs.io/en/latest/).
41
+
42
+ ## Quickstart
43
+
44
+ The code of Qwen3-MoE has been in the latest Hugging Face `transformers` and we advise you to use the latest version of `transformers`.
45
+
46
+ With `transformers<4.51.0`, you will encounter the following error:
47
+ ```
48
+ KeyError: 'qwen3moe'
49
+ ```
50
+
51
+ The following contains a code snippet illustrating how to use the model generate content based on given inputs.
52
+ ```python
53
+ from transformers import AutoModelForCausalLM, AutoTokenizer
54
+
55
+ model_name = "Qwen/Qwen3-30B-A3B-FP8"
56
+
57
+ # load the tokenizer and the model
58
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
59
+ model = AutoModelForCausalLM.from_pretrained(
60
+ model_name,
61
+ torch_dtype="auto",
62
+ device_map="auto"
63
+ )
64
+
65
+ # prepare the model input
66
+ prompt = "Give me a short introduction to large language model."
67
+ messages = [
68
+ {"role": "user", "content": prompt}
69
+ ]
70
+ text = tokenizer.apply_chat_template(
71
+ messages,
72
+ tokenize=False,
73
+ add_generation_prompt=True,
74
+ enable_thinking=True # Switch between thinking and non-thinking modes. Default is True.
75
+ )
76
+ model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
77
+
78
+ # conduct text completion
79
+ generated_ids = model.generate(
80
+ **model_inputs,
81
+ max_new_tokens=32768
82
+ )
83
+ output_ids = generated_ids[0][len(model_inputs.input_ids[0]):].tolist()
84
+
85
+ # parsing thinking content
86
+ try:
87
+ # rindex finding 151668 (</think>)
88
+ index = len(output_ids) - output_ids[::-1].index(151668)
89
+ except ValueError:
90
+ index = 0
91
+
92
+ thinking_content = tokenizer.decode(output_ids[:index], skip_special_tokens=True).strip("\n")
93
+ content = tokenizer.decode(output_ids[index:], skip_special_tokens=True).strip("\n")
94
+
95
+ print("thinking content:", thinking_content)
96
+ print("content:", content)
97
+ ```
98
+
99
+ For deployment, you can use `sglang>=0.4.6.post1` or `vllm>=0.8.5` or to create an OpenAI-compatible API endpoint:
100
+ - SGLang:
101
+ ```shell
102
+ python -m sglang.launch_server --model-path Qwen/Qwen3-30B-A3B-FP8 --reasoning-parser qwen3
103
+ ```
104
+ - vLLM:
105
+ ```shell
106
+ vllm serve Qwen/Qwen3-30B-A3B-FP8 --enable-reasoning --reasoning-parser deepseek_r1
107
+ ```
108
+
109
+ For local use, applications such as Ollama, LMStudio, MLX-LM, llama.cpp, and KTransformers have also supported Qwen3.
110
+
111
+ ## Notes on FP8
112
+
113
+ For convenience and performance, we have provided `fp8`-quantized model checkpoint for Qwen3, whose name ends with `-FP8`. The quantization method is fine-grained `fp8` quantization with block size of 128. You can find more details in the `quantization_config` field in `config.json`.
114
+
115
+ You can use the Qwen3-30B-A3B-FP8 model with serveral inference frameworks, including `transformers`, `sglang`, and `vllm`, as the original bfloat16 model.
116
+ However, please pay attention to the following known issues:
117
+ - `transformers`:
118
+ - there are currently issues with the "fine-grained fp8" method in `transformers` for distributed inference. You may need to set the environment variable `CUDA_LAUNCH_BLOCKING=1` if multiple devices are used in inference.
119
+
120
+ ## Switching Between Thinking and Non-Thinking Mode
121
+
122
+ > [!TIP]
123
+ > The `enable_thinking` switch is also available in APIs created by SGLang and vLLM.
124
+ > Please refer to our documentation for [SGLang](https://qwen.readthedocs.io/en/latest/deployment/sglang.html#thinking-non-thinking-modes) and [vLLM](https://qwen.readthedocs.io/en/latest/deployment/vllm.html#thinking-non-thinking-modes) users.
125
+
126
+ ### `enable_thinking=True`
127
+
128
+ By default, Qwen3 has thinking capabilities enabled, similar to QwQ-32B. This means the model will use its reasoning abilities to enhance the quality of generated responses. For example, when explicitly setting `enable_thinking=True` or leaving it as the default value in `tokenizer.apply_chat_template`, the model will engage its thinking mode.
129
+
130
+ ```python
131
+ text = tokenizer.apply_chat_template(
132
+ messages,
133
+ tokenize=False,
134
+ add_generation_prompt=True,
135
+ enable_thinking=True # True is the default value for enable_thinking
136
+ )
137
+ ```
138
+
139
+ In this mode, the model will generate think content wrapped in a `<think>...</think>` block, followed by the final response.
140
+
141
+ > [!NOTE]
142
+ > For thinking mode, use `Temperature=0.6`, `TopP=0.95`, `TopK=20`, and `MinP=0` (the default setting in `generation_config.json`). **DO NOT use greedy decoding**, as it can lead to performance degradation and endless repetitions. For more detailed guidance, please refer to the [Best Practices](#best-practices) section.
143
+
144
+
145
+ ### `enable_thinking=False`
146
+
147
+ We provide a hard switch to strictly disable the model's thinking behavior, aligning its functionality with the previous Qwen2.5-Instruct models. This mode is particularly useful in scenarios where disabling thinking is essential for enhancing efficiency.
148
+
149
+ ```python
150
+ text = tokenizer.apply_chat_template(
151
+ messages,
152
+ tokenize=False,
153
+ add_generation_prompt=True,
154
+ enable_thinking=False # Setting enable_thinking=False disables thinking mode
155
+ )
156
+ ```
157
+
158
+ In this mode, the model will not generate any think content and will not include a `<think>...</think>` block.
159
+
160
+ > [!NOTE]
161
+ > For non-thinking mode, we suggest using `Temperature=0.7`, `TopP=0.8`, `TopK=20`, and `MinP=0`. For more detailed guidance, please refer to the [Best Practices](#best-practices) section.
162
+
163
+ ### Advanced Usage: Switching Between Thinking and Non-Thinking Modes via User Input
164
+
165
+ We provide a soft switch mechanism that allows users to dynamically control the model's behavior when `enable_thinking=True`. Specifically, you can add `/think` and `/no_think` to user prompts or system messages to switch the model's thinking mode from turn to turn. The model will follow the most recent instruction in multi-turn conversations.
166
+
167
+ Here is an example of a multi-turn conversation:
168
+
169
+ ```python
170
+ from transformers import AutoModelForCausalLM, AutoTokenizer
171
+
172
+ class QwenChatbot:
173
+ def __init__(self, model_name="Qwen/Qwen3-30B-A3B-FP8"):
174
+ self.tokenizer = AutoTokenizer.from_pretrained(model_name)
175
+ self.model = AutoModelForCausalLM.from_pretrained(model_name)
176
+ self.history = []
177
+
178
+ def generate_response(self, user_input):
179
+ messages = self.history + [{"role": "user", "content": user_input}]
180
+
181
+ text = self.tokenizer.apply_chat_template(
182
+ messages,
183
+ tokenize=False,
184
+ add_generation_prompt=True
185
+ )
186
+
187
+ inputs = self.tokenizer(text, return_tensors="pt")
188
+ response_ids = self.model.generate(**inputs, max_new_tokens=32768)[0][len(inputs.input_ids[0]):].tolist()
189
+ response = self.tokenizer.decode(response_ids, skip_special_tokens=True)
190
+
191
+ # Update history
192
+ self.history.append({"role": "user", "content": user_input})
193
+ self.history.append({"role": "assistant", "content": response})
194
+
195
+ return response
196
+
197
+ # Example Usage
198
+ if __name__ == "__main__":
199
+ chatbot = QwenChatbot()
200
+
201
+ # First input (without /think or /no_think tags, thinking mode is enabled by default)
202
+ user_input_1 = "How many r's in strawberries?"
203
+ print(f"User: {user_input_1}")
204
+ response_1 = chatbot.generate_response(user_input_1)
205
+ print(f"Bot: {response_1}")
206
+ print("----------------------")
207
+
208
+ # Second input with /no_think
209
+ user_input_2 = "Then, how many r's in blueberries? /no_think"
210
+ print(f"User: {user_input_2}")
211
+ response_2 = chatbot.generate_response(user_input_2)
212
+ print(f"Bot: {response_2}")
213
+ print("----------------------")
214
+
215
+ # Third input with /think
216
+ user_input_3 = "Really? /think"
217
+ print(f"User: {user_input_3}")
218
+ response_3 = chatbot.generate_response(user_input_3)
219
+ print(f"Bot: {response_3}")
220
+ ```
221
+
222
+ > [!NOTE]
223
+ > For API compatibility, when `enable_thinking=True`, regardless of whether the user uses `/think` or `/no_think`, the model will always output a block wrapped in `<think>...</think>`. However, the content inside this block may be empty if thinking is disabled.
224
+ > When `enable_thinking=False`, the soft switches are not valid. Regardless of any `/think` or `/no_think` tags input by the user, the model will not generate think content and will not include a `<think>...</think>` block.
225
+
226
+ ## Agentic Use
227
+
228
+ Qwen3 excels in tool calling capabilities. We recommend using [Qwen-Agent](https://github.com/QwenLM/Qwen-Agent) to make the best use of agentic ability of Qwen3. Qwen-Agent encapsulates tool-calling templates and tool-calling parsers internally, greatly reducing coding complexity.
229
+
230
+ To define the available tools, you can use the MCP configuration file, use the integrated tool of Qwen-Agent, or integrate other tools by yourself.
231
+ ```python
232
+ from qwen_agent.agents import Assistant
233
+
234
+ # Define LLM
235
+ llm_cfg = {
236
+ 'model': 'Qwen3-30B-A3B-FP8',
237
+
238
+ # Use the endpoint provided by Alibaba Model Studio:
239
+ # 'model_type': 'qwen_dashscope',
240
+ # 'api_key': os.getenv('DASHSCOPE_API_KEY'),
241
+
242
+ # Use a custom endpoint compatible with OpenAI API:
243
+ 'model_server': 'http://localhost:8000/v1', # api_base
244
+ 'api_key': 'EMPTY',
245
+
246
+ # Other parameters:
247
+ # 'generate_cfg': {
248
+ # # Add: When the response content is `<think>this is the thought</think>this is the answer;
249
+ # # Do not add: When the response has been separated by reasoning_content and content.
250
+ # 'thought_in_content': True,
251
+ # },
252
+ }
253
+
254
+ # Define Tools
255
+ tools = [
256
+ {'mcpServers': { # You can specify the MCP configuration file
257
+ 'time': {
258
+ 'command': 'uvx',
259
+ 'args': ['mcp-server-time', '--local-timezone=Asia/Shanghai']
260
+ },
261
+ "fetch": {
262
+ "command": "uvx",
263
+ "args": ["mcp-server-fetch"]
264
+ }
265
+ }
266
+ },
267
+ 'code_interpreter', # Built-in tools
268
+ ]
269
+
270
+ # Define Agent
271
+ bot = Assistant(llm=llm_cfg, function_list=tools)
272
+
273
+ # Streaming generation
274
+ messages = [{'role': 'user', 'content': 'https://qwenlm.github.io/blog/ Introduce the latest developments of Qwen'}]
275
+ for responses in bot.run(messages=messages):
276
+ pass
277
+ print(responses)
278
+ ```
279
+
280
+ ## Processing Long Texts
281
+
282
+ Qwen3 natively supports context lengths of up to 32,768 tokens. For conversations where the total length (including both input and output) significantly exceeds this limit, we recommend using RoPE scaling techniques to handle long texts effectively. We have validated the model's performance on context lengths of up to 131,072 tokens using the [YaRN](https://arxiv.org/abs/2309.00071) method.
283
+
284
+ YaRN is currently supported by several inference frameworks, e.g., `transformers` and `llama.cpp` for local use, `vllm` and `sglang` for deployment. In general, there are two approaches to enabling YaRN for supported frameworks:
285
+
286
+ - Modifying the model files:
287
+ In the `config.json` file, add the `rope_scaling` fields:
288
+ ```json
289
+ {
290
+ ...,
291
+ "rope_scaling": {
292
+ "rope_type": "yarn",
293
+ "factor": 4.0,
294
+ "original_max_position_embeddings": 32768
295
+ }
296
+ }
297
+ ```
298
+ For `llama.cpp`, you need to regenerate the GGUF file after the modification.
299
+
300
+ - Passing command line arguments:
301
+
302
+ For `vllm`, you can use
303
+ ```shell
304
+ vllm serve ... --rope-scaling '{"rope_type":"yarn","factor":4.0,"original_max_position_embeddings":32768}' --max-model-len 131072
305
+ ```
306
+
307
+ For `sglang`, you can use
308
+ ```shell
309
+ python -m sglang.launch_server ... --json-model-override-args '{"rope_scaling":{"rope_type":"yarn","factor":4.0,"original_max_position_embeddings":32768}}'
310
+ ```
311
+
312
+ For `llama-server` from `llama.cpp`, you can use
313
+ ```shell
314
+ llama-server ... --rope-scaling yarn --rope-scale 4 --yarn-orig-ctx 32768
315
+ ```
316
+
317
+ > [!IMPORTANT]
318
+ > If you encounter the following warning
319
+ > ```
320
+ > Unrecognized keys in `rope_scaling` for 'rope_type'='yarn': {'original_max_position_embeddings'}
321
+ > ```
322
+ > please upgrade `transformers>=4.51.0`.
323
+
324
+ > [!NOTE]
325
+ > All the notable open-source frameworks implement static YaRN, which means the scaling factor remains constant regardless of input length, **potentially impacting performance on shorter texts.**
326
+ > We advise adding the `rope_scaling` configuration only when processing long contexts is required.
327
+ > It is also recommended to modify the `factor` as needed. For example, if the typical context length for your application is 65,536 tokens, it would be better to set `factor` as 2.0.
328
+
329
+ > [!NOTE]
330
+ > The default `max_position_embeddings` in `config.json` is set to 40,960. This allocation includes reserving 32,768 tokens for outputs and 8,192 tokens for typical prompts, which is sufficient for most scenarios involving short text processing. If the average context length does not exceed 32,768 tokens, we do not recommend enabling YaRN in this scenario, as it may potentially degrade model performance.
331
+
332
+ > [!TIP]
333
+ > The endpoint provided by Alibaba Model Studio supports dynamic YaRN by default and no extra configuration is needed.
334
+
335
+ ## Best Practices
336
+
337
+ To achieve optimal performance, we recommend the following settings:
338
+
339
+ 1. **Sampling Parameters**:
340
+ - For thinking mode (`enable_thinking=True`), use `Temperature=0.6`, `TopP=0.95`, `TopK=20`, and `MinP=0`. **DO NOT use greedy decoding**, as it can lead to performance degradation and endless repetitions.
341
+ - For non-thinking mode (`enable_thinking=False`), we suggest using `Temperature=0.7`, `TopP=0.8`, `TopK=20`, and `MinP=0`.
342
+ - For supported frameworks, you can adjust the `presence_penalty` parameter between 0 and 2 to reduce endless repetitions. However, using a higher value may occasionally result in language mixing and a slight decrease in model performance.
343
+
344
+ 2. **Adequate Output Length**: We recommend using an output length of 32,768 tokens for most queries. For benchmarking on highly complex problems, such as those found in math and programming competitions, we suggest setting the max output length to 38,912 tokens. This provides the model with sufficient space to generate detailed and comprehensive responses, thereby enhancing its overall performance.
345
+
346
+ 3. **Standardize Output Format**: We recommend using prompts to standardize model outputs when benchmarking.
347
+ - **Math Problems**: Include "Please reason step by step, and put your final answer within \boxed{}." in the prompt.
348
+ - **Multiple-Choice Questions**: Add the following JSON structure to the prompt to standardize responses: "Please show your choice in the `answer` field with only the choice letter, e.g., `"answer": "C"`."
349
+
350
+ 4. **No Thinking Content in History**: In multi-turn conversations, the historical model output should only include the final output part and does not need to include the thinking content. It is implemented in the provided chat template in Jinja2. However, for frameworks that do not directly use the Jinja2 chat template, it is up to the developers to ensure that the best practice is followed.
351
+
352
+ ### Citation
353
+
354
+ If you find our work helpful, feel free to give us a cite.
355
+
356
+ ```
357
+ @misc{qwen3,
358
+ title = {Qwen3},
359
+ url = {https://qwenlm.github.io/blog/qwen3/},
360
+ author = {Qwen Team},
361
+ month = {April},
362
+ year = {2025}
363
+ }
364
+ ```
added_tokens.json ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "</think>": 151668,
3
+ "</tool_call>": 151658,
4
+ "</tool_response>": 151666,
5
+ "<think>": 151667,
6
+ "<tool_call>": 151657,
7
+ "<tool_response>": 151665,
8
+ "<|box_end|>": 151649,
9
+ "<|box_start|>": 151648,
10
+ "<|endoftext|>": 151643,
11
+ "<|file_sep|>": 151664,
12
+ "<|fim_middle|>": 151660,
13
+ "<|fim_pad|>": 151662,
14
+ "<|fim_prefix|>": 151659,
15
+ "<|fim_suffix|>": 151661,
16
+ "<|im_end|>": 151645,
17
+ "<|im_start|>": 151644,
18
+ "<|image_pad|>": 151655,
19
+ "<|object_ref_end|>": 151647,
20
+ "<|object_ref_start|>": 151646,
21
+ "<|quad_end|>": 151651,
22
+ "<|quad_start|>": 151650,
23
+ "<|repo_name|>": 151663,
24
+ "<|video_pad|>": 151656,
25
+ "<|vision_end|>": 151653,
26
+ "<|vision_pad|>": 151654,
27
+ "<|vision_start|>": 151652
28
+ }
chat_template.jinja ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- if tools %}
2
+ {{- '<|im_start|>system\n' }}
3
+ {%- if messages[0].role == 'system' %}
4
+ {{- messages[0].content + '\n\n' }}
5
+ {%- endif %}
6
+ {{- "# 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>" }}
7
+ {%- for tool in tools %}
8
+ {{- "\n" }}
9
+ {{- tool | tojson }}
10
+ {%- endfor %}
11
+ {{- "\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" }}
12
+ {%- else %}
13
+ {%- if messages[0].role == 'system' %}
14
+ {{- '<|im_start|>system\n' + messages[0].content + '<|im_end|>\n' }}
15
+ {%- endif %}
16
+ {%- endif %}
17
+ {%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
18
+ {%- for forward_message in messages %}
19
+ {%- set index = (messages|length - 1) - loop.index0 %}
20
+ {%- set message = messages[index] %}
21
+ {%- set current_content = message.content if message.content is not none else '' %}
22
+ {%- set tool_start = '<tool_response>' %}
23
+ {%- set tool_start_length = tool_start|length %}
24
+ {%- set start_of_message = current_content[:tool_start_length] %}
25
+ {%- set tool_end = '</tool_response>' %}
26
+ {%- set tool_end_length = tool_end|length %}
27
+ {%- set start_pos = (current_content|length) - tool_end_length %}
28
+ {%- if start_pos < 0 %}
29
+ {%- set start_pos = 0 %}
30
+ {%- endif %}
31
+ {%- set end_of_message = current_content[start_pos:] %}
32
+ {%- if ns.multi_step_tool and message.role == "user" and not(start_of_message == tool_start and end_of_message == tool_end) %}
33
+ {%- set ns.multi_step_tool = false %}
34
+ {%- set ns.last_query_index = index %}
35
+ {%- endif %}
36
+ {%- endfor %}
37
+ {%- for message in messages %}
38
+ {%- if (message.role == "user") or (message.role == "system" and not loop.first) %}
39
+ {{- '<|im_start|>' + message.role + '\n' + message.content + '<|im_end|>' + '\n' }}
40
+ {%- elif message.role == "assistant" %}
41
+ {%- set content = message.content %}
42
+ {%- set reasoning_content = '' %}
43
+ {%- if message.reasoning_content is defined and message.reasoning_content is not none %}
44
+ {%- set reasoning_content = message.reasoning_content %}
45
+ {%- else %}
46
+ {%- if '</think>' in message.content %}
47
+ {%- set content = (message.content.split('</think>')|last).lstrip('\n') %}
48
+ {%- set reasoning_content = (message.content.split('</think>')|first).rstrip('\n') %}
49
+ {%- set reasoning_content = (reasoning_content.split('<think>')|last).lstrip('\n') %}
50
+ {%- endif %}
51
+ {%- endif %}
52
+ {%- if loop.index0 > ns.last_query_index %}
53
+ {%- if loop.last or (not loop.last and reasoning_content) %}
54
+ {{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }}
55
+ {%- else %}
56
+ {{- '<|im_start|>' + message.role + '\n' + content }}
57
+ {%- endif %}
58
+ {%- else %}
59
+ {{- '<|im_start|>' + message.role + '\n' + content }}
60
+ {%- endif %}
61
+ {%- if message.tool_calls %}
62
+ {%- for tool_call in message.tool_calls %}
63
+ {%- if (loop.first and content) or (not loop.first) %}
64
+ {{- '\n' }}
65
+ {%- endif %}
66
+ {%- if tool_call.function %}
67
+ {%- set tool_call = tool_call.function %}
68
+ {%- endif %}
69
+ {{- '<tool_call>\n{"name": "' }}
70
+ {{- tool_call.name }}
71
+ {{- '", "arguments": ' }}
72
+ {%- if tool_call.arguments is string %}
73
+ {{- tool_call.arguments }}
74
+ {%- else %}
75
+ {{- tool_call.arguments | tojson }}
76
+ {%- endif %}
77
+ {{- '}\n</tool_call>' }}
78
+ {%- endfor %}
79
+ {%- endif %}
80
+ {{- '<|im_end|>\n' }}
81
+ {%- elif message.role == "tool" %}
82
+ {%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
83
+ {{- '<|im_start|>user' }}
84
+ {%- endif %}
85
+ {{- '\n<tool_response>\n' }}
86
+ {{- message.content }}
87
+ {{- '\n</tool_response>' }}
88
+ {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
89
+ {{- '<|im_end|>\n' }}
90
+ {%- endif %}
91
+ {%- endif %}
92
+ {%- endfor %}
93
+ {%- if add_generation_prompt %}
94
+ {{- '<|im_start|>assistant\n' }}
95
+ {%- if enable_thinking is defined and enable_thinking is false %}
96
+ {{- '<think>\n\n</think>\n\n' }}
97
+ {%- endif %}
98
+ {%- endif %}
config.json ADDED
@@ -0,0 +1,194 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Qwen3MoeForCausalLM"
4
+ ],
5
+ "attention_bias": false,
6
+ "attention_dropout": 0.0,
7
+ "decoder_sparse_step": 1,
8
+ "eos_token_id": 151645,
9
+ "head_dim": 128,
10
+ "hidden_act": "silu",
11
+ "hidden_size": 2048,
12
+ "initializer_range": 0.02,
13
+ "intermediate_size": 6144,
14
+ "max_position_embeddings": 40960,
15
+ "max_window_layers": 48,
16
+ "mlp_only_layers": [],
17
+ "model_type": "qwen3_moe",
18
+ "moe_intermediate_size": 768,
19
+ "norm_topk_prob": true,
20
+ "num_attention_heads": 32,
21
+ "num_experts": 128,
22
+ "num_experts_per_tok": 8,
23
+ "num_hidden_layers": 48,
24
+ "num_key_value_heads": 4,
25
+ "output_router_logits": false,
26
+ "pad_token_id": 151654,
27
+ "quantization_config": {
28
+ "activation_scheme": "dynamic",
29
+ "modules_to_not_convert": [
30
+ "lm_head",
31
+ "model.layers.0.input_layernorm",
32
+ "model.layers.0.mlp.gate",
33
+ "model.layers.0.post_attention_layernorm",
34
+ "model.layers.1.input_layernorm",
35
+ "model.layers.1.mlp.gate",
36
+ "model.layers.1.post_attention_layernorm",
37
+ "model.layers.2.input_layernorm",
38
+ "model.layers.2.mlp.gate",
39
+ "model.layers.2.post_attention_layernorm",
40
+ "model.layers.3.input_layernorm",
41
+ "model.layers.3.mlp.gate",
42
+ "model.layers.3.post_attention_layernorm",
43
+ "model.layers.4.input_layernorm",
44
+ "model.layers.4.mlp.gate",
45
+ "model.layers.4.post_attention_layernorm",
46
+ "model.layers.5.input_layernorm",
47
+ "model.layers.5.mlp.gate",
48
+ "model.layers.5.post_attention_layernorm",
49
+ "model.layers.6.input_layernorm",
50
+ "model.layers.6.mlp.gate",
51
+ "model.layers.6.post_attention_layernorm",
52
+ "model.layers.7.input_layernorm",
53
+ "model.layers.7.mlp.gate",
54
+ "model.layers.7.post_attention_layernorm",
55
+ "model.layers.8.input_layernorm",
56
+ "model.layers.8.mlp.gate",
57
+ "model.layers.8.post_attention_layernorm",
58
+ "model.layers.9.input_layernorm",
59
+ "model.layers.9.mlp.gate",
60
+ "model.layers.9.post_attention_layernorm",
61
+ "model.layers.10.input_layernorm",
62
+ "model.layers.10.mlp.gate",
63
+ "model.layers.10.post_attention_layernorm",
64
+ "model.layers.11.input_layernorm",
65
+ "model.layers.11.mlp.gate",
66
+ "model.layers.11.post_attention_layernorm",
67
+ "model.layers.12.input_layernorm",
68
+ "model.layers.12.mlp.gate",
69
+ "model.layers.12.post_attention_layernorm",
70
+ "model.layers.13.input_layernorm",
71
+ "model.layers.13.mlp.gate",
72
+ "model.layers.13.post_attention_layernorm",
73
+ "model.layers.14.input_layernorm",
74
+ "model.layers.14.mlp.gate",
75
+ "model.layers.14.post_attention_layernorm",
76
+ "model.layers.15.input_layernorm",
77
+ "model.layers.15.mlp.gate",
78
+ "model.layers.15.post_attention_layernorm",
79
+ "model.layers.16.input_layernorm",
80
+ "model.layers.16.mlp.gate",
81
+ "model.layers.16.post_attention_layernorm",
82
+ "model.layers.17.input_layernorm",
83
+ "model.layers.17.mlp.gate",
84
+ "model.layers.17.post_attention_layernorm",
85
+ "model.layers.18.input_layernorm",
86
+ "model.layers.18.mlp.gate",
87
+ "model.layers.18.post_attention_layernorm",
88
+ "model.layers.19.input_layernorm",
89
+ "model.layers.19.mlp.gate",
90
+ "model.layers.19.post_attention_layernorm",
91
+ "model.layers.20.input_layernorm",
92
+ "model.layers.20.mlp.gate",
93
+ "model.layers.20.post_attention_layernorm",
94
+ "model.layers.21.input_layernorm",
95
+ "model.layers.21.mlp.gate",
96
+ "model.layers.21.post_attention_layernorm",
97
+ "model.layers.22.input_layernorm",
98
+ "model.layers.22.mlp.gate",
99
+ "model.layers.22.post_attention_layernorm",
100
+ "model.layers.23.input_layernorm",
101
+ "model.layers.23.mlp.gate",
102
+ "model.layers.23.post_attention_layernorm",
103
+ "model.layers.24.input_layernorm",
104
+ "model.layers.24.mlp.gate",
105
+ "model.layers.24.post_attention_layernorm",
106
+ "model.layers.25.input_layernorm",
107
+ "model.layers.25.mlp.gate",
108
+ "model.layers.25.post_attention_layernorm",
109
+ "model.layers.26.input_layernorm",
110
+ "model.layers.26.mlp.gate",
111
+ "model.layers.26.post_attention_layernorm",
112
+ "model.layers.27.input_layernorm",
113
+ "model.layers.27.mlp.gate",
114
+ "model.layers.27.post_attention_layernorm",
115
+ "model.layers.28.input_layernorm",
116
+ "model.layers.28.mlp.gate",
117
+ "model.layers.28.post_attention_layernorm",
118
+ "model.layers.29.input_layernorm",
119
+ "model.layers.29.mlp.gate",
120
+ "model.layers.29.post_attention_layernorm",
121
+ "model.layers.30.input_layernorm",
122
+ "model.layers.30.mlp.gate",
123
+ "model.layers.30.post_attention_layernorm",
124
+ "model.layers.31.input_layernorm",
125
+ "model.layers.31.mlp.gate",
126
+ "model.layers.31.post_attention_layernorm",
127
+ "model.layers.32.input_layernorm",
128
+ "model.layers.32.mlp.gate",
129
+ "model.layers.32.post_attention_layernorm",
130
+ "model.layers.33.input_layernorm",
131
+ "model.layers.33.mlp.gate",
132
+ "model.layers.33.post_attention_layernorm",
133
+ "model.layers.34.input_layernorm",
134
+ "model.layers.34.mlp.gate",
135
+ "model.layers.34.post_attention_layernorm",
136
+ "model.layers.35.input_layernorm",
137
+ "model.layers.35.mlp.gate",
138
+ "model.layers.35.post_attention_layernorm",
139
+ "model.layers.36.input_layernorm",
140
+ "model.layers.36.mlp.gate",
141
+ "model.layers.36.post_attention_layernorm",
142
+ "model.layers.37.input_layernorm",
143
+ "model.layers.37.mlp.gate",
144
+ "model.layers.37.post_attention_layernorm",
145
+ "model.layers.38.input_layernorm",
146
+ "model.layers.38.mlp.gate",
147
+ "model.layers.38.post_attention_layernorm",
148
+ "model.layers.39.input_layernorm",
149
+ "model.layers.39.mlp.gate",
150
+ "model.layers.39.post_attention_layernorm",
151
+ "model.layers.40.input_layernorm",
152
+ "model.layers.40.mlp.gate",
153
+ "model.layers.40.post_attention_layernorm",
154
+ "model.layers.41.input_layernorm",
155
+ "model.layers.41.mlp.gate",
156
+ "model.layers.41.post_attention_layernorm",
157
+ "model.layers.42.input_layernorm",
158
+ "model.layers.42.mlp.gate",
159
+ "model.layers.42.post_attention_layernorm",
160
+ "model.layers.43.input_layernorm",
161
+ "model.layers.43.mlp.gate",
162
+ "model.layers.43.post_attention_layernorm",
163
+ "model.layers.44.input_layernorm",
164
+ "model.layers.44.mlp.gate",
165
+ "model.layers.44.post_attention_layernorm",
166
+ "model.layers.45.input_layernorm",
167
+ "model.layers.45.mlp.gate",
168
+ "model.layers.45.post_attention_layernorm",
169
+ "model.layers.46.input_layernorm",
170
+ "model.layers.46.mlp.gate",
171
+ "model.layers.46.post_attention_layernorm",
172
+ "model.layers.47.input_layernorm",
173
+ "model.layers.47.mlp.gate",
174
+ "model.layers.47.post_attention_layernorm"
175
+ ],
176
+ "quant_method": "fp8",
177
+ "weight_block_size": [
178
+ 128,
179
+ 128
180
+ ]
181
+ },
182
+ "rms_norm_eps": 1e-06,
183
+ "rope_scaling": null,
184
+ "rope_theta": 1000000.0,
185
+ "router_aux_loss_coef": 0.001,
186
+ "sliding_window": null,
187
+ "tie_word_embeddings": false,
188
+ "torch_dtype": "bfloat16",
189
+ "transformers_version": "4.52.0.dev0",
190
+ "unsloth_fixed": true,
191
+ "use_cache": true,
192
+ "use_sliding_window": false,
193
+ "vocab_size": 151936
194
+ }
generation_config.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token_id": 151643,
3
+ "do_sample": true,
4
+ "eos_token_id": [
5
+ 151645,
6
+ 151643
7
+ ],
8
+ "max_length": 40960,
9
+ "pad_token_id": 151654,
10
+ "temperature": 0.6,
11
+ "top_k": 20,
12
+ "top_p": 0.95,
13
+ "transformers_version": "4.52.0.dev0"
14
+ }
merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
model-00001-of-00007.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d32cb48fdd9039062cd2acc83c9a7d976cf00d5f641f067d9f1aaef5753b6f46
3
+ size 4997752648
model-00002-of-00007.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:543a01afd6bf53d6bfc847345966cc96b2928b419ffc2c78aaf358edd5d1eec9
3
+ size 5000546768
model-00003-of-00007.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:edd9c9853cecc7ed110cf794822b8e603d71731e14559ab62f86d6494ff1a313
3
+ size 4999499712
model-00004-of-00007.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e77e2cba1a3139fce9f4593d4f1ea0f4873463541910e07476573bc8d48efbf1
3
+ size 4999499728
model-00005-of-00007.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:58a370c33b3c8e946649e17d9f656f81201dc0049afdf52d03d1cda609b05b00
3
+ size 4999499736
model-00006-of-00007.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2975a779c67d8c6dc8930f24e11f7cb6c9d77fdd3d0f0528df58c3060e6ee3dc
3
+ size 4999499752
model-00007-of-00007.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e28ebbe8bd93c1a886d5873d606f5daf686b6becd1ff832d16093f64f010343f
3
+ size 1179294608
model.safetensors.index.json ADDED
The diff for this file is too large to render. See raw diff
 
special_tokens_map.json ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ "<|im_start|>",
4
+ "<|im_end|>",
5
+ "<|object_ref_start|>",
6
+ "<|object_ref_end|>",
7
+ "<|box_start|>",
8
+ "<|box_end|>",
9
+ "<|quad_start|>",
10
+ "<|quad_end|>",
11
+ "<|vision_start|>",
12
+ "<|vision_end|>",
13
+ "<|vision_pad|>",
14
+ "<|image_pad|>",
15
+ "<|video_pad|>"
16
+ ],
17
+ "eos_token": {
18
+ "content": "<|im_end|>",
19
+ "lstrip": false,
20
+ "normalized": false,
21
+ "rstrip": false,
22
+ "single_word": false
23
+ },
24
+ "pad_token": {
25
+ "content": "<|vision_pad|>",
26
+ "lstrip": false,
27
+ "normalized": false,
28
+ "rstrip": false,
29
+ "single_word": false
30
+ }
31
+ }
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:aeb13307a71acd8fe81861d94ad54ab689df773318809eed3cbe794b4492dae4
3
+ size 11422654
tokenizer_config.json ADDED
@@ -0,0 +1,241 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": false,
3
+ "add_prefix_space": false,
4
+ "added_tokens_decoder": {
5
+ "151643": {
6
+ "content": "<|endoftext|>",
7
+ "lstrip": false,
8
+ "normalized": false,
9
+ "rstrip": false,
10
+ "single_word": false,
11
+ "special": true
12
+ },
13
+ "151644": {
14
+ "content": "<|im_start|>",
15
+ "lstrip": false,
16
+ "normalized": false,
17
+ "rstrip": false,
18
+ "single_word": false,
19
+ "special": true
20
+ },
21
+ "151645": {
22
+ "content": "<|im_end|>",
23
+ "lstrip": false,
24
+ "normalized": false,
25
+ "rstrip": false,
26
+ "single_word": false,
27
+ "special": true
28
+ },
29
+ "151646": {
30
+ "content": "<|object_ref_start|>",
31
+ "lstrip": false,
32
+ "normalized": false,
33
+ "rstrip": false,
34
+ "single_word": false,
35
+ "special": true
36
+ },
37
+ "151647": {
38
+ "content": "<|object_ref_end|>",
39
+ "lstrip": false,
40
+ "normalized": false,
41
+ "rstrip": false,
42
+ "single_word": false,
43
+ "special": true
44
+ },
45
+ "151648": {
46
+ "content": "<|box_start|>",
47
+ "lstrip": false,
48
+ "normalized": false,
49
+ "rstrip": false,
50
+ "single_word": false,
51
+ "special": true
52
+ },
53
+ "151649": {
54
+ "content": "<|box_end|>",
55
+ "lstrip": false,
56
+ "normalized": false,
57
+ "rstrip": false,
58
+ "single_word": false,
59
+ "special": true
60
+ },
61
+ "151650": {
62
+ "content": "<|quad_start|>",
63
+ "lstrip": false,
64
+ "normalized": false,
65
+ "rstrip": false,
66
+ "single_word": false,
67
+ "special": true
68
+ },
69
+ "151651": {
70
+ "content": "<|quad_end|>",
71
+ "lstrip": false,
72
+ "normalized": false,
73
+ "rstrip": false,
74
+ "single_word": false,
75
+ "special": true
76
+ },
77
+ "151652": {
78
+ "content": "<|vision_start|>",
79
+ "lstrip": false,
80
+ "normalized": false,
81
+ "rstrip": false,
82
+ "single_word": false,
83
+ "special": true
84
+ },
85
+ "151653": {
86
+ "content": "<|vision_end|>",
87
+ "lstrip": false,
88
+ "normalized": false,
89
+ "rstrip": false,
90
+ "single_word": false,
91
+ "special": true
92
+ },
93
+ "151654": {
94
+ "content": "<|vision_pad|>",
95
+ "lstrip": false,
96
+ "normalized": false,
97
+ "rstrip": false,
98
+ "single_word": false,
99
+ "special": true
100
+ },
101
+ "151655": {
102
+ "content": "<|image_pad|>",
103
+ "lstrip": false,
104
+ "normalized": false,
105
+ "rstrip": false,
106
+ "single_word": false,
107
+ "special": true
108
+ },
109
+ "151656": {
110
+ "content": "<|video_pad|>",
111
+ "lstrip": false,
112
+ "normalized": false,
113
+ "rstrip": false,
114
+ "single_word": false,
115
+ "special": true
116
+ },
117
+ "151657": {
118
+ "content": "<tool_call>",
119
+ "lstrip": false,
120
+ "normalized": false,
121
+ "rstrip": false,
122
+ "single_word": false,
123
+ "special": false
124
+ },
125
+ "151658": {
126
+ "content": "</tool_call>",
127
+ "lstrip": false,
128
+ "normalized": false,
129
+ "rstrip": false,
130
+ "single_word": false,
131
+ "special": false
132
+ },
133
+ "151659": {
134
+ "content": "<|fim_prefix|>",
135
+ "lstrip": false,
136
+ "normalized": false,
137
+ "rstrip": false,
138
+ "single_word": false,
139
+ "special": false
140
+ },
141
+ "151660": {
142
+ "content": "<|fim_middle|>",
143
+ "lstrip": false,
144
+ "normalized": false,
145
+ "rstrip": false,
146
+ "single_word": false,
147
+ "special": false
148
+ },
149
+ "151661": {
150
+ "content": "<|fim_suffix|>",
151
+ "lstrip": false,
152
+ "normalized": false,
153
+ "rstrip": false,
154
+ "single_word": false,
155
+ "special": false
156
+ },
157
+ "151662": {
158
+ "content": "<|fim_pad|>",
159
+ "lstrip": false,
160
+ "normalized": false,
161
+ "rstrip": false,
162
+ "single_word": false,
163
+ "special": false
164
+ },
165
+ "151663": {
166
+ "content": "<|repo_name|>",
167
+ "lstrip": false,
168
+ "normalized": false,
169
+ "rstrip": false,
170
+ "single_word": false,
171
+ "special": false
172
+ },
173
+ "151664": {
174
+ "content": "<|file_sep|>",
175
+ "lstrip": false,
176
+ "normalized": false,
177
+ "rstrip": false,
178
+ "single_word": false,
179
+ "special": false
180
+ },
181
+ "151665": {
182
+ "content": "<tool_response>",
183
+ "lstrip": false,
184
+ "normalized": false,
185
+ "rstrip": false,
186
+ "single_word": false,
187
+ "special": false
188
+ },
189
+ "151666": {
190
+ "content": "</tool_response>",
191
+ "lstrip": false,
192
+ "normalized": false,
193
+ "rstrip": false,
194
+ "single_word": false,
195
+ "special": false
196
+ },
197
+ "151667": {
198
+ "content": "<think>",
199
+ "lstrip": false,
200
+ "normalized": false,
201
+ "rstrip": false,
202
+ "single_word": false,
203
+ "special": false
204
+ },
205
+ "151668": {
206
+ "content": "</think>",
207
+ "lstrip": false,
208
+ "normalized": false,
209
+ "rstrip": false,
210
+ "single_word": false,
211
+ "special": false
212
+ }
213
+ },
214
+ "additional_special_tokens": [
215
+ "<|im_start|>",
216
+ "<|im_end|>",
217
+ "<|object_ref_start|>",
218
+ "<|object_ref_end|>",
219
+ "<|box_start|>",
220
+ "<|box_end|>",
221
+ "<|quad_start|>",
222
+ "<|quad_end|>",
223
+ "<|vision_start|>",
224
+ "<|vision_end|>",
225
+ "<|vision_pad|>",
226
+ "<|image_pad|>",
227
+ "<|video_pad|>"
228
+ ],
229
+ "bos_token": null,
230
+ "clean_up_tokenization_spaces": false,
231
+ "eos_token": "<|im_end|>",
232
+ "errors": "replace",
233
+ "extra_special_tokens": {},
234
+ "model_max_length": 40960,
235
+ "pad_token": "<|vision_pad|>",
236
+ "padding_side": "left",
237
+ "split_special_tokens": false,
238
+ "tokenizer_class": "Qwen2Tokenizer",
239
+ "unk_token": null,
240
+ "chat_template": "{%- if tools %}\n {{- '<|im_start|>system\\n' }}\n {%- if messages[0].role == 'system' %}\n {{- messages[0].content + '\\n\\n' }}\n {%- endif %}\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 {{- \"\\n\" }}\n {{- tool | tojson }}\n {%- endfor %}\n {{- \"\\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\" }}\n{%- else %}\n {%- if messages[0].role == 'system' %}\n {{- '<|im_start|>system\\n' + messages[0].content + '<|im_end|>\\n' }}\n {%- endif %}\n{%- endif %}\n{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}\n{%- for forward_message in messages %}\n {%- set index = (messages|length - 1) - loop.index0 %}\n {%- set message = messages[index] %}\n {%- set current_content = message.content if message.content is not none else '' %}\n {%- set tool_start = '<tool_response>' %}\n {%- set tool_start_length = tool_start|length %}\n {%- set start_of_message = current_content[:tool_start_length] %}\n {%- set tool_end = '</tool_response>' %}\n {%- set tool_end_length = tool_end|length %}\n {%- set start_pos = (current_content|length) - tool_end_length %}\n {%- if start_pos < 0 %}\n {%- set start_pos = 0 %}\n {%- endif %}\n {%- set end_of_message = current_content[start_pos:] %}\n {%- if ns.multi_step_tool and message.role == \"user\" and not(start_of_message == tool_start and end_of_message == tool_end) %}\n {%- set ns.multi_step_tool = false %}\n {%- set ns.last_query_index = index %}\n {%- endif %}\n{%- endfor %}\n{%- for message in messages %}\n {%- if (message.role == \"user\") or (message.role == \"system\" and not loop.first) %}\n {{- '<|im_start|>' + message.role + '\\n' + message.content + '<|im_end|>' + '\\n' }}\n {%- elif message.role == \"assistant\" %}\n {%- set content = message.content %}\n {%- set reasoning_content = '' %}\n {%- if message.reasoning_content is defined and message.reasoning_content is not none %}\n {%- set reasoning_content = message.reasoning_content %}\n {%- else %}\n {%- if '</think>' in message.content %}\n {%- set content = (message.content.split('</think>')|last).lstrip('\\n') %}\n {%- set reasoning_content = (message.content.split('</think>')|first).rstrip('\\n') %}\n {%- set reasoning_content = (reasoning_content.split('<think>')|last).lstrip('\\n') %}\n {%- endif %}\n {%- endif %}\n {%- if loop.index0 > ns.last_query_index %}\n {%- if loop.last or (not loop.last and reasoning_content) %}\n {{- '<|im_start|>' + message.role + '\\n<think>\\n' + reasoning_content.strip('\\n') + '\\n</think>\\n\\n' + content.lstrip('\\n') }}\n {%- else %}\n {{- '<|im_start|>' + message.role + '\\n' + content }}\n {%- endif %}\n {%- else %}\n {{- '<|im_start|>' + message.role + '\\n' + content }}\n {%- endif %}\n {%- if message.tool_calls %}\n {%- for tool_call in message.tool_calls %}\n {%- if (loop.first and content) or (not loop.first) %}\n {{- '\\n' }}\n {%- endif %}\n {%- if tool_call.function %}\n {%- set tool_call = tool_call.function %}\n {%- endif %}\n {{- '<tool_call>\\n{\"name\": \"' }}\n {{- tool_call.name }}\n {{- '\", \"arguments\": ' }}\n {%- if tool_call.arguments is string %}\n {{- tool_call.arguments }}\n {%- else %}\n {{- tool_call.arguments | tojson }}\n {%- endif %}\n {{- '}\\n</tool_call>' }}\n {%- endfor %}\n {%- endif %}\n {{- '<|im_end|>\\n' }}\n {%- elif message.role == \"tool\" %}\n {%- if loop.first or (messages[loop.index0 - 1].role != \"tool\") %}\n {{- '<|im_start|>user' }}\n {%- endif %}\n {{- '\\n<tool_response>\\n' }}\n {{- message.content }}\n {{- '\\n</tool_response>' }}\n {%- if loop.last or (messages[loop.index0 + 1].role != \"tool\") %}\n {{- '<|im_end|>\\n' }}\n {%- endif %}\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 {%- endif %}\n{%- endif %}"
241
+ }
vocab.json ADDED
The diff for this file is too large to render. See raw diff