JunHowie commited on
Commit
5ed87d4
·
verified ·
1 Parent(s): 2cd3a66

Upload folder using huggingface_hub

Browse files
README.md CHANGED
@@ -1,13 +1,43 @@
1
  ---
2
  library_name: transformers
3
- license: apache-2.0
4
- license_link: https://huggingface.co/Qwen/Qwen3-8B/blob/main/LICENSE
5
  pipeline_tag: text-generation
 
 
 
 
 
 
6
  base_model:
7
- - Qwen/Qwen3-32B
 
8
  ---
 
 
9
 
10
- # Qwen3-8B
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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>
@@ -24,13 +54,13 @@ Qwen3 is the latest generation of large language models in Qwen series, offering
24
 
25
  ## Model Overview
26
 
27
- **Qwen3-8B** has the following features:
28
  - Type: Causal Language Models
29
  - Training Stage: Pretraining & Post-training
30
- - Number of Parameters: 8.2B
31
- - Number of Paramaters (Non-Embedding): 6.95B
32
- - Number of Layers: 36
33
- - Number of Attention Heads (GQA): 32 for Q and 8 for KV
34
  - Context Length: 32,768 natively and [131,072 tokens with YaRN](#processing-long-texts).
35
 
36
  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/).
@@ -48,7 +78,7 @@ The following contains a code snippet illustrating how to use the model generate
48
  ```python
49
  from transformers import AutoModelForCausalLM, AutoTokenizer
50
 
51
- model_name = "Qwen/Qwen3-8B"
52
 
53
  # load the tokenizer and the model
54
  tokenizer = AutoTokenizer.from_pretrained(model_name)
@@ -95,11 +125,11 @@ print("content:", content)
95
  For deployment, you can use `sglang>=0.4.6.post1` or `vllm>=0.8.5` or to create an OpenAI-compatible API endpoint:
96
  - SGLang:
97
  ```shell
98
- python -m sglang.launch_server --model-path Qwen/Qwen3-8B --reasoning-parser qwen3
99
  ```
100
  - vLLM:
101
  ```shell
102
- vllm serve Qwen/Qwen3-8B --enable-reasoning --reasoning-parser deepseek_r1
103
  ```
104
 
105
  For local use, applications such as Ollama, LMStudio, MLX-LM, llama.cpp, and KTransformers have also supported Qwen3.
@@ -157,7 +187,7 @@ Here is an example of a multi-turn conversation:
157
  from transformers import AutoModelForCausalLM, AutoTokenizer
158
 
159
  class QwenChatbot:
160
- def __init__(self, model_name="Qwen/Qwen3-8B"):
161
  self.tokenizer = AutoTokenizer.from_pretrained(model_name)
162
  self.model = AutoModelForCausalLM.from_pretrained(model_name)
163
  self.history = []
@@ -220,7 +250,7 @@ from qwen_agent.agents import Assistant
220
 
221
  # Define LLM
222
  llm_cfg = {
223
- 'model': 'Qwen3-8B',
224
 
225
  # Use the endpoint provided by Alibaba Model Studio:
226
  # 'model_type': 'qwen_dashscope',
@@ -341,11 +371,13 @@ To achieve optimal performance, we recommend the following settings:
341
  If you find our work helpful, feel free to give us a cite.
342
 
343
  ```
344
- @misc{qwen3,
345
- title = {Qwen3},
346
- url = {https://qwenlm.github.io/blog/qwen3/},
347
- author = {Qwen Team},
348
- month = {April},
349
- year = {2025}
 
 
350
  }
351
  ```
 
1
  ---
2
  library_name: transformers
3
+ license: apache-2.0
4
+ license_link: https://huggingface.co/Qwen/Qwen3-32B/blob/main/LICENSE
5
  pipeline_tag: text-generation
6
+ tags:
7
+ - Qwen3
8
+ - GPTQ
9
+ - Int4
10
+ - 量化修复
11
+ - vLLM
12
  base_model:
13
+ - Qwen/Qwen3-32B
14
+ base_model_relation: quantized
15
  ---
16
+ # Qwen3-32B-GPTQ-Int4
17
+ Base model: [Qwen/Qwen3-32B](https://huggingface.co/Qwen/Qwen3-32B)
18
 
19
+ <i>This model is quantized to 4-bit with a group size of 128.</i>
20
+ <br>
21
+ <i>Compared to earlier quantized versions, the new quantized model demonstrates better tokens/s efficiency. This improvement comes from setting desc_act=False in the quantization configuration.</i>
22
+
23
+ ```
24
+ vllm serve JunHowie/Qwen3-32B-GPTQ-Int4
25
+ ```
26
+
27
+ ### 【Dependencies】
28
+ ```
29
+ vllm>=0.9.2
30
+ ```
31
+
32
+ ### 【Model Download】
33
+
34
+ ```python
35
+ from huggingface_hub import snapshot_download
36
+ snapshot_download('JunHowie/Qwen3-32B-GPTQ-Int4', cache_dir="your_local_path")
37
+ ```
38
+
39
+ ### 【Overview】
40
+ # Qwen3-32B
41
  <a href="https://chat.qwen.ai/" target="_blank" style="margin: 2px;">
42
  <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;"/>
43
  </a>
 
54
 
55
  ## Model Overview
56
 
57
+ **Qwen3-32B** has the following features:
58
  - Type: Causal Language Models
59
  - Training Stage: Pretraining & Post-training
60
+ - Number of Parameters: 32.8B
61
+ - Number of Paramaters (Non-Embedding): 31.2B
62
+ - Number of Layers: 64
63
+ - Number of Attention Heads (GQA): 64 for Q and 8 for KV
64
  - Context Length: 32,768 natively and [131,072 tokens with YaRN](#processing-long-texts).
65
 
66
  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/).
 
78
  ```python
79
  from transformers import AutoModelForCausalLM, AutoTokenizer
80
 
81
+ model_name = "Qwen/Qwen3-32B"
82
 
83
  # load the tokenizer and the model
84
  tokenizer = AutoTokenizer.from_pretrained(model_name)
 
125
  For deployment, you can use `sglang>=0.4.6.post1` or `vllm>=0.8.5` or to create an OpenAI-compatible API endpoint:
126
  - SGLang:
127
  ```shell
128
+ python -m sglang.launch_server --model-path Qwen/Qwen3-32B --reasoning-parser qwen3
129
  ```
130
  - vLLM:
131
  ```shell
132
+ vllm serve Qwen/Qwen3-32B --enable-reasoning --reasoning-parser deepseek_r1
133
  ```
134
 
135
  For local use, applications such as Ollama, LMStudio, MLX-LM, llama.cpp, and KTransformers have also supported Qwen3.
 
187
  from transformers import AutoModelForCausalLM, AutoTokenizer
188
 
189
  class QwenChatbot:
190
+ def __init__(self, model_name="Qwen/Qwen3-32B"):
191
  self.tokenizer = AutoTokenizer.from_pretrained(model_name)
192
  self.model = AutoModelForCausalLM.from_pretrained(model_name)
193
  self.history = []
 
250
 
251
  # Define LLM
252
  llm_cfg = {
253
+ 'model': 'Qwen3-32B',
254
 
255
  # Use the endpoint provided by Alibaba Model Studio:
256
  # 'model_type': 'qwen_dashscope',
 
371
  If you find our work helpful, feel free to give us a cite.
372
 
373
  ```
374
+ @misc{qwen3technicalreport,
375
+ title={Qwen3 Technical Report},
376
+ author={Qwen Team},
377
+ year={2025},
378
+ eprint={2505.09388},
379
+ archivePrefix={arXiv},
380
+ primaryClass={cs.CL},
381
+ url={https://arxiv.org/abs/2505.09388},
382
  }
383
  ```
chat_template.jinja ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 message in messages[::-1] %}
19
+ {%- set index = (messages|length - 1) - loop.index0 %}
20
+ {%- if ns.multi_step_tool and message.role == "user" and message.content is string and not(message.content.startswith('<tool_response>') and message.content.endswith('</tool_response>')) %}
21
+ {%- set ns.multi_step_tool = false %}
22
+ {%- set ns.last_query_index = index %}
23
+ {%- endif %}
24
+ {%- endfor %}
25
+ {%- for message in messages %}
26
+ {%- if message.content is string %}
27
+ {%- set content = message.content %}
28
+ {%- else %}
29
+ {%- set content = '' %}
30
+ {%- endif %}
31
+ {%- if (message.role == "user") or (message.role == "system" and not loop.first) %}
32
+ {{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
33
+ {%- elif message.role == "assistant" %}
34
+ {%- set reasoning_content = '' %}
35
+ {%- if message.reasoning_content is string %}
36
+ {%- set reasoning_content = message.reasoning_content %}
37
+ {%- else %}
38
+ {%- if '</think>' in content %}
39
+ {%- set reasoning_content = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
40
+ {%- set content = content.split('</think>')[-1].lstrip('\n') %}
41
+ {%- endif %}
42
+ {%- endif %}
43
+ {%- if loop.index0 > ns.last_query_index %}
44
+ {%- if loop.last or (not loop.last and reasoning_content) %}
45
+ {{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }}
46
+ {%- else %}
47
+ {{- '<|im_start|>' + message.role + '\n' + content }}
48
+ {%- endif %}
49
+ {%- else %}
50
+ {{- '<|im_start|>' + message.role + '\n' + content }}
51
+ {%- endif %}
52
+ {%- if message.tool_calls %}
53
+ {%- for tool_call in message.tool_calls %}
54
+ {%- if (loop.first and content) or (not loop.first) %}
55
+ {{- '\n' }}
56
+ {%- endif %}
57
+ {%- if tool_call.function %}
58
+ {%- set tool_call = tool_call.function %}
59
+ {%- endif %}
60
+ {{- '<tool_call>\n{"name": "' }}
61
+ {{- tool_call.name }}
62
+ {{- '", "arguments": ' }}
63
+ {%- if tool_call.arguments is string %}
64
+ {{- tool_call.arguments }}
65
+ {%- else %}
66
+ {{- tool_call.arguments | tojson }}
67
+ {%- endif %}
68
+ {{- '}\n</tool_call>' }}
69
+ {%- endfor %}
70
+ {%- endif %}
71
+ {{- '<|im_end|>\n' }}
72
+ {%- elif message.role == "tool" %}
73
+ {%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
74
+ {{- '<|im_start|>user' }}
75
+ {%- endif %}
76
+ {{- '\n<tool_response>\n' }}
77
+ {{- content }}
78
+ {{- '\n</tool_response>' }}
79
+ {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
80
+ {{- '<|im_end|>\n' }}
81
+ {%- endif %}
82
+ {%- endif %}
83
+ {%- endfor %}
84
+ {%- if add_generation_prompt %}
85
+ {{- '<|im_start|>assistant\n' }}
86
+ {%- if enable_thinking is defined and enable_thinking is false %}
87
+ {{- '<think>\n\n</think>\n\n' }}
88
+ {%- endif %}
89
+ {%- endif %}
config.json CHANGED
@@ -11,6 +11,72 @@
11
  "hidden_size": 5120,
12
  "initializer_range": 0.02,
13
  "intermediate_size": 25600,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  "max_position_embeddings": 40960,
15
  "max_window_layers": 64,
16
  "model_type": "qwen3",
@@ -20,19 +86,22 @@
20
  "quantization_config": {
21
  "bits": 4,
22
  "checkpoint_format": "gptq",
23
- "desc_act": true,
24
  "group_size": 128,
 
25
  "lm_head": false,
26
  "meta": {
27
- "damp_auto_increment": 0.0025,
28
- "damp_percent": 0.01,
29
  "mse": 0.0,
30
  "quantizer": [
31
- "gptqmodel:2.2.0"
32
  ],
33
  "static_groups": false,
34
  "true_sequential": true,
35
- "uri": "https://github.com/modelcloud/gptqmodel"
 
 
36
  },
37
  "pack_dtype": "int32",
38
  "quant_method": "gptq",
@@ -44,7 +113,7 @@
44
  "sliding_window": null,
45
  "tie_word_embeddings": false,
46
  "torch_dtype": "bfloat16",
47
- "transformers_version": "4.51.3",
48
  "use_cache": true,
49
  "use_sliding_window": false,
50
  "vocab_size": 151936
 
11
  "hidden_size": 5120,
12
  "initializer_range": 0.02,
13
  "intermediate_size": 25600,
14
+ "layer_types": [
15
+ "full_attention",
16
+ "full_attention",
17
+ "full_attention",
18
+ "full_attention",
19
+ "full_attention",
20
+ "full_attention",
21
+ "full_attention",
22
+ "full_attention",
23
+ "full_attention",
24
+ "full_attention",
25
+ "full_attention",
26
+ "full_attention",
27
+ "full_attention",
28
+ "full_attention",
29
+ "full_attention",
30
+ "full_attention",
31
+ "full_attention",
32
+ "full_attention",
33
+ "full_attention",
34
+ "full_attention",
35
+ "full_attention",
36
+ "full_attention",
37
+ "full_attention",
38
+ "full_attention",
39
+ "full_attention",
40
+ "full_attention",
41
+ "full_attention",
42
+ "full_attention",
43
+ "full_attention",
44
+ "full_attention",
45
+ "full_attention",
46
+ "full_attention",
47
+ "full_attention",
48
+ "full_attention",
49
+ "full_attention",
50
+ "full_attention",
51
+ "full_attention",
52
+ "full_attention",
53
+ "full_attention",
54
+ "full_attention",
55
+ "full_attention",
56
+ "full_attention",
57
+ "full_attention",
58
+ "full_attention",
59
+ "full_attention",
60
+ "full_attention",
61
+ "full_attention",
62
+ "full_attention",
63
+ "full_attention",
64
+ "full_attention",
65
+ "full_attention",
66
+ "full_attention",
67
+ "full_attention",
68
+ "full_attention",
69
+ "full_attention",
70
+ "full_attention",
71
+ "full_attention",
72
+ "full_attention",
73
+ "full_attention",
74
+ "full_attention",
75
+ "full_attention",
76
+ "full_attention",
77
+ "full_attention",
78
+ "full_attention"
79
+ ],
80
  "max_position_embeddings": 40960,
81
  "max_window_layers": 64,
82
  "model_type": "qwen3",
 
86
  "quantization_config": {
87
  "bits": 4,
88
  "checkpoint_format": "gptq",
89
+ "desc_act": false,
90
  "group_size": 128,
91
+ "hyb_act": false,
92
  "lm_head": false,
93
  "meta": {
94
+ "damp_auto_increment": 0.01,
95
+ "damp_percent": 0.05,
96
  "mse": 0.0,
97
  "quantizer": [
98
+ "gptqmodel:4.0.0"
99
  ],
100
  "static_groups": false,
101
  "true_sequential": true,
102
+ "uri": "https://github.com/modelcloud/gptqmodel",
103
+ "v2": false,
104
+ "v2_alpha": 0.25
105
  },
106
  "pack_dtype": "int32",
107
  "quant_method": "gptq",
 
113
  "sliding_window": null,
114
  "tie_word_embeddings": false,
115
  "torch_dtype": "bfloat16",
116
+ "transformers_version": "4.55.4",
117
  "use_cache": true,
118
  "use_sliding_window": false,
119
  "vocab_size": 151936
generation_config.json CHANGED
@@ -9,5 +9,5 @@
9
  "temperature": 0.6,
10
  "top_k": 20,
11
  "top_p": 0.95,
12
- "transformers_version": "4.51.3"
13
  }
 
9
  "temperature": 0.6,
10
  "top_k": 20,
11
  "top_p": 0.95,
12
+ "transformers_version": "4.55.4"
13
  }
model-00001-of-00005.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:7bc6ec84831edaaa8d9bcecc855d3f3569f1caf07404e8c80b04d39517a5d76e
3
  size 3955280848
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c75484e00c53c856cf13e83f3044e1571865aaca18d43838567ac77d1a4361f9
3
  size 3955280848
model-00002-of-00005.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:0885d8eb4de48779f3b518012610b46328640fa635c6119038efb8b72be3ace5
3
  size 3989151776
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:65b9a0c401e2fd56c25fc004e22b0484f1ab7fa490945a421dbc3819e85f4bce
3
  size 3989151776
model-00003-of-00005.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:4f93a39345fb6c00596be11b52927fef74ebd2e0938ed22a3d3a077d8176173b
3
  size 3939923288
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5a98fc0af450a79bbdfa87eb26260c00fa6e85fa6e720d04793e1cdd32943fdf
3
  size 3939923288
model-00004-of-00005.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:9999b34cb29c778301f95cd381939f933c9947ae46501b4d80240c7c325be8de
3
  size 3989151824
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e4906973e652827fe1fdb5d235ae841167bd6b64be76d57dc2350052a8bb766d
3
  size 3989151824
model-00005-of-00005.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:4d7717e6e58502cd1201917a54886e7a56ca8b005d0ef11110bcb0f5c4428fa7
3
  size 3467226552
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8ef93fd755b78d6ab1be4f196a1434e9042f42078a4cf482da8c8c6225e030fd
3
  size 3467226552
quantize_config.json CHANGED
@@ -1,7 +1,8 @@
1
  {
2
  "bits": 4,
3
  "group_size": 128,
4
- "desc_act": true,
 
5
  "sym": true,
6
  "lm_head": false,
7
  "quant_method": "gptq",
@@ -9,13 +10,15 @@
9
  "pack_dtype": "int32",
10
  "meta": {
11
  "quantizer": [
12
- "gptqmodel:2.2.0"
13
  ],
14
  "uri": "https://github.com/modelcloud/gptqmodel",
15
- "damp_percent": 0.01,
16
- "damp_auto_increment": 0.0025,
17
  "static_groups": false,
18
  "true_sequential": true,
19
- "mse": 0.0
 
 
20
  }
21
  }
 
1
  {
2
  "bits": 4,
3
  "group_size": 128,
4
+ "desc_act": false,
5
+ "hyb_act": false,
6
  "sym": true,
7
  "lm_head": false,
8
  "quant_method": "gptq",
 
10
  "pack_dtype": "int32",
11
  "meta": {
12
  "quantizer": [
13
+ "gptqmodel:4.0.0"
14
  ],
15
  "uri": "https://github.com/modelcloud/gptqmodel",
16
+ "damp_percent": 0.05,
17
+ "damp_auto_increment": 0.01,
18
  "static_groups": false,
19
  "true_sequential": true,
20
+ "mse": 0.0,
21
+ "v2": false,
22
+ "v2_alpha": 0.25
23
  }
24
  }
tokenizer_config.json CHANGED
@@ -227,7 +227,6 @@
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",
 
227
  "<|video_pad|>"
228
  ],
229
  "bos_token": null,
 
230
  "clean_up_tokenization_spaces": false,
231
  "eos_token": "<|im_end|>",
232
  "errors": "replace",