yujiepan commited on
Commit
38ccf2b
·
verified ·
1 Parent(s): d1d27da

Upload folder using huggingface_hub

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
.meta.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "torch": "2.11.0",
3
+ "transformers": "5.5.0"
4
+ }
README.md ADDED
@@ -0,0 +1,303 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: transformers
3
+ base_model:
4
+ - Qwen/Qwen3.6-27B
5
+ ---
6
+
7
+ This tiny model is intended for debugging. It is randomly initialized using the configuration adapted from [Qwen/Qwen3.6-27B](https://huggingface.co/Qwen/Qwen3.6-27B).
8
+
9
+ | File path | Size |
10
+ |------|------|
11
+ | model.safetensors | 8.8MB |
12
+
13
+
14
+ ### Example usage:
15
+
16
+ - vLLM
17
+
18
+ ```bash
19
+ # Multi-token prediction is supported
20
+ model_id=tiny-random/qwen3.6
21
+ vllm serve $model_id \
22
+ --tensor-parallel-size 2 \
23
+ --speculative-config.method qwen3_next_mtp \
24
+ --speculative-config.num_speculative_tokens 2 \
25
+ --reasoning-parser qwen3 \
26
+ --tool-call-parser qwen3_coder \
27
+ --enable-auto-tool-choice \
28
+ --max-cudagraph-capture-size 16
29
+ ```
30
+
31
+ - SGLang
32
+
33
+ ```bash
34
+ # Multi-token prediction is supported
35
+ model_id=tiny-random/qwen3.6
36
+ python3 -m sglang.launch_server \
37
+ --model-path $model_id \
38
+ --tp-size 2 \
39
+ --tool-call-parser qwen3_coder \
40
+ --reasoning-parser qwen3 \
41
+ --speculative-algo NEXTN \
42
+ --speculative-num-steps 3 \
43
+ --speculative-eagle-topk 1 \
44
+ --speculative-num-draft-tokens 4
45
+ ```
46
+
47
+ - Transformers
48
+
49
+ ```python
50
+ import torch
51
+ from transformers import (
52
+ Qwen3_5ForConditionalGeneration,
53
+ AutoProcessor,
54
+ )
55
+
56
+ model_id = "tiny-random/qwen3.6"
57
+ model = Qwen3_5ForConditionalGeneration.from_pretrained(
58
+ model_id, dtype=torch.bfloat16, device_map="auto",
59
+ )
60
+ processor = AutoProcessor.from_pretrained(model_id)
61
+ messages = [
62
+ {
63
+ "role": "user",
64
+ "content": [
65
+ {
66
+ "type": "image",
67
+ "image": "https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-VL/assets/demo.jpeg",
68
+ },
69
+ {"type": "text", "text": "Describe this image."},
70
+ ],
71
+ }
72
+ ]
73
+
74
+ inputs = processor.apply_chat_template(
75
+ messages,
76
+ tokenize=True,
77
+ add_generation_prompt=True,
78
+ return_dict=True,
79
+ return_tensors="pt"
80
+ ).to(model.device)
81
+
82
+ generated_ids = model.generate(**inputs, max_new_tokens=32)
83
+ output_text = processor.batch_decode(generated_ids[0], skip_special_tokens=False)[0]
84
+ print(output_text.replace('<|image_pad|>', "I"))
85
+ ```
86
+
87
+ ### Codes to create this repo:
88
+
89
+ <details>
90
+ <summary>Click to expand</summary>
91
+
92
+ ```python
93
+ import json
94
+ from copy import deepcopy
95
+ from pathlib import Path
96
+
97
+ import torch
98
+ from huggingface_hub import file_exists, hf_hub_download
99
+ from transformers import (
100
+ AutoConfig,
101
+ AutoModelForCausalLM,
102
+ AutoProcessor,
103
+ GenerationConfig,
104
+ Qwen3_5ForConditionalGeneration,
105
+ set_seed,
106
+ )
107
+
108
+ source_model_id = "Qwen/Qwen3.6-27B"
109
+ save_folder = "/tmp/tiny-random/qwen36"
110
+
111
+ processor = AutoProcessor.from_pretrained(source_model_id, trust_remote_code=True)
112
+ processor.save_pretrained(save_folder)
113
+
114
+ with open(hf_hub_download(source_model_id, filename='config.json', repo_type='model'), 'r', encoding='utf-8') as f:
115
+ config_json = json.load(f)
116
+
117
+ config_json['text_config'].update({
118
+ 'head_dim': 32,
119
+ 'hidden_size': 8,
120
+ "layer_types": ['linear_attention'] * 3 + ['full_attention'],
121
+ 'intermediate_size': 32,
122
+ 'num_hidden_layers': 4,
123
+ 'num_attention_heads': 8,
124
+ 'num_key_value_heads': 4,
125
+ "linear_key_head_dim": 32,
126
+ "linear_num_key_heads": 4,
127
+ "linear_num_value_heads": 8,
128
+ "linear_value_head_dim": 32,
129
+ })
130
+ config_json['text_config']['rope_parameters']['mrope_section'] = [1, 1, 2]
131
+ config_json["tie_word_embeddings"] = False
132
+ config_json['vision_config'].update(
133
+ {
134
+ 'hidden_size': 64,
135
+ 'intermediate_size': 128,
136
+ 'num_heads': 2,
137
+ 'out_hidden_size': 8,
138
+ 'depth': 2,
139
+ }
140
+ )
141
+ with open(f"{save_folder}/config.json", "w", encoding='utf-8') as f:
142
+ json.dump(config_json, f, indent=2)
143
+
144
+ config = AutoConfig.from_pretrained(
145
+ save_folder,
146
+ trust_remote_code=True,
147
+ )
148
+ print(config)
149
+ set_seed(42)
150
+ torch.set_default_dtype(torch.bfloat16)
151
+ model = Qwen3_5ForConditionalGeneration(config)
152
+ # in Qwen/Qwen3.6-27B release, all tensors are in bfloat16
153
+ # with torch.no_grad():
154
+ # for i in range(3):
155
+ # attn = model.model.language_model.layers[i].linear_attn
156
+ # attn.A_log = torch.nn.Parameter(attn.A_log.float())
157
+ # attn.norm.float()
158
+
159
+ print(model.state_dict()['model.language_model.layers.0.linear_attn.A_log'].dtype)
160
+ print(model.state_dict()['model.language_model.layers.0.linear_attn.norm.weight'].dtype)
161
+
162
+ model.mtp = torch.nn.ModuleDict({
163
+ "pre_fc_norm_embedding": torch.nn.RMSNorm(config.text_config.hidden_size),
164
+ "fc": torch.nn.Linear(config.text_config.hidden_size * 2, config.text_config.hidden_size, bias=False),
165
+ "layers": torch.nn.ModuleList([deepcopy(model.model.language_model.layers[3])]),
166
+ "norm": torch.nn.RMSNorm(config.text_config.hidden_size),
167
+ "pre_fc_norm_hidden": torch.nn.RMSNorm(config.text_config.hidden_size),
168
+ })
169
+ torch.set_default_dtype(torch.float32)
170
+ if file_exists(filename="generation_config.json", repo_id=source_model_id, repo_type='model'):
171
+ model.generation_config = GenerationConfig.from_pretrained(
172
+ source_model_id, trust_remote_code=True,
173
+ )
174
+ model.generation_config.do_sample = True
175
+ print(model.generation_config)
176
+ model = model.cpu()
177
+ set_seed(42)
178
+ with torch.no_grad():
179
+ for name, p in sorted(model.named_parameters()):
180
+ torch.nn.init.normal_(p, 0, 0.2)
181
+ print(name, p.shape)
182
+ model.save_pretrained(save_folder)
183
+ ```
184
+
185
+ </details>
186
+
187
+ ### Printing the model:
188
+
189
+ <details><summary>Click to expand</summary>
190
+
191
+ ```text
192
+ Qwen3_5ForConditionalGeneration(
193
+ (model): Qwen3_5Model(
194
+ (visual): Qwen3_5VisionModel(
195
+ (patch_embed): Qwen3_5VisionPatchEmbed(
196
+ (proj): Conv3d(3, 64, kernel_size=(2, 16, 16), stride=(2, 16, 16))
197
+ )
198
+ (pos_embed): Embedding(2304, 64)
199
+ (rotary_pos_emb): Qwen3_5VisionRotaryEmbedding()
200
+ (blocks): ModuleList(
201
+ (0-1): 2 x Qwen3_5VisionBlock(
202
+ (norm1): LayerNorm((64,), eps=1e-06, elementwise_affine=True)
203
+ (norm2): LayerNorm((64,), eps=1e-06, elementwise_affine=True)
204
+ (attn): Qwen3_5VisionAttention(
205
+ (qkv): Linear(in_features=64, out_features=192, bias=True)
206
+ (proj): Linear(in_features=64, out_features=64, bias=True)
207
+ )
208
+ (mlp): Qwen3_5VisionMLP(
209
+ (linear_fc1): Linear(in_features=64, out_features=128, bias=True)
210
+ (linear_fc2): Linear(in_features=128, out_features=64, bias=True)
211
+ (act_fn): GELUTanh()
212
+ )
213
+ )
214
+ )
215
+ (merger): Qwen3_5VisionPatchMerger(
216
+ (norm): LayerNorm((64,), eps=1e-06, elementwise_affine=True)
217
+ (linear_fc1): Linear(in_features=256, out_features=256, bias=True)
218
+ (act_fn): GELU(approximate='none')
219
+ (linear_fc2): Linear(in_features=256, out_features=8, bias=True)
220
+ )
221
+ )
222
+ (language_model): Qwen3_5TextModel(
223
+ (embed_tokens): Embedding(248320, 8)
224
+ (layers): ModuleList(
225
+ (0-2): 3 x Qwen3_5DecoderLayer(
226
+ (linear_attn): Qwen3_5GatedDeltaNet(
227
+ (act): SiLUActivation()
228
+ (conv1d): Conv1d(512, 512, kernel_size=(4,), stride=(1,), padding=(3,), groups=512, bias=False)
229
+ (norm): Qwen3_5RMSNormGated()
230
+ (out_proj): Linear(in_features=256, out_features=8, bias=False)
231
+ (in_proj_qkv): Linear(in_features=8, out_features=512, bias=False)
232
+ (in_proj_z): Linear(in_features=8, out_features=256, bias=False)
233
+ (in_proj_b): Linear(in_features=8, out_features=8, bias=False)
234
+ (in_proj_a): Linear(in_features=8, out_features=8, bias=False)
235
+ )
236
+ (mlp): Qwen3_5MLP(
237
+ (gate_proj): Linear(in_features=8, out_features=32, bias=False)
238
+ (up_proj): Linear(in_features=8, out_features=32, bias=False)
239
+ (down_proj): Linear(in_features=32, out_features=8, bias=False)
240
+ (act_fn): SiLUActivation()
241
+ )
242
+ (input_layernorm): Qwen3_5RMSNorm((8,), eps=1e-06)
243
+ (post_attention_layernorm): Qwen3_5RMSNorm((8,), eps=1e-06)
244
+ )
245
+ (3): Qwen3_5DecoderLayer(
246
+ (self_attn): Qwen3_5Attention(
247
+ (q_proj): Linear(in_features=8, out_features=512, bias=False)
248
+ (k_proj): Linear(in_features=8, out_features=128, bias=False)
249
+ (v_proj): Linear(in_features=8, out_features=128, bias=False)
250
+ (o_proj): Linear(in_features=256, out_features=8, bias=False)
251
+ (q_norm): Qwen3_5RMSNorm((32,), eps=1e-06)
252
+ (k_norm): Qwen3_5RMSNorm((32,), eps=1e-06)
253
+ )
254
+ (mlp): Qwen3_5MLP(
255
+ (gate_proj): Linear(in_features=8, out_features=32, bias=False)
256
+ (up_proj): Linear(in_features=8, out_features=32, bias=False)
257
+ (down_proj): Linear(in_features=32, out_features=8, bias=False)
258
+ (act_fn): SiLUActivation()
259
+ )
260
+ (input_layernorm): Qwen3_5RMSNorm((8,), eps=1e-06)
261
+ (post_attention_layernorm): Qwen3_5RMSNorm((8,), eps=1e-06)
262
+ )
263
+ )
264
+ (norm): Qwen3_5RMSNorm((8,), eps=1e-06)
265
+ (rotary_emb): Qwen3_5TextRotaryEmbedding()
266
+ )
267
+ )
268
+ (lm_head): Linear(in_features=8, out_features=248320, bias=False)
269
+ (mtp): ModuleDict(
270
+ (pre_fc_norm_embedding): RMSNorm((8,), eps=None, elementwise_affine=True)
271
+ (fc): Linear(in_features=16, out_features=8, bias=False)
272
+ (layers): ModuleList(
273
+ (0): Qwen3_5DecoderLayer(
274
+ (self_attn): Qwen3_5Attention(
275
+ (q_proj): Linear(in_features=8, out_features=512, bias=False)
276
+ (k_proj): Linear(in_features=8, out_features=128, bias=False)
277
+ (v_proj): Linear(in_features=8, out_features=128, bias=False)
278
+ (o_proj): Linear(in_features=256, out_features=8, bias=False)
279
+ (q_norm): Qwen3_5RMSNorm((32,), eps=1e-06)
280
+ (k_norm): Qwen3_5RMSNorm((32,), eps=1e-06)
281
+ )
282
+ (mlp): Qwen3_5MLP(
283
+ (gate_proj): Linear(in_features=8, out_features=32, bias=False)
284
+ (up_proj): Linear(in_features=8, out_features=32, bias=False)
285
+ (down_proj): Linear(in_features=32, out_features=8, bias=False)
286
+ (act_fn): SiLUActivation()
287
+ )
288
+ (input_layernorm): Qwen3_5RMSNorm((8,), eps=1e-06)
289
+ (post_attention_layernorm): Qwen3_5RMSNorm((8,), eps=1e-06)
290
+ )
291
+ )
292
+ (norm): RMSNorm((8,), eps=None, elementwise_affine=True)
293
+ (pre_fc_norm_hidden): RMSNorm((8,), eps=None, elementwise_affine=True)
294
+ )
295
+ )
296
+ ```
297
+
298
+ </details>
299
+
300
+ ### Test environment:
301
+
302
+ - torch: 2.11.0
303
+ - transformers: 5.5.0
chat_template.jinja ADDED
@@ -0,0 +1,154 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- set image_count = namespace(value=0) %}
2
+ {%- set video_count = namespace(value=0) %}
3
+ {%- macro render_content(content, do_vision_count, is_system_content=false) %}
4
+ {%- if content is string %}
5
+ {{- content }}
6
+ {%- elif content is iterable and content is not mapping %}
7
+ {%- for item in content %}
8
+ {%- if 'image' in item or 'image_url' in item or item.type == 'image' %}
9
+ {%- if is_system_content %}
10
+ {{- raise_exception('System message cannot contain images.') }}
11
+ {%- endif %}
12
+ {%- if do_vision_count %}
13
+ {%- set image_count.value = image_count.value + 1 %}
14
+ {%- endif %}
15
+ {%- if add_vision_id %}
16
+ {{- 'Picture ' ~ image_count.value ~ ': ' }}
17
+ {%- endif %}
18
+ {{- '<|vision_start|><|image_pad|><|vision_end|>' }}
19
+ {%- elif 'video' in item or item.type == 'video' %}
20
+ {%- if is_system_content %}
21
+ {{- raise_exception('System message cannot contain videos.') }}
22
+ {%- endif %}
23
+ {%- if do_vision_count %}
24
+ {%- set video_count.value = video_count.value + 1 %}
25
+ {%- endif %}
26
+ {%- if add_vision_id %}
27
+ {{- 'Video ' ~ video_count.value ~ ': ' }}
28
+ {%- endif %}
29
+ {{- '<|vision_start|><|video_pad|><|vision_end|>' }}
30
+ {%- elif 'text' in item %}
31
+ {{- item.text }}
32
+ {%- else %}
33
+ {{- raise_exception('Unexpected item type in content.') }}
34
+ {%- endif %}
35
+ {%- endfor %}
36
+ {%- elif content is none or content is undefined %}
37
+ {{- '' }}
38
+ {%- else %}
39
+ {{- raise_exception('Unexpected content type.') }}
40
+ {%- endif %}
41
+ {%- endmacro %}
42
+ {%- if not messages %}
43
+ {{- raise_exception('No messages provided.') }}
44
+ {%- endif %}
45
+ {%- if tools and tools is iterable and tools is not mapping %}
46
+ {{- '<|im_start|>system\n' }}
47
+ {{- "# Tools\n\nYou have access to the following functions:\n\n<tools>" }}
48
+ {%- for tool in tools %}
49
+ {{- "\n" }}
50
+ {{- tool | tojson }}
51
+ {%- endfor %}
52
+ {{- "\n</tools>" }}
53
+ {{- '\n\nIf you choose to call a function ONLY reply in the following format with NO suffix:\n\n<tool_call>\n<function=example_function_name>\n<parameter=example_parameter_1>\nvalue_1\n</parameter>\n<parameter=example_parameter_2>\nThis is the value for the second parameter\nthat can span\nmultiple lines\n</parameter>\n</function>\n</tool_call>\n\n<IMPORTANT>\nReminder:\n- Function calls MUST follow the specified format: an inner <function=...></function> block must be nested within <tool_call></tool_call> XML tags\n- Required parameters MUST be specified\n- You may provide optional reasoning for your function call in natural language BEFORE the function call, but NOT after\n- If there is no function call available, answer the question like normal with your current knowledge and do not tell the user about function calls\n</IMPORTANT>' }}
54
+ {%- if messages[0].role == 'system' %}
55
+ {%- set content = render_content(messages[0].content, false, true)|trim %}
56
+ {%- if content %}
57
+ {{- '\n\n' + content }}
58
+ {%- endif %}
59
+ {%- endif %}
60
+ {{- '<|im_end|>\n' }}
61
+ {%- else %}
62
+ {%- if messages[0].role == 'system' %}
63
+ {%- set content = render_content(messages[0].content, false, true)|trim %}
64
+ {{- '<|im_start|>system\n' + content + '<|im_end|>\n' }}
65
+ {%- endif %}
66
+ {%- endif %}
67
+ {%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
68
+ {%- for message in messages[::-1] %}
69
+ {%- set index = (messages|length - 1) - loop.index0 %}
70
+ {%- if ns.multi_step_tool and message.role == "user" %}
71
+ {%- set content = render_content(message.content, false)|trim %}
72
+ {%- if not(content.startswith('<tool_response>') and content.endswith('</tool_response>')) %}
73
+ {%- set ns.multi_step_tool = false %}
74
+ {%- set ns.last_query_index = index %}
75
+ {%- endif %}
76
+ {%- endif %}
77
+ {%- endfor %}
78
+ {%- if ns.multi_step_tool %}
79
+ {{- raise_exception('No user query found in messages.') }}
80
+ {%- endif %}
81
+ {%- for message in messages %}
82
+ {%- set content = render_content(message.content, true)|trim %}
83
+ {%- if message.role == "system" %}
84
+ {%- if not loop.first %}
85
+ {{- raise_exception('System message must be at the beginning.') }}
86
+ {%- endif %}
87
+ {%- elif message.role == "user" %}
88
+ {{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
89
+ {%- elif message.role == "assistant" %}
90
+ {%- set reasoning_content = '' %}
91
+ {%- if message.reasoning_content is string %}
92
+ {%- set reasoning_content = message.reasoning_content %}
93
+ {%- else %}
94
+ {%- if '</think>' in content %}
95
+ {%- set reasoning_content = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
96
+ {%- set content = content.split('</think>')[-1].lstrip('\n') %}
97
+ {%- endif %}
98
+ {%- endif %}
99
+ {%- set reasoning_content = reasoning_content|trim %}
100
+ {%- if (preserve_thinking is defined and preserve_thinking is true) or (loop.index0 > ns.last_query_index) %}
101
+ {{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content + '\n</think>\n\n' + content }}
102
+ {%- else %}
103
+ {{- '<|im_start|>' + message.role + '\n' + content }}
104
+ {%- endif %}
105
+ {%- if message.tool_calls and message.tool_calls is iterable and message.tool_calls is not mapping %}
106
+ {%- for tool_call in message.tool_calls %}
107
+ {%- if tool_call.function is defined %}
108
+ {%- set tool_call = tool_call.function %}
109
+ {%- endif %}
110
+ {%- if loop.first %}
111
+ {%- if content|trim %}
112
+ {{- '\n\n<tool_call>\n<function=' + tool_call.name + '>\n' }}
113
+ {%- else %}
114
+ {{- '<tool_call>\n<function=' + tool_call.name + '>\n' }}
115
+ {%- endif %}
116
+ {%- else %}
117
+ {{- '\n<tool_call>\n<function=' + tool_call.name + '>\n' }}
118
+ {%- endif %}
119
+ {%- if tool_call.arguments is defined %}
120
+ {%- for args_name, args_value in tool_call.arguments|items %}
121
+ {{- '<parameter=' + args_name + '>\n' }}
122
+ {%- set args_value = args_value | string if args_value is string else args_value | tojson | safe %}
123
+ {{- args_value }}
124
+ {{- '\n</parameter>\n' }}
125
+ {%- endfor %}
126
+ {%- endif %}
127
+ {{- '</function>\n</tool_call>' }}
128
+ {%- endfor %}
129
+ {%- endif %}
130
+ {{- '<|im_end|>\n' }}
131
+ {%- elif message.role == "tool" %}
132
+ {%- if loop.previtem and loop.previtem.role != "tool" %}
133
+ {{- '<|im_start|>user' }}
134
+ {%- endif %}
135
+ {{- '\n<tool_response>\n' }}
136
+ {{- content }}
137
+ {{- '\n</tool_response>' }}
138
+ {%- if not loop.last and loop.nextitem.role != "tool" %}
139
+ {{- '<|im_end|>\n' }}
140
+ {%- elif loop.last %}
141
+ {{- '<|im_end|>\n' }}
142
+ {%- endif %}
143
+ {%- else %}
144
+ {{- raise_exception('Unexpected message role.') }}
145
+ {%- endif %}
146
+ {%- endfor %}
147
+ {%- if add_generation_prompt %}
148
+ {{- '<|im_start|>assistant\n' }}
149
+ {%- if enable_thinking is defined and enable_thinking is false %}
150
+ {{- '<think>\n\n</think>\n\n' }}
151
+ {%- else %}
152
+ {{- '<think>\n' }}
153
+ {%- endif %}
154
+ {%- endif %}
config.json ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Qwen3_5ForConditionalGeneration"
4
+ ],
5
+ "dtype": "bfloat16",
6
+ "image_token_id": 248056,
7
+ "language_model_only": false,
8
+ "model_type": "qwen3_5",
9
+ "text_config": {
10
+ "attention_bias": false,
11
+ "attention_dropout": 0.0,
12
+ "attn_output_gate": true,
13
+ "bos_token_id": 248044,
14
+ "dtype": "bfloat16",
15
+ "eos_token_id": 248044,
16
+ "full_attention_interval": 4,
17
+ "head_dim": 32,
18
+ "hidden_act": "silu",
19
+ "hidden_size": 8,
20
+ "initializer_range": 0.02,
21
+ "intermediate_size": 32,
22
+ "layer_types": [
23
+ "linear_attention",
24
+ "linear_attention",
25
+ "linear_attention",
26
+ "full_attention"
27
+ ],
28
+ "linear_conv_kernel_dim": 4,
29
+ "linear_key_head_dim": 32,
30
+ "linear_num_key_heads": 4,
31
+ "linear_num_value_heads": 8,
32
+ "linear_value_head_dim": 32,
33
+ "mamba_ssm_dtype": "float32",
34
+ "max_position_embeddings": 262144,
35
+ "model_type": "qwen3_5_text",
36
+ "mtp_num_hidden_layers": 1,
37
+ "mtp_use_dedicated_embeddings": false,
38
+ "num_attention_heads": 8,
39
+ "num_hidden_layers": 4,
40
+ "num_key_value_heads": 4,
41
+ "output_gate_type": "swish",
42
+ "pad_token_id": null,
43
+ "partial_rotary_factor": 0.25,
44
+ "rms_norm_eps": 1e-06,
45
+ "rope_parameters": {
46
+ "mrope_interleaved": true,
47
+ "mrope_section": [
48
+ 1,
49
+ 1,
50
+ 2
51
+ ],
52
+ "partial_rotary_factor": 0.25,
53
+ "rope_theta": 10000000,
54
+ "rope_type": "default"
55
+ },
56
+ "tie_word_embeddings": false,
57
+ "use_cache": true,
58
+ "vocab_size": 248320
59
+ },
60
+ "tie_word_embeddings": false,
61
+ "transformers_version": "5.5.0",
62
+ "video_token_id": 248057,
63
+ "vision_config": {
64
+ "deepstack_visual_indexes": [],
65
+ "depth": 2,
66
+ "hidden_act": "gelu_pytorch_tanh",
67
+ "hidden_size": 64,
68
+ "in_channels": 3,
69
+ "initializer_range": 0.02,
70
+ "intermediate_size": 128,
71
+ "model_type": "qwen3_5",
72
+ "num_heads": 2,
73
+ "num_position_embeddings": 2304,
74
+ "out_hidden_size": 8,
75
+ "patch_size": 16,
76
+ "spatial_merge_size": 2,
77
+ "temporal_patch_size": 2
78
+ },
79
+ "vision_end_token_id": 248054,
80
+ "vision_start_token_id": 248053
81
+ }
generation_config.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token_id": 248044,
3
+ "do_sample": true,
4
+ "eos_token_id": [
5
+ 248046,
6
+ 248044
7
+ ],
8
+ "pad_token_id": 248044,
9
+ "temperature": 1.0,
10
+ "top_k": 20,
11
+ "top_p": 0.95,
12
+ "transformers_version": "5.5.0",
13
+ "trust_remote_code": true
14
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ff5924d21a84d7a69fe511f87ab99bed3ffb7e4dabfe4ad9e567cde7786e93a7
3
+ size 8825216
processor_config.json ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "image_processor": {
3
+ "do_convert_rgb": true,
4
+ "do_normalize": true,
5
+ "do_rescale": true,
6
+ "do_resize": true,
7
+ "image_mean": [
8
+ 0.5,
9
+ 0.5,
10
+ 0.5
11
+ ],
12
+ "image_processor_type": "Qwen2VLImageProcessor",
13
+ "image_std": [
14
+ 0.5,
15
+ 0.5,
16
+ 0.5
17
+ ],
18
+ "merge_size": 2,
19
+ "patch_size": 16,
20
+ "resample": 3,
21
+ "rescale_factor": 0.00392156862745098,
22
+ "size": {
23
+ "longest_edge": 16777216,
24
+ "shortest_edge": 65536
25
+ },
26
+ "temporal_patch_size": 2
27
+ },
28
+ "processor_class": "Qwen3VLProcessor",
29
+ "video_processor": {
30
+ "do_convert_rgb": true,
31
+ "do_normalize": true,
32
+ "do_rescale": true,
33
+ "do_resize": true,
34
+ "do_sample_frames": true,
35
+ "fps": 2,
36
+ "image_mean": [
37
+ 0.5,
38
+ 0.5,
39
+ 0.5
40
+ ],
41
+ "image_std": [
42
+ 0.5,
43
+ 0.5,
44
+ 0.5
45
+ ],
46
+ "max_frames": 768,
47
+ "merge_size": 2,
48
+ "min_frames": 4,
49
+ "patch_size": 16,
50
+ "resample": 3,
51
+ "rescale_factor": 0.00392156862745098,
52
+ "return_metadata": false,
53
+ "size": {
54
+ "longest_edge": 25165824,
55
+ "shortest_edge": 4096
56
+ },
57
+ "temporal_patch_size": 2,
58
+ "video_processor_type": "Qwen3VLVideoProcessor"
59
+ }
60
+ }
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:87a7830d63fcf43bf241c3c5242e96e62dd3fdc29224ca26fed8ea333db72de4
3
+ size 19989343
tokenizer_config.json ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "audio_bos_token": "<|audio_start|>",
4
+ "audio_eos_token": "<|audio_end|>",
5
+ "audio_token": "<|audio_pad|>",
6
+ "backend": "tokenizers",
7
+ "bos_token": null,
8
+ "clean_up_tokenization_spaces": false,
9
+ "eos_token": "<|im_end|>",
10
+ "errors": "replace",
11
+ "image_token": "<|image_pad|>",
12
+ "is_local": false,
13
+ "model_max_length": 262144,
14
+ "model_specific_special_tokens": {
15
+ "audio_bos_token": "<|audio_start|>",
16
+ "audio_eos_token": "<|audio_end|>",
17
+ "audio_token": "<|audio_pad|>",
18
+ "image_token": "<|image_pad|>",
19
+ "video_token": "<|video_pad|>",
20
+ "vision_bos_token": "<|vision_start|>",
21
+ "vision_eos_token": "<|vision_end|>"
22
+ },
23
+ "pad_token": "<|endoftext|>",
24
+ "pretokenize_regex": "(?i:'s|'t|'re|'ve|'m|'ll|'d)|[^\\r\\n\\p{L}\\p{N}]?[\\p{L}\\p{M}]+|\\p{N}| ?[^\\s\\p{L}\\p{M}\\p{N}]+[\\r\\n]*|\\s*[\\r\\n]+|\\s+(?!\\S)|\\s+",
25
+ "processor_class": "Qwen3VLProcessor",
26
+ "split_special_tokens": false,
27
+ "tokenizer_class": "TokenizersBackend",
28
+ "unk_token": null,
29
+ "video_token": "<|video_pad|>",
30
+ "vision_bos_token": "<|vision_start|>",
31
+ "vision_eos_token": "<|vision_end|>"
32
+ }