Scott Macdonell littlebird13 commited on
Commit
441e747
·
verified ·
0 Parent(s):

Duplicate from Qwen/Qwen3-30B-A3B-FP8

Browse files

Co-authored-by: cheng <[email protected]>

.gitattributes ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz 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,385 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: transformers
3
+ license: apache-2.0
4
+ license_link: https://huggingface.co/Qwen/Qwen3-30B-A3B-FP8/blob/main/LICENSE
5
+ pipeline_tag: text-generation
6
+ base_model:
7
+ - Qwen/Qwen3-30B-A3B
8
+ ---
9
+
10
+ # Qwen3-30B-A3B-FP8
11
+ <a href="https://chat.qwen.ai/" target="_blank" style="margin: 2px;">
12
+ <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;"/>
13
+ </a>
14
+
15
+ ## Qwen3 Highlights
16
+
17
+ 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:
18
+
19
+ - **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.
20
+ - **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.
21
+ - **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.
22
+ - **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.
23
+ - **Support of 100+ languages and dialects** with strong capabilities for **multilingual instruction following** and **translation**.
24
+
25
+ ## Model Overview
26
+
27
+ This repo contains the FP8 version of **Qwen3-30B-A3B**, which has the following features:
28
+ - Type: Causal Language Models
29
+ - Training Stage: Pretraining & Post-training
30
+ - Number of Parameters: 30.5B in total and 3.3B activated
31
+ - Number of Paramaters (Non-Embedding): 29.9B
32
+ - Number of Layers: 48
33
+ - Number of Attention Heads (GQA): 32 for Q and 4 for KV
34
+ - Number of Experts: 128
35
+ - Number of Activated Experts: 8
36
+ - Context Length: 32,768 natively and [131,072 tokens with YaRN](#processing-long-texts).
37
+
38
+ 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/).
39
+
40
+ ## Quickstart
41
+
42
+ The code of Qwen3-MoE has been in the latest Hugging Face `transformers` and we advise you to use the latest version of `transformers`.
43
+
44
+ With `transformers<4.51.0`, you will encounter the following error:
45
+ ```
46
+ KeyError: 'qwen3moe'
47
+ ```
48
+
49
+ The following contains a code snippet illustrating how to use the model generate content based on given inputs.
50
+ ```python
51
+ from transformers import AutoModelForCausalLM, AutoTokenizer
52
+
53
+ model_name = "Qwen/Qwen3-30B-A3B-FP8"
54
+
55
+ # load the tokenizer and the model
56
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
57
+ model = AutoModelForCausalLM.from_pretrained(
58
+ model_name,
59
+ torch_dtype="auto",
60
+ device_map="auto"
61
+ )
62
+
63
+ # prepare the model input
64
+ prompt = "Give me a short introduction to large language model."
65
+ messages = [
66
+ {"role": "user", "content": prompt}
67
+ ]
68
+ text = tokenizer.apply_chat_template(
69
+ messages,
70
+ tokenize=False,
71
+ add_generation_prompt=True,
72
+ enable_thinking=True # Switch between thinking and non-thinking modes. Default is True.
73
+ )
74
+ model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
75
+
76
+ # conduct text completion
77
+ generated_ids = model.generate(
78
+ **model_inputs,
79
+ max_new_tokens=32768
80
+ )
81
+ output_ids = generated_ids[0][len(model_inputs.input_ids[0]):].tolist()
82
+
83
+ # parsing thinking content
84
+ try:
85
+ # rindex finding 151668 (</think>)
86
+ index = len(output_ids) - output_ids[::-1].index(151668)
87
+ except ValueError:
88
+ index = 0
89
+
90
+ thinking_content = tokenizer.decode(output_ids[:index], skip_special_tokens=True).strip("\n")
91
+ content = tokenizer.decode(output_ids[index:], skip_special_tokens=True).strip("\n")
92
+
93
+ print("thinking content:", thinking_content)
94
+ print("content:", content)
95
+ ```
96
+
97
+ For deployment, you can use `sglang>=0.4.6.post1` or `vllm>=0.8.4` or to create an OpenAI-compatible API endpoint:
98
+ - SGLang:
99
+ ```shell
100
+ python -m sglang.launch_server --model-path Qwen/Qwen3-30B-A3B-FP8 --reasoning-parser qwen3
101
+ ```
102
+ - vLLM:
103
+ ```shell
104
+ vllm serve Qwen/Qwen3-30B-A3B-FP8 --enable-reasoning --reasoning-parser deepseek_r1
105
+ ```
106
+
107
+ For local use, applications such as llama.cpp, Ollama, LMStudio, and MLX-LM have also supported Qwen3.
108
+
109
+ ## Notes on FP8
110
+
111
+ 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`.
112
+
113
+ You can use the Qwen3-30B-A3B-FP8 model with serveral inference frameworks, including `transformers`, `vllm`, and `sglang`, as the original bfloat16 model.
114
+ However, please pay attention to the following known issues:
115
+ - `transformers`:
116
+ - 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.
117
+ - vLLM:
118
+ - there are currently compatibility issues with `vllm`. For a quick fix, you should make the following changes to `vllm/vllm/model_executor/layers/linear.py`:
119
+ ```python
120
+ # these changes are in QKVParallelLinear.weight_loader_v2() of vllm/vllm/model_executor/layers/linear.py
121
+ ...
122
+ shard_offset = self._get_shard_offset_mapping(loaded_shard_id)
123
+ shard_size = self._get_shard_size_mapping(loaded_shard_id)
124
+
125
+ # add the following code
126
+ if isinstance(param, BlockQuantScaleParameter):
127
+ weight_block_size = self.quant_method.quant_config.weight_block_size
128
+ block_n, _ = weight_block_size[0], weight_block_size[1]
129
+ shard_offset = (shard_offset + block_n - 1) // block_n
130
+ shard_size = (shard_size + block_n - 1) // block_n
131
+ # end of the modification
132
+
133
+ param.load_qkv_weight(loaded_weight=loaded_weight,
134
+ num_heads=self.num_kv_head_replicas,
135
+ shard_id=loaded_shard_id,
136
+ shard_offset=shard_offset,
137
+ shard_size=shard_size)
138
+ ...
139
+ ```
140
+
141
+ ## Switching Between Thinking and Non-Thinking Mode
142
+
143
+ > [!TIP]
144
+ > The `enable_thinking` switch is also available in APIs created by SGLang and vLLM.
145
+ > 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.
146
+
147
+ ### `enable_thinking=True`
148
+
149
+ 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.
150
+
151
+ ```python
152
+ text = tokenizer.apply_chat_template(
153
+ messages,
154
+ tokenize=False,
155
+ add_generation_prompt=True,
156
+ enable_thinking=True # True is the default value for enable_thinking
157
+ )
158
+ ```
159
+
160
+ In this mode, the model will generate think content wrapped in a `<think>...</think>` block, followed by the final response.
161
+
162
+ > [!NOTE]
163
+ > 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.
164
+
165
+
166
+ ### `enable_thinking=False`
167
+
168
+ 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.
169
+
170
+ ```python
171
+ text = tokenizer.apply_chat_template(
172
+ messages,
173
+ tokenize=False,
174
+ add_generation_prompt=True,
175
+ enable_thinking=False # Setting enable_thinking=False disables thinking mode
176
+ )
177
+ ```
178
+
179
+ In this mode, the model will not generate any think content and will not include a `<think>...</think>` block.
180
+
181
+ > [!NOTE]
182
+ > 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.
183
+
184
+ ### Advanced Usage: Switching Between Thinking and Non-Thinking Modes via User Input
185
+
186
+ 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.
187
+
188
+ Here is an example of a multi-turn conversation:
189
+
190
+ ```python
191
+ from transformers import AutoModelForCausalLM, AutoTokenizer
192
+
193
+ class QwenChatbot:
194
+ def __init__(self, model_name="Qwen/Qwen3-30B-A3B-FP8"):
195
+ self.tokenizer = AutoTokenizer.from_pretrained(model_name)
196
+ self.model = AutoModelForCausalLM.from_pretrained(model_name)
197
+ self.history = []
198
+
199
+ def generate_response(self, user_input):
200
+ messages = self.history + [{"role": "user", "content": user_input}]
201
+
202
+ text = self.tokenizer.apply_chat_template(
203
+ messages,
204
+ tokenize=False,
205
+ add_generation_prompt=True
206
+ )
207
+
208
+ inputs = self.tokenizer(text, return_tensors="pt")
209
+ response_ids = self.model.generate(**inputs, max_new_tokens=32768)[0][len(inputs.input_ids[0]):].tolist()
210
+ response = self.tokenizer.decode(response_ids, skip_special_tokens=True)
211
+
212
+ # Update history
213
+ self.history.append({"role": "user", "content": user_input})
214
+ self.history.append({"role": "assistant", "content": response})
215
+
216
+ return response
217
+
218
+ # Example Usage
219
+ if __name__ == "__main__":
220
+ chatbot = QwenChatbot()
221
+
222
+ # First input (without /think or /no_think tags, thinking mode is enabled by default)
223
+ user_input_1 = "How many r's in strawberries?"
224
+ print(f"User: {user_input_1}")
225
+ response_1 = chatbot.generate_response(user_input_1)
226
+ print(f"Bot: {response_1}")
227
+ print("----------------------")
228
+
229
+ # Second input with /no_think
230
+ user_input_2 = "Then, how many r's in blueberries? /no_think"
231
+ print(f"User: {user_input_2}")
232
+ response_2 = chatbot.generate_response(user_input_2)
233
+ print(f"Bot: {response_2}")
234
+ print("----------------------")
235
+
236
+ # Third input with /think
237
+ user_input_3 = "Really? /think"
238
+ print(f"User: {user_input_3}")
239
+ response_3 = chatbot.generate_response(user_input_3)
240
+ print(f"Bot: {response_3}")
241
+ ```
242
+
243
+ > [!NOTE]
244
+ > 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.
245
+ > 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.
246
+
247
+ ## Agentic Use
248
+
249
+ 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.
250
+
251
+ 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.
252
+ ```python
253
+ from qwen_agent.agents import Assistant
254
+
255
+ # Define LLM
256
+ llm_cfg = {
257
+ 'model': 'Qwen3-30B-A3B-FP8',
258
+
259
+ # Use the endpoint provided by Alibaba Model Studio:
260
+ # 'model_type': 'qwen_dashscope',
261
+ # 'api_key': os.getenv('DASHSCOPE_API_KEY'),
262
+
263
+ # Use a custom endpoint compatible with OpenAI API:
264
+ 'model_server': 'http://localhost:8000/v1', # api_base
265
+ 'api_key': 'EMPTY',
266
+
267
+ # Other parameters:
268
+ # 'generate_cfg': {
269
+ # # Add: When the response content is `<think>this is the thought</think>this is the answer;
270
+ # # Do not add: When the response has been separated by reasoning_content and content.
271
+ # 'thought_in_content': True,
272
+ # },
273
+ }
274
+
275
+ # Define Tools
276
+ tools = [
277
+ {'mcpServers': { # You can specify the MCP configuration file
278
+ 'time': {
279
+ 'command': 'uvx',
280
+ 'args': ['mcp-server-time', '--local-timezone=Asia/Shanghai']
281
+ },
282
+ "fetch": {
283
+ "command": "uvx",
284
+ "args": ["mcp-server-fetch"]
285
+ }
286
+ }
287
+ },
288
+ 'code_interpreter', # Built-in tools
289
+ ]
290
+
291
+ # Define Agent
292
+ bot = Assistant(llm=llm_cfg, function_list=tools)
293
+
294
+ # Streaming generation
295
+ messages = [{'role': 'user', 'content': 'https://qwenlm.github.io/blog/ Introduce the latest developments of Qwen'}]
296
+ for responses in bot.run(messages=messages):
297
+ pass
298
+ print(responses)
299
+ ```
300
+
301
+ ## Processing Long Texts
302
+
303
+ 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.
304
+
305
+ 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:
306
+
307
+ - Modifying the model files:
308
+ In the `config.json` file, add the `rope_scaling` fields:
309
+ ```json
310
+ {
311
+ ...,
312
+ "rope_scaling": {
313
+ "type": "yarn",
314
+ "factor": 4.0,
315
+ "original_max_position_embeddings": 32768
316
+ }
317
+ }
318
+ ```
319
+ For `llama.cpp`, you need to regenerate the GGUF file after the modification.
320
+
321
+ - Passing command line arguments:
322
+
323
+ For `vllm`, you can use
324
+ ```shell
325
+ vllm serve ... --rope-scaling '{"type":"yarn","factor":4.0,"original_max_position_embeddings":32768}' --max-model-len 131072
326
+ ```
327
+
328
+ For `sglang`, you can use
329
+ ```shell
330
+ python -m sglang.launch_server ... --json-model-override-args '{"rope_scaling":{"type":"yarn","factor":4.0,"original_max_position_embeddings":32768}}'
331
+ ```
332
+
333
+ For `llama-server` from `llama.cpp`, you can use
334
+ ```shell
335
+ llama-server ... --rope-scaling yarn --rope-scale 4 --yarn-orig-ctx 32768
336
+ ```
337
+
338
+ > [!IMPORTANT]
339
+ > If you encounter the following warning
340
+ > ```
341
+ > Unrecognized keys in `rope_scaling` for 'rope_type'='yarn': {'original_max_position_embeddings'}
342
+ > ```
343
+ > please upgrade `transformers>=4.51.0`.
344
+
345
+ > [!NOTE]
346
+ > 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.**
347
+ > We advise adding the `rope_scaling` configuration only when processing long contexts is required.
348
+ > 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.
349
+
350
+ > [!NOTE]
351
+ > 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.
352
+
353
+ > [!TIP]
354
+ > The endpoint provided by Alibaba Model Studio supports dynamic YaRN by default and no extra configuration is needed.
355
+
356
+ ## Best Practices
357
+
358
+ To achieve optimal performance, we recommend the following settings:
359
+
360
+ 1. **Sampling Parameters**:
361
+ - 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.
362
+ - For non-thinking mode (`enable_thinking=False`), we suggest using `Temperature=0.7`, `TopP=0.8`, `TopK=20`, and `MinP=0`.
363
+ - 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.
364
+
365
+ 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.
366
+
367
+ 3. **Standardize Output Format**: We recommend using prompts to standardize model outputs when benchmarking.
368
+ - **Math Problems**: Include "Please reason step by step, and put your final answer within \boxed{}." in the prompt.
369
+ - **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"`."
370
+
371
+ 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.
372
+
373
+ ### Citation
374
+
375
+ If you find our work helpful, feel free to give us a cite.
376
+
377
+ ```
378
+ @misc{qwen3,
379
+ title = {Qwen3},
380
+ url = {https://qwenlm.github.io/blog/qwen3/},
381
+ author = {Qwen Team},
382
+ month = {April},
383
+ year = {2025}
384
+ }
385
+ ```
config.json ADDED
@@ -0,0 +1,194 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Qwen3MoeForCausalLM"
4
+ ],
5
+ "attention_bias": false,
6
+ "attention_dropout": 0.0,
7
+ "bos_token_id": 151643,
8
+ "decoder_sparse_step": 1,
9
+ "eos_token_id": 151645,
10
+ "head_dim": 128,
11
+ "hidden_act": "silu",
12
+ "hidden_size": 2048,
13
+ "initializer_range": 0.02,
14
+ "intermediate_size": 6144,
15
+ "max_position_embeddings": 40960,
16
+ "max_window_layers": 48,
17
+ "mlp_only_layers": [],
18
+ "model_type": "qwen3_moe",
19
+ "moe_intermediate_size": 768,
20
+ "norm_topk_prob": true,
21
+ "num_attention_heads": 32,
22
+ "num_experts": 128,
23
+ "num_experts_per_tok": 8,
24
+ "num_hidden_layers": 48,
25
+ "num_key_value_heads": 4,
26
+ "output_router_logits": false,
27
+ "rms_norm_eps": 1e-06,
28
+ "rope_scaling": null,
29
+ "rope_theta": 1000000.0,
30
+ "router_aux_loss_coef": 0.001,
31
+ "sliding_window": null,
32
+ "tie_word_embeddings": false,
33
+ "torch_dtype": "bfloat16",
34
+ "transformers_version": "4.51.0",
35
+ "use_cache": true,
36
+ "use_sliding_window": false,
37
+ "vocab_size": 151936,
38
+ "quantization_config": {
39
+ "activation_scheme": "dynamic",
40
+ "modules_to_not_convert": [
41
+ "lm_head",
42
+ "model.layers.0.input_layernorm",
43
+ "model.layers.0.mlp.gate",
44
+ "model.layers.0.post_attention_layernorm",
45
+ "model.layers.1.input_layernorm",
46
+ "model.layers.1.mlp.gate",
47
+ "model.layers.1.post_attention_layernorm",
48
+ "model.layers.2.input_layernorm",
49
+ "model.layers.2.mlp.gate",
50
+ "model.layers.2.post_attention_layernorm",
51
+ "model.layers.3.input_layernorm",
52
+ "model.layers.3.mlp.gate",
53
+ "model.layers.3.post_attention_layernorm",
54
+ "model.layers.4.input_layernorm",
55
+ "model.layers.4.mlp.gate",
56
+ "model.layers.4.post_attention_layernorm",
57
+ "model.layers.5.input_layernorm",
58
+ "model.layers.5.mlp.gate",
59
+ "model.layers.5.post_attention_layernorm",
60
+ "model.layers.6.input_layernorm",
61
+ "model.layers.6.mlp.gate",
62
+ "model.layers.6.post_attention_layernorm",
63
+ "model.layers.7.input_layernorm",
64
+ "model.layers.7.mlp.gate",
65
+ "model.layers.7.post_attention_layernorm",
66
+ "model.layers.8.input_layernorm",
67
+ "model.layers.8.mlp.gate",
68
+ "model.layers.8.post_attention_layernorm",
69
+ "model.layers.9.input_layernorm",
70
+ "model.layers.9.mlp.gate",
71
+ "model.layers.9.post_attention_layernorm",
72
+ "model.layers.10.input_layernorm",
73
+ "model.layers.10.mlp.gate",
74
+ "model.layers.10.post_attention_layernorm",
75
+ "model.layers.11.input_layernorm",
76
+ "model.layers.11.mlp.gate",
77
+ "model.layers.11.post_attention_layernorm",
78
+ "model.layers.12.input_layernorm",
79
+ "model.layers.12.mlp.gate",
80
+ "model.layers.12.post_attention_layernorm",
81
+ "model.layers.13.input_layernorm",
82
+ "model.layers.13.mlp.gate",
83
+ "model.layers.13.post_attention_layernorm",
84
+ "model.layers.14.input_layernorm",
85
+ "model.layers.14.mlp.gate",
86
+ "model.layers.14.post_attention_layernorm",
87
+ "model.layers.15.input_layernorm",
88
+ "model.layers.15.mlp.gate",
89
+ "model.layers.15.post_attention_layernorm",
90
+ "model.layers.16.input_layernorm",
91
+ "model.layers.16.mlp.gate",
92
+ "model.layers.16.post_attention_layernorm",
93
+ "model.layers.17.input_layernorm",
94
+ "model.layers.17.mlp.gate",
95
+ "model.layers.17.post_attention_layernorm",
96
+ "model.layers.18.input_layernorm",
97
+ "model.layers.18.mlp.gate",
98
+ "model.layers.18.post_attention_layernorm",
99
+ "model.layers.19.input_layernorm",
100
+ "model.layers.19.mlp.gate",
101
+ "model.layers.19.post_attention_layernorm",
102
+ "model.layers.20.input_layernorm",
103
+ "model.layers.20.mlp.gate",
104
+ "model.layers.20.post_attention_layernorm",
105
+ "model.layers.21.input_layernorm",
106
+ "model.layers.21.mlp.gate",
107
+ "model.layers.21.post_attention_layernorm",
108
+ "model.layers.22.input_layernorm",
109
+ "model.layers.22.mlp.gate",
110
+ "model.layers.22.post_attention_layernorm",
111
+ "model.layers.23.input_layernorm",
112
+ "model.layers.23.mlp.gate",
113
+ "model.layers.23.post_attention_layernorm",
114
+ "model.layers.24.input_layernorm",
115
+ "model.layers.24.mlp.gate",
116
+ "model.layers.24.post_attention_layernorm",
117
+ "model.layers.25.input_layernorm",
118
+ "model.layers.25.mlp.gate",
119
+ "model.layers.25.post_attention_layernorm",
120
+ "model.layers.26.input_layernorm",
121
+ "model.layers.26.mlp.gate",
122
+ "model.layers.26.post_attention_layernorm",
123
+ "model.layers.27.input_layernorm",
124
+ "model.layers.27.mlp.gate",
125
+ "model.layers.27.post_attention_layernorm",
126
+ "model.layers.28.input_layernorm",
127
+ "model.layers.28.mlp.gate",
128
+ "model.layers.28.post_attention_layernorm",
129
+ "model.layers.29.input_layernorm",
130
+ "model.layers.29.mlp.gate",
131
+ "model.layers.29.post_attention_layernorm",
132
+ "model.layers.30.input_layernorm",
133
+ "model.layers.30.mlp.gate",
134
+ "model.layers.30.post_attention_layernorm",
135
+ "model.layers.31.input_layernorm",
136
+ "model.layers.31.mlp.gate",
137
+ "model.layers.31.post_attention_layernorm",
138
+ "model.layers.32.input_layernorm",
139
+ "model.layers.32.mlp.gate",
140
+ "model.layers.32.post_attention_layernorm",
141
+ "model.layers.33.input_layernorm",
142
+ "model.layers.33.mlp.gate",
143
+ "model.layers.33.post_attention_layernorm",
144
+ "model.layers.34.input_layernorm",
145
+ "model.layers.34.mlp.gate",
146
+ "model.layers.34.post_attention_layernorm",
147
+ "model.layers.35.input_layernorm",
148
+ "model.layers.35.mlp.gate",
149
+ "model.layers.35.post_attention_layernorm",
150
+ "model.layers.36.input_layernorm",
151
+ "model.layers.36.mlp.gate",
152
+ "model.layers.36.post_attention_layernorm",
153
+ "model.layers.37.input_layernorm",
154
+ "model.layers.37.mlp.gate",
155
+ "model.layers.37.post_attention_layernorm",
156
+ "model.layers.38.input_layernorm",
157
+ "model.layers.38.mlp.gate",
158
+ "model.layers.38.post_attention_layernorm",
159
+ "model.layers.39.input_layernorm",
160
+ "model.layers.39.mlp.gate",
161
+ "model.layers.39.post_attention_layernorm",
162
+ "model.layers.40.input_layernorm",
163
+ "model.layers.40.mlp.gate",
164
+ "model.layers.40.post_attention_layernorm",
165
+ "model.layers.41.input_layernorm",
166
+ "model.layers.41.mlp.gate",
167
+ "model.layers.41.post_attention_layernorm",
168
+ "model.layers.42.input_layernorm",
169
+ "model.layers.42.mlp.gate",
170
+ "model.layers.42.post_attention_layernorm",
171
+ "model.layers.43.input_layernorm",
172
+ "model.layers.43.mlp.gate",
173
+ "model.layers.43.post_attention_layernorm",
174
+ "model.layers.44.input_layernorm",
175
+ "model.layers.44.mlp.gate",
176
+ "model.layers.44.post_attention_layernorm",
177
+ "model.layers.45.input_layernorm",
178
+ "model.layers.45.mlp.gate",
179
+ "model.layers.45.post_attention_layernorm",
180
+ "model.layers.46.input_layernorm",
181
+ "model.layers.46.mlp.gate",
182
+ "model.layers.46.post_attention_layernorm",
183
+ "model.layers.47.input_layernorm",
184
+ "model.layers.47.mlp.gate",
185
+ "model.layers.47.post_attention_layernorm"
186
+ ],
187
+ "fmt": "e4m3",
188
+ "quant_method": "fp8",
189
+ "weight_block_size": [
190
+ 128,
191
+ 128
192
+ ]
193
+ }
194
+ }
generation_config.json ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token_id": 151643,
3
+ "do_sample": true,
4
+ "eos_token_id": [
5
+ 151645,
6
+ 151643
7
+ ],
8
+ "pad_token_id": 151643,
9
+ "temperature": 0.6,
10
+ "top_k": 20,
11
+ "top_p": 0.95,
12
+ "transformers_version": "4.51.0"
13
+ }
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:f8491994563a8ef470fe940838d7346d9d3d1bab94c20d502ea296cc911889bd
3
+ size 5000178568
model-00002-of-00007.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c35060a9398b98a3dc4f6aca05a8d0e3e9a895a5c0b63087bc3aeee61c30c0ba
3
+ size 4993354584
model-00003-of-00007.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:555993d80ccf12dfc63a6c19f6b54f8252e48819f07a0b52c29f66959415c379
3
+ size 4993357688
model-00004-of-00007.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:714ec1cab66a49faad208ad96891a0d3214cbfc546c6de2dc62569f4ad5945d0
3
+ size 4993357688
model-00005-of-00007.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f0d9da7fd143c96c53f32aad7cfad873c3b4947cd204fa20d301e83f53161afe
3
+ size 4993357688
model-00006-of-00007.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:74d23e6c0978f437962cd074e9a708b447451bfc398b1d27f2f70f6558fc934e
3
+ size 4993357688
model-00007-of-00007.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0dd3273ac4b27382172c7fb80632da3b08f8da83fd2826af44698e15247d088f
3
+ size 2482523864
model.safetensors.index.json ADDED
The diff for this file is too large to render. See raw diff
 
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,239 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ "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 message in messages[::-1] %}\n {%- set index = (messages|length - 1) - loop.index0 %}\n {%- if ns.multi_step_tool and message.role == \"user\" and not(message.content.startswith('<tool_response>') and message.content.endswith('</tool_response>')) %}\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>')[-1].lstrip('\\n') %}\n {%- set reasoning_content = message.content.split('</think>')[0].rstrip('\\n').split('<think>')[-1].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 %}",
231
+ "clean_up_tokenization_spaces": false,
232
+ "eos_token": "<|im_end|>",
233
+ "errors": "replace",
234
+ "model_max_length": 131072,
235
+ "pad_token": "<|endoftext|>",
236
+ "split_special_tokens": false,
237
+ "tokenizer_class": "Qwen2Tokenizer",
238
+ "unk_token": null
239
+ }
vocab.json ADDED
The diff for this file is too large to render. See raw diff