Instructions to use tiny-random/qwen3.8-flash-next with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use tiny-random/qwen3.8-flash-next with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="tiny-random/qwen3.8-flash-next") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("tiny-random/qwen3.8-flash-next") model = AutoModelForMultimodalLM.from_pretrained("tiny-random/qwen3.8-flash-next", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use tiny-random/qwen3.8-flash-next with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "tiny-random/qwen3.8-flash-next" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "tiny-random/qwen3.8-flash-next", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/tiny-random/qwen3.8-flash-next
- SGLang
How to use tiny-random/qwen3.8-flash-next with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "tiny-random/qwen3.8-flash-next" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "tiny-random/qwen3.8-flash-next", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "tiny-random/qwen3.8-flash-next" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "tiny-random/qwen3.8-flash-next", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use tiny-random/qwen3.8-flash-next with Docker Model Runner:
docker model run hf.co/tiny-random/qwen3.8-flash-next
Upload folder using huggingface_hub
Browse files- .meta.json +21 -16
- README.md +185 -168
- config.json +2 -2
- model.safetensors +2 -2
.meta.json
CHANGED
|
@@ -1,17 +1,22 @@
|
|
| 1 |
{
|
| 2 |
-
"
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
"
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
{
|
| 2 |
+
"source_model": {
|
| 3 |
+
"name": "Qwen/Qwen3.8-Flash-Next",
|
| 4 |
+
"commit_id": "de4b8e4d43b917e7706784d8bb445c9af86a3540"
|
| 5 |
+
},
|
| 6 |
+
"env": {
|
| 7 |
+
"python": "3.12.13",
|
| 8 |
+
"packages": {
|
| 9 |
+
"Pillow": "13.0.0",
|
| 10 |
+
"flashinfer-python": "0.7.0.post1",
|
| 11 |
+
"huggingface_hub": "2.3.0",
|
| 12 |
+
"numpy": "2.3.5",
|
| 13 |
+
"safetensors": "0.8.0",
|
| 14 |
+
"tokenizers": "0.23.3",
|
| 15 |
+
"torch": "2.13.0",
|
| 16 |
+
"torchcodec": "0.17.0",
|
| 17 |
+
"transformers": "5.19.0",
|
| 18 |
+
"vllm": "0.32.0"
|
| 19 |
+
},
|
| 20 |
+
"cuda": "13.0"
|
| 21 |
+
}
|
| 22 |
+
}
|
README.md
CHANGED
|
@@ -12,7 +12,7 @@ Structural comparison with `Qwen/Qwen3.8-Flash-Next`:
|
|
| 12 |
|---|---|---|
|
| 13 |
| Architecture / modalities | Qwen4Exp; text, image, video | Same |
|
| 14 |
| Vocabulary / tied embeddings | 248,320 / false | Same |
|
| 15 |
-
| Backbone layers / hidden size | 48 / 2,560 | 8 /
|
| 16 |
| Attention Q/KV heads; head dim | 24/2; 256 | 12/1; 32 |
|
| 17 |
| Attention cycle | 3 linear + 1 QSA | Same; two cycles |
|
| 18 |
| Linear key/value heads; head dim | 16/48; 128 | 4/12; 32 |
|
|
@@ -25,42 +25,58 @@ Structural comparison with `Qwen/Qwen3.8-Flash-Next`:
|
|
| 25 |
| PLE hash bucket base | 20,000,000 | 512; official prime layout |
|
| 26 |
| PLE convolution / serialized table shards | 4 / 128 | Same |
|
| 27 |
| MTP | 1 QSA layer; HC fusion; shared token embeddings | Same |
|
| 28 |
-
| Vision depth / hidden size / output size | 27 / 1,152 / 2,560 | 2 / 64 /
|
| 29 |
| Vision patch / temporal patch / merge | 16 / 2 / 2 | Same |
|
| 30 |
|
| 31 |
PLE retains the source n-gram orders, head count, hash/prime-layout algorithm,
|
| 32 |
projections and convolution with reduced auxiliary hash capacity. The main token
|
| 33 |
vocabulary and IDs are unchanged.
|
| 34 |
-
The
|
|
|
|
|
|
|
|
|
|
| 35 |
Tokenizer and processor assets are copied unchanged from the pinned source.
|
|
|
|
|
|
|
| 36 |
|
| 37 |
| File path | Size |
|
| 38 |
|------|------|
|
| 39 |
-
| model.safetensors |
|
| 40 |
|
| 41 |
|
| 42 |
### Example usage:
|
| 43 |
|
| 44 |
-
-
|
| 45 |
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
|
| 52 |
```bash
|
| 53 |
model_id=tiny-random/qwen3.8-flash-next
|
| 54 |
-
node_rank=${NODE_RANK:-0}
|
| 55 |
-
dist_init_addr=${DIST_INIT_ADDR}
|
| 56 |
-
nccl_port=${NCCL_PORT}
|
| 57 |
sglang serve \
|
| 58 |
--model-path $model_id \
|
| 59 |
--tp-size 4 \
|
| 60 |
-
--nnodes 2 \
|
| 61 |
-
--node-rank $node_rank \
|
| 62 |
-
--dist-init-addr $dist_init_addr \
|
| 63 |
-
--nccl-port $nccl_port \
|
| 64 |
--fp8-gemm-backend triton \
|
| 65 |
--moe-runner-backend triton \
|
| 66 |
--speculative-algorithm NEXTN \
|
|
@@ -131,7 +147,7 @@ folder = Path(save_folder)
|
|
| 131 |
folder.mkdir(parents=True, exist_ok=True)
|
| 132 |
raw = json.loads(Path(hf_hub_download(source_model_id, 'config.json', revision=source_revision)).read_text())
|
| 133 |
raw['text_config'].update(
|
| 134 |
-
hidden_size=
|
| 135 |
layer_types=(["linear_attention"] * 3 + ["full_attention"]) * 2,
|
| 136 |
num_attention_heads=12, num_key_value_heads=1, head_dim=32,
|
| 137 |
linear_num_key_heads=4, linear_num_value_heads=12,
|
|
@@ -139,7 +155,7 @@ raw['text_config'].update(
|
|
| 139 |
num_experts=32, moe_intermediate_size=128, shared_expert_intermediate_size=128,
|
| 140 |
)
|
| 141 |
raw['text_config']['rope_parameters']['mrope_section'] = [2, 1, 1]
|
| 142 |
-
raw['vision_config'].update(depth=2, hidden_size=64, intermediate_size=128, num_heads=4, out_hidden_size=
|
| 143 |
(folder / 'config.json').write_text(json.dumps(raw, indent=2))
|
| 144 |
config = AutoConfig.from_pretrained(folder)
|
| 145 |
model = AutoModelForImageTextToText.from_config(config, dtype=torch.bfloat16)
|
|
@@ -223,21 +239,21 @@ Qwen4ExpForConditionalGeneration(
|
|
| 223 |
(norm): LayerNorm((64,), eps=1e-06, elementwise_affine=True, bias=True)
|
| 224 |
(linear_fc1): Linear(in_features=256, out_features=256, bias=True)
|
| 225 |
(act_fn): GELU(approximate='none')
|
| 226 |
-
(linear_fc2): Linear(in_features=256, out_features=
|
| 227 |
)
|
| 228 |
)
|
| 229 |
(language_model): Qwen4ExpTextModel(
|
| 230 |
-
(embed_tokens): Embedding(248320,
|
| 231 |
(layers): ModuleList(
|
| 232 |
(0): Qwen4ExpTextDecoderLayer(
|
| 233 |
(linear_attn): Qwen4ExpTextGatedDeltaNet(
|
| 234 |
(conv1d): Conv1d(640, 640, kernel_size=(4,), stride=(1,), padding=(3,), groups=640, bias=False)
|
| 235 |
(norm): Qwen4ExpTextRMSNormGated()
|
| 236 |
-
(out_proj): Linear(in_features=384, out_features=
|
| 237 |
-
(in_proj_qkv): Linear(in_features=
|
| 238 |
-
(in_proj_z): Linear(in_features=
|
| 239 |
-
(in_proj_b): Linear(in_features=
|
| 240 |
-
(in_proj_a): Linear(in_features=
|
| 241 |
)
|
| 242 |
(mlp): Qwen4ExpTextSparseMoeBlock(
|
| 243 |
(gate): Qwen4ExpTextTopKRouter()
|
|
@@ -245,35 +261,35 @@ Qwen4ExpForConditionalGeneration(
|
|
| 245 |
(act_fn): SiLUActivation()
|
| 246 |
)
|
| 247 |
(shared_expert): Qwen4ExpTextMLP(
|
| 248 |
-
(gate_proj): Linear(in_features=
|
| 249 |
-
(up_proj): Linear(in_features=
|
| 250 |
-
(down_proj): Linear(in_features=128, out_features=
|
| 251 |
(act_fn): SiLUActivation()
|
| 252 |
)
|
| 253 |
-
(shared_expert_gate): Linear(in_features=
|
| 254 |
)
|
| 255 |
(attn_hyper_connection): Qwen4ExpTextGatedResidual(
|
| 256 |
-
(hc_norm): Qwen4ExpTextRMSNorm((
|
| 257 |
-
(input_mix_weight_down): Linear(in_features=
|
| 258 |
-
(input_mix_weight_up): Linear(in_features=4, out_features=
|
| 259 |
-
(block_inject_weight): Linear(in_features=
|
| 260 |
)
|
| 261 |
(mlp_hyper_connection): Qwen4ExpTextGatedResidual(
|
| 262 |
-
(hc_norm): Qwen4ExpTextRMSNorm((
|
| 263 |
-
(input_mix_weight_down): Linear(in_features=
|
| 264 |
-
(input_mix_weight_up): Linear(in_features=4, out_features=
|
| 265 |
-
(block_inject_weight): Linear(in_features=
|
| 266 |
)
|
| 267 |
)
|
| 268 |
(1): Qwen4ExpTextDecoderLayer(
|
| 269 |
(linear_attn): Qwen4ExpTextGatedDeltaNet(
|
| 270 |
(conv1d): Conv1d(640, 640, kernel_size=(4,), stride=(1,), padding=(3,), groups=640, bias=False)
|
| 271 |
(norm): Qwen4ExpTextRMSNormGated()
|
| 272 |
-
(out_proj): Linear(in_features=384, out_features=
|
| 273 |
-
(in_proj_qkv): Linear(in_features=
|
| 274 |
-
(in_proj_z): Linear(in_features=
|
| 275 |
-
(in_proj_b): Linear(in_features=
|
| 276 |
-
(in_proj_a): Linear(in_features=
|
| 277 |
)
|
| 278 |
(mlp): Qwen4ExpTextSparseMoeBlock(
|
| 279 |
(gate): Qwen4ExpTextTopKRouter()
|
|
@@ -281,46 +297,46 @@ Qwen4ExpForConditionalGeneration(
|
|
| 281 |
(act_fn): SiLUActivation()
|
| 282 |
)
|
| 283 |
(shared_expert): Qwen4ExpTextMLP(
|
| 284 |
-
(gate_proj): Linear(in_features=
|
| 285 |
-
(up_proj): Linear(in_features=
|
| 286 |
-
(down_proj): Linear(in_features=128, out_features=
|
| 287 |
(act_fn): SiLUActivation()
|
| 288 |
)
|
| 289 |
-
(shared_expert_gate): Linear(in_features=
|
| 290 |
)
|
| 291 |
(ple): Qwen4ExpTextPLELayer(
|
| 292 |
(ple_embedding): Qwen4ExpTextNGramEmbedding(
|
| 293 |
(ngram_embedding): Embedding(9216, 1)
|
| 294 |
)
|
| 295 |
-
(key_proj): Linear(in_features=16, out_features=
|
| 296 |
-
(value_proj): Linear(in_features=16, out_features=
|
| 297 |
-
(norm_key): Qwen4ExpTextRMSNorm((
|
| 298 |
-
(norm_query): Qwen4ExpTextRMSNorm((
|
| 299 |
-
(norm_conv): Qwen4ExpTextRMSNorm((
|
| 300 |
-
(conv1d): Conv1d(
|
| 301 |
)
|
| 302 |
(attn_hyper_connection): Qwen4ExpTextGatedResidual(
|
| 303 |
-
(hc_norm): Qwen4ExpTextRMSNorm((
|
| 304 |
-
(input_mix_weight_down): Linear(in_features=
|
| 305 |
-
(input_mix_weight_up): Linear(in_features=4, out_features=
|
| 306 |
-
(block_inject_weight): Linear(in_features=
|
| 307 |
)
|
| 308 |
(mlp_hyper_connection): Qwen4ExpTextGatedResidual(
|
| 309 |
-
(hc_norm): Qwen4ExpTextRMSNorm((
|
| 310 |
-
(input_mix_weight_down): Linear(in_features=
|
| 311 |
-
(input_mix_weight_up): Linear(in_features=4, out_features=
|
| 312 |
-
(block_inject_weight): Linear(in_features=
|
| 313 |
)
|
| 314 |
)
|
| 315 |
(2): Qwen4ExpTextDecoderLayer(
|
| 316 |
(linear_attn): Qwen4ExpTextGatedDeltaNet(
|
| 317 |
(conv1d): Conv1d(640, 640, kernel_size=(4,), stride=(1,), padding=(3,), groups=640, bias=False)
|
| 318 |
(norm): Qwen4ExpTextRMSNormGated()
|
| 319 |
-
(out_proj): Linear(in_features=384, out_features=
|
| 320 |
-
(in_proj_qkv): Linear(in_features=
|
| 321 |
-
(in_proj_z): Linear(in_features=
|
| 322 |
-
(in_proj_b): Linear(in_features=
|
| 323 |
-
(in_proj_a): Linear(in_features=
|
| 324 |
)
|
| 325 |
(mlp): Qwen4ExpTextSparseMoeBlock(
|
| 326 |
(gate): Qwen4ExpTextTopKRouter()
|
|
@@ -328,36 +344,36 @@ Qwen4ExpForConditionalGeneration(
|
|
| 328 |
(act_fn): SiLUActivation()
|
| 329 |
)
|
| 330 |
(shared_expert): Qwen4ExpTextMLP(
|
| 331 |
-
(gate_proj): Linear(in_features=
|
| 332 |
-
(up_proj): Linear(in_features=
|
| 333 |
-
(down_proj): Linear(in_features=128, out_features=
|
| 334 |
(act_fn): SiLUActivation()
|
| 335 |
)
|
| 336 |
-
(shared_expert_gate): Linear(in_features=
|
| 337 |
)
|
| 338 |
(attn_hyper_connection): Qwen4ExpTextGatedResidual(
|
| 339 |
-
(hc_norm): Qwen4ExpTextRMSNorm((
|
| 340 |
-
(input_mix_weight_down): Linear(in_features=
|
| 341 |
-
(input_mix_weight_up): Linear(in_features=4, out_features=
|
| 342 |
-
(block_inject_weight): Linear(in_features=
|
| 343 |
)
|
| 344 |
(mlp_hyper_connection): Qwen4ExpTextGatedResidual(
|
| 345 |
-
(hc_norm): Qwen4ExpTextRMSNorm((
|
| 346 |
-
(input_mix_weight_down): Linear(in_features=
|
| 347 |
-
(input_mix_weight_up): Linear(in_features=4, out_features=
|
| 348 |
-
(block_inject_weight): Linear(in_features=
|
| 349 |
)
|
| 350 |
)
|
| 351 |
(3): Qwen4ExpTextDecoderLayer(
|
| 352 |
(self_attn): Qwen4ExpTextAttention(
|
| 353 |
-
(q_proj): Linear(in_features=
|
| 354 |
-
(k_proj): Linear(in_features=
|
| 355 |
-
(v_proj): Linear(in_features=
|
| 356 |
-
(o_proj): Linear(in_features=384, out_features=
|
| 357 |
(q_norm): Qwen4ExpTextRMSNorm((32,), eps=1e-06)
|
| 358 |
(k_norm): Qwen4ExpTextRMSNorm((32,), eps=1e-06)
|
| 359 |
(indexer): Qwen4ExpTextQSAIndexer(
|
| 360 |
-
(index_qk_proj): Linear(in_features=
|
| 361 |
(q_layernorm): Qwen4ExpTextRMSNorm((128,), eps=1e-06)
|
| 362 |
(k_layernorm): Qwen4ExpTextRMSNorm((128,), eps=1e-06)
|
| 363 |
)
|
|
@@ -368,35 +384,35 @@ Qwen4ExpForConditionalGeneration(
|
|
| 368 |
(act_fn): SiLUActivation()
|
| 369 |
)
|
| 370 |
(shared_expert): Qwen4ExpTextMLP(
|
| 371 |
-
(gate_proj): Linear(in_features=
|
| 372 |
-
(up_proj): Linear(in_features=
|
| 373 |
-
(down_proj): Linear(in_features=128, out_features=
|
| 374 |
(act_fn): SiLUActivation()
|
| 375 |
)
|
| 376 |
-
(shared_expert_gate): Linear(in_features=
|
| 377 |
)
|
| 378 |
(attn_hyper_connection): Qwen4ExpTextGatedResidual(
|
| 379 |
-
(hc_norm): Qwen4ExpTextRMSNorm((
|
| 380 |
-
(input_mix_weight_down): Linear(in_features=
|
| 381 |
-
(input_mix_weight_up): Linear(in_features=4, out_features=
|
| 382 |
-
(block_inject_weight): Linear(in_features=
|
| 383 |
)
|
| 384 |
(mlp_hyper_connection): Qwen4ExpTextGatedResidual(
|
| 385 |
-
(hc_norm): Qwen4ExpTextRMSNorm((
|
| 386 |
-
(input_mix_weight_down): Linear(in_features=
|
| 387 |
-
(input_mix_weight_up): Linear(in_features=4, out_features=
|
| 388 |
-
(block_inject_weight): Linear(in_features=
|
| 389 |
)
|
| 390 |
)
|
| 391 |
(4-6): 3 x Qwen4ExpTextDecoderLayer(
|
| 392 |
(linear_attn): Qwen4ExpTextGatedDeltaNet(
|
| 393 |
(conv1d): Conv1d(640, 640, kernel_size=(4,), stride=(1,), padding=(3,), groups=640, bias=False)
|
| 394 |
(norm): Qwen4ExpTextRMSNormGated()
|
| 395 |
-
(out_proj): Linear(in_features=384, out_features=
|
| 396 |
-
(in_proj_qkv): Linear(in_features=
|
| 397 |
-
(in_proj_z): Linear(in_features=
|
| 398 |
-
(in_proj_b): Linear(in_features=
|
| 399 |
-
(in_proj_a): Linear(in_features=
|
| 400 |
)
|
| 401 |
(mlp): Qwen4ExpTextSparseMoeBlock(
|
| 402 |
(gate): Qwen4ExpTextTopKRouter()
|
|
@@ -404,36 +420,36 @@ Qwen4ExpForConditionalGeneration(
|
|
| 404 |
(act_fn): SiLUActivation()
|
| 405 |
)
|
| 406 |
(shared_expert): Qwen4ExpTextMLP(
|
| 407 |
-
(gate_proj): Linear(in_features=
|
| 408 |
-
(up_proj): Linear(in_features=
|
| 409 |
-
(down_proj): Linear(in_features=128, out_features=
|
| 410 |
(act_fn): SiLUActivation()
|
| 411 |
)
|
| 412 |
-
(shared_expert_gate): Linear(in_features=
|
| 413 |
)
|
| 414 |
(attn_hyper_connection): Qwen4ExpTextGatedResidual(
|
| 415 |
-
(hc_norm): Qwen4ExpTextRMSNorm((
|
| 416 |
-
(input_mix_weight_down): Linear(in_features=
|
| 417 |
-
(input_mix_weight_up): Linear(in_features=4, out_features=
|
| 418 |
-
(block_inject_weight): Linear(in_features=
|
| 419 |
)
|
| 420 |
(mlp_hyper_connection): Qwen4ExpTextGatedResidual(
|
| 421 |
-
(hc_norm): Qwen4ExpTextRMSNorm((
|
| 422 |
-
(input_mix_weight_down): Linear(in_features=
|
| 423 |
-
(input_mix_weight_up): Linear(in_features=4, out_features=
|
| 424 |
-
(block_inject_weight): Linear(in_features=
|
| 425 |
)
|
| 426 |
)
|
| 427 |
(7): Qwen4ExpTextDecoderLayer(
|
| 428 |
(self_attn): Qwen4ExpTextAttention(
|
| 429 |
-
(q_proj): Linear(in_features=
|
| 430 |
-
(k_proj): Linear(in_features=
|
| 431 |
-
(v_proj): Linear(in_features=
|
| 432 |
-
(o_proj): Linear(in_features=384, out_features=
|
| 433 |
(q_norm): Qwen4ExpTextRMSNorm((32,), eps=1e-06)
|
| 434 |
(k_norm): Qwen4ExpTextRMSNorm((32,), eps=1e-06)
|
| 435 |
(indexer): Qwen4ExpTextQSAIndexer(
|
| 436 |
-
(index_qk_proj): Linear(in_features=
|
| 437 |
(q_layernorm): Qwen4ExpTextRMSNorm((128,), eps=1e-06)
|
| 438 |
(k_layernorm): Qwen4ExpTextRMSNorm((128,), eps=1e-06)
|
| 439 |
)
|
|
@@ -444,52 +460,52 @@ Qwen4ExpForConditionalGeneration(
|
|
| 444 |
(act_fn): SiLUActivation()
|
| 445 |
)
|
| 446 |
(shared_expert): Qwen4ExpTextMLP(
|
| 447 |
-
(gate_proj): Linear(in_features=
|
| 448 |
-
(up_proj): Linear(in_features=
|
| 449 |
-
(down_proj): Linear(in_features=128, out_features=
|
| 450 |
(act_fn): SiLUActivation()
|
| 451 |
)
|
| 452 |
-
(shared_expert_gate): Linear(in_features=
|
| 453 |
)
|
| 454 |
(attn_hyper_connection): Qwen4ExpTextGatedResidual(
|
| 455 |
-
(hc_norm): Qwen4ExpTextRMSNorm((
|
| 456 |
-
(input_mix_weight_down): Linear(in_features=
|
| 457 |
-
(input_mix_weight_up): Linear(in_features=4, out_features=
|
| 458 |
-
(block_inject_weight): Linear(in_features=
|
| 459 |
)
|
| 460 |
(mlp_hyper_connection): Qwen4ExpTextGatedResidual(
|
| 461 |
-
(hc_norm): Qwen4ExpTextRMSNorm((
|
| 462 |
-
(input_mix_weight_down): Linear(in_features=
|
| 463 |
-
(input_mix_weight_up): Linear(in_features=4, out_features=
|
| 464 |
-
(block_inject_weight): Linear(in_features=
|
| 465 |
)
|
| 466 |
)
|
| 467 |
)
|
| 468 |
(rotary_emb): Qwen4ExpTextRotaryEmbedding()
|
| 469 |
(hyper_connection_mixer): Qwen4ExpTextGatedResidual(
|
| 470 |
-
(hc_norm): Qwen4ExpTextRMSNorm((
|
| 471 |
-
(input_mix_weight_down): Linear(in_features=
|
| 472 |
-
(input_mix_weight_up): Linear(in_features=4, out_features=
|
| 473 |
)
|
| 474 |
)
|
| 475 |
)
|
| 476 |
-
(lm_head): Linear(in_features=
|
| 477 |
(mtp): ModuleDict(
|
| 478 |
-
(fc_embedding): Linear(in_features=
|
| 479 |
-
(fc_hidden): Linear(in_features=
|
| 480 |
-
(pre_fc_norm_embedding): Qwen4ExpTextRMSNorm((
|
| 481 |
-
(pre_fc_norm_hidden): Qwen4ExpTextRMSNorm((
|
| 482 |
(layers): ModuleList(
|
| 483 |
(0): Qwen4ExpTextDecoderLayer(
|
| 484 |
(self_attn): Qwen4ExpTextAttention(
|
| 485 |
-
(q_proj): Linear(in_features=
|
| 486 |
-
(k_proj): Linear(in_features=
|
| 487 |
-
(v_proj): Linear(in_features=
|
| 488 |
-
(o_proj): Linear(in_features=384, out_features=
|
| 489 |
(q_norm): Qwen4ExpTextRMSNorm((32,), eps=1e-06)
|
| 490 |
(k_norm): Qwen4ExpTextRMSNorm((32,), eps=1e-06)
|
| 491 |
(indexer): Qwen4ExpTextQSAIndexer(
|
| 492 |
-
(index_qk_proj): Linear(in_features=
|
| 493 |
(q_layernorm): Qwen4ExpTextRMSNorm((128,), eps=1e-06)
|
| 494 |
(k_layernorm): Qwen4ExpTextRMSNorm((128,), eps=1e-06)
|
| 495 |
)
|
|
@@ -500,31 +516,31 @@ Qwen4ExpForConditionalGeneration(
|
|
| 500 |
(act_fn): SiLUActivation()
|
| 501 |
)
|
| 502 |
(shared_expert): Qwen4ExpTextMLP(
|
| 503 |
-
(gate_proj): Linear(in_features=
|
| 504 |
-
(up_proj): Linear(in_features=
|
| 505 |
-
(down_proj): Linear(in_features=128, out_features=
|
| 506 |
(act_fn): SiLUActivation()
|
| 507 |
)
|
| 508 |
-
(shared_expert_gate): Linear(in_features=
|
| 509 |
)
|
| 510 |
(attn_hyper_connection): Qwen4ExpTextGatedResidual(
|
| 511 |
-
(hc_norm): Qwen4ExpTextRMSNorm((
|
| 512 |
-
(input_mix_weight_down): Linear(in_features=
|
| 513 |
-
(input_mix_weight_up): Linear(in_features=4, out_features=
|
| 514 |
-
(block_inject_weight): Linear(in_features=
|
| 515 |
)
|
| 516 |
(mlp_hyper_connection): Qwen4ExpTextGatedResidual(
|
| 517 |
-
(hc_norm): Qwen4ExpTextRMSNorm((
|
| 518 |
-
(input_mix_weight_down): Linear(in_features=
|
| 519 |
-
(input_mix_weight_up): Linear(in_features=4, out_features=
|
| 520 |
-
(block_inject_weight): Linear(in_features=
|
| 521 |
)
|
| 522 |
)
|
| 523 |
)
|
| 524 |
(hyper_connection_mixer): Qwen4ExpTextGatedResidual(
|
| 525 |
-
(hc_norm): Qwen4ExpTextRMSNorm((
|
| 526 |
-
(input_mix_weight_down): Linear(in_features=
|
| 527 |
-
(input_mix_weight_up): Linear(in_features=4, out_features=
|
| 528 |
)
|
| 529 |
)
|
| 530 |
)
|
|
@@ -534,25 +550,26 @@ Qwen4ExpForConditionalGeneration(
|
|
| 534 |
|
| 535 |
### Test environment:
|
| 536 |
|
| 537 |
-
- Pillow:
|
| 538 |
-
-
|
| 539 |
-
-
|
| 540 |
-
- flashinfer-python: 0.7.2
|
| 541 |
-
- huggingface_hub: 1.33.0
|
| 542 |
-
- kernels: 0.17.0
|
| 543 |
- numpy: 2.3.5
|
| 544 |
- safetensors: 0.8.0
|
| 545 |
-
-
|
| 546 |
-
- torch: 2.
|
| 547 |
- torchcodec: 0.17.0
|
| 548 |
- transformers: 5.19.0
|
| 549 |
-
-
|
| 550 |
-
- CUDA: 13.0
|
| 551 |
-
-
|
|
|
|
|
|
|
|
|
|
| 552 |
|
| 553 |
### Change log:
|
| 554 |
|
| 555 |
- 2026-10-23: Initial version.
|
| 556 |
- 2026-10-23: Creation examples use only public dependencies; source assets are copied unchanged.
|
|
|
|
| 557 |
|
| 558 |
This repo is generated by GPT-6.1-Sol
|
|
|
|
| 12 |
|---|---|---|
|
| 13 |
| Architecture / modalities | Qwen4Exp; text, image, video | Same |
|
| 14 |
| Vocabulary / tied embeddings | 248,320 / false | Same |
|
| 15 |
+
| Backbone layers / hidden size | 48 / 2,560 | 8 / 8 |
|
| 16 |
| Attention Q/KV heads; head dim | 24/2; 256 | 12/1; 32 |
|
| 17 |
| Attention cycle | 3 linear + 1 QSA | Same; two cycles |
|
| 18 |
| Linear key/value heads; head dim | 16/48; 128 | 4/12; 32 |
|
|
|
|
| 25 |
| PLE hash bucket base | 20,000,000 | 512; official prime layout |
|
| 26 |
| PLE convolution / serialized table shards | 4 / 128 | Same |
|
| 27 |
| MTP | 1 QSA layer; HC fusion; shared token embeddings | Same |
|
| 28 |
+
| Vision depth / hidden size / output size | 27 / 1,152 / 2,560 | 2 / 64 / 8 |
|
| 29 |
| Vision patch / temporal patch / merge | 16 / 2 / 2 | Same |
|
| 30 |
|
| 31 |
PLE retains the source n-gram orders, head count, hash/prime-layout algorithm,
|
| 32 |
projections and convolution with reduced auxiliary hash capacity. The main token
|
| 33 |
vocabulary and IDs are unchanged.
|
| 34 |
+
The Qwen4Exp Hyper-Connections/MTP TP=4 path requires an eight-wide hidden state:
|
| 35 |
+
the four-wide configuration creates non-contiguous per-rank MTP block outputs in
|
| 36 |
+
vLLM. The two untied BF16 token embedding/head matrices at width 8 occupy
|
| 37 |
+
7,946,240 bytes; the complete verified checkpoint is 10,886,632 bytes.
|
| 38 |
Tokenizer and processor assets are copied unchanged from the pinned source.
|
| 39 |
+
vLLM 0.32.0 was verified on one four-NVIDIA-H20 node with TP=4, CUDA Graph,
|
| 40 |
+
three-token MTP, and real text, image, and four-frame video requests.
|
| 41 |
|
| 42 |
| File path | Size |
|
| 43 |
|------|------|
|
| 44 |
+
| model.safetensors | 10.9MB |
|
| 45 |
|
| 46 |
|
| 47 |
### Example usage:
|
| 48 |
|
| 49 |
+
- vLLM (✅ verified)
|
| 50 |
|
| 51 |
+
```bash
|
| 52 |
+
export VLLM_ALLREDUCE_USE_FLASHINFER=0
|
| 53 |
+
export VLLM_ALLREDUCE_USE_SYMM_MEM=0
|
| 54 |
+
vllm serve tiny-random/qwen3.8-flash-next \\
|
| 55 |
+
--tensor-parallel-size 4 \\
|
| 56 |
+
--disable-custom-all-reduce \\
|
| 57 |
+
--kernel-config '{"moe_backend":"triton"}' \\
|
| 58 |
+
--gdn-prefill-backend triton \\
|
| 59 |
+
--speculative-config '{"method":"mtp","num_speculative_tokens":3}' \\
|
| 60 |
+
--max-model-len 4096 \\
|
| 61 |
+
--max-num-batched-tokens 512 \\
|
| 62 |
+
--max-num-seqs 4 \\
|
| 63 |
+
--gpu-memory-utilization 0.3 \\
|
| 64 |
+
--compilation-config '{"cudagraph_capture_sizes":[1,2,4,8,16]}'
|
| 65 |
+
```
|
| 66 |
+
|
| 67 |
+
- SGLang (unverified)
|
| 68 |
+
|
| 69 |
+
- Run on one four-GPU node. Enables TP=4, NEXTN/MTP and CUDA Graph.
|
| 70 |
+
- Unverified on the tested NVIDIA H20 worker: its CUDA 12.2 driver cannot
|
| 71 |
+
load the CUDA 13 SGLang kernel and TileLang artifacts required by this
|
| 72 |
+
Qwen4Exp release. Use the Test environment versions with a CUDA 13-capable
|
| 73 |
+
driver for TP=4 validation.
|
| 74 |
|
| 75 |
```bash
|
| 76 |
model_id=tiny-random/qwen3.8-flash-next
|
|
|
|
|
|
|
|
|
|
| 77 |
sglang serve \
|
| 78 |
--model-path $model_id \
|
| 79 |
--tp-size 4 \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
--fp8-gemm-backend triton \
|
| 81 |
--moe-runner-backend triton \
|
| 82 |
--speculative-algorithm NEXTN \
|
|
|
|
| 147 |
folder.mkdir(parents=True, exist_ok=True)
|
| 148 |
raw = json.loads(Path(hf_hub_download(source_model_id, 'config.json', revision=source_revision)).read_text())
|
| 149 |
raw['text_config'].update(
|
| 150 |
+
hidden_size=8, ple_embed_dim=16, ngram_vocab_size_base=512, hc_lowrank=4, num_hidden_layers=8,
|
| 151 |
layer_types=(["linear_attention"] * 3 + ["full_attention"]) * 2,
|
| 152 |
num_attention_heads=12, num_key_value_heads=1, head_dim=32,
|
| 153 |
linear_num_key_heads=4, linear_num_value_heads=12,
|
|
|
|
| 155 |
num_experts=32, moe_intermediate_size=128, shared_expert_intermediate_size=128,
|
| 156 |
)
|
| 157 |
raw['text_config']['rope_parameters']['mrope_section'] = [2, 1, 1]
|
| 158 |
+
raw['vision_config'].update(depth=2, hidden_size=64, intermediate_size=128, num_heads=4, out_hidden_size=8)
|
| 159 |
(folder / 'config.json').write_text(json.dumps(raw, indent=2))
|
| 160 |
config = AutoConfig.from_pretrained(folder)
|
| 161 |
model = AutoModelForImageTextToText.from_config(config, dtype=torch.bfloat16)
|
|
|
|
| 239 |
(norm): LayerNorm((64,), eps=1e-06, elementwise_affine=True, bias=True)
|
| 240 |
(linear_fc1): Linear(in_features=256, out_features=256, bias=True)
|
| 241 |
(act_fn): GELU(approximate='none')
|
| 242 |
+
(linear_fc2): Linear(in_features=256, out_features=8, bias=True)
|
| 243 |
)
|
| 244 |
)
|
| 245 |
(language_model): Qwen4ExpTextModel(
|
| 246 |
+
(embed_tokens): Embedding(248320, 8)
|
| 247 |
(layers): ModuleList(
|
| 248 |
(0): Qwen4ExpTextDecoderLayer(
|
| 249 |
(linear_attn): Qwen4ExpTextGatedDeltaNet(
|
| 250 |
(conv1d): Conv1d(640, 640, kernel_size=(4,), stride=(1,), padding=(3,), groups=640, bias=False)
|
| 251 |
(norm): Qwen4ExpTextRMSNormGated()
|
| 252 |
+
(out_proj): Linear(in_features=384, out_features=8, bias=False)
|
| 253 |
+
(in_proj_qkv): Linear(in_features=8, out_features=640, bias=False)
|
| 254 |
+
(in_proj_z): Linear(in_features=8, out_features=384, bias=False)
|
| 255 |
+
(in_proj_b): Linear(in_features=8, out_features=12, bias=False)
|
| 256 |
+
(in_proj_a): Linear(in_features=8, out_features=12, bias=False)
|
| 257 |
)
|
| 258 |
(mlp): Qwen4ExpTextSparseMoeBlock(
|
| 259 |
(gate): Qwen4ExpTextTopKRouter()
|
|
|
|
| 261 |
(act_fn): SiLUActivation()
|
| 262 |
)
|
| 263 |
(shared_expert): Qwen4ExpTextMLP(
|
| 264 |
+
(gate_proj): Linear(in_features=8, out_features=128, bias=False)
|
| 265 |
+
(up_proj): Linear(in_features=8, out_features=128, bias=False)
|
| 266 |
+
(down_proj): Linear(in_features=128, out_features=8, bias=False)
|
| 267 |
(act_fn): SiLUActivation()
|
| 268 |
)
|
| 269 |
+
(shared_expert_gate): Linear(in_features=8, out_features=1, bias=False)
|
| 270 |
)
|
| 271 |
(attn_hyper_connection): Qwen4ExpTextGatedResidual(
|
| 272 |
+
(hc_norm): Qwen4ExpTextRMSNorm((32,), eps=1e-06)
|
| 273 |
+
(input_mix_weight_down): Linear(in_features=32, out_features=4, bias=False)
|
| 274 |
+
(input_mix_weight_up): Linear(in_features=4, out_features=32, bias=False)
|
| 275 |
+
(block_inject_weight): Linear(in_features=32, out_features=4, bias=False)
|
| 276 |
)
|
| 277 |
(mlp_hyper_connection): Qwen4ExpTextGatedResidual(
|
| 278 |
+
(hc_norm): Qwen4ExpTextRMSNorm((32,), eps=1e-06)
|
| 279 |
+
(input_mix_weight_down): Linear(in_features=32, out_features=4, bias=False)
|
| 280 |
+
(input_mix_weight_up): Linear(in_features=4, out_features=32, bias=False)
|
| 281 |
+
(block_inject_weight): Linear(in_features=32, out_features=4, bias=False)
|
| 282 |
)
|
| 283 |
)
|
| 284 |
(1): Qwen4ExpTextDecoderLayer(
|
| 285 |
(linear_attn): Qwen4ExpTextGatedDeltaNet(
|
| 286 |
(conv1d): Conv1d(640, 640, kernel_size=(4,), stride=(1,), padding=(3,), groups=640, bias=False)
|
| 287 |
(norm): Qwen4ExpTextRMSNormGated()
|
| 288 |
+
(out_proj): Linear(in_features=384, out_features=8, bias=False)
|
| 289 |
+
(in_proj_qkv): Linear(in_features=8, out_features=640, bias=False)
|
| 290 |
+
(in_proj_z): Linear(in_features=8, out_features=384, bias=False)
|
| 291 |
+
(in_proj_b): Linear(in_features=8, out_features=12, bias=False)
|
| 292 |
+
(in_proj_a): Linear(in_features=8, out_features=12, bias=False)
|
| 293 |
)
|
| 294 |
(mlp): Qwen4ExpTextSparseMoeBlock(
|
| 295 |
(gate): Qwen4ExpTextTopKRouter()
|
|
|
|
| 297 |
(act_fn): SiLUActivation()
|
| 298 |
)
|
| 299 |
(shared_expert): Qwen4ExpTextMLP(
|
| 300 |
+
(gate_proj): Linear(in_features=8, out_features=128, bias=False)
|
| 301 |
+
(up_proj): Linear(in_features=8, out_features=128, bias=False)
|
| 302 |
+
(down_proj): Linear(in_features=128, out_features=8, bias=False)
|
| 303 |
(act_fn): SiLUActivation()
|
| 304 |
)
|
| 305 |
+
(shared_expert_gate): Linear(in_features=8, out_features=1, bias=False)
|
| 306 |
)
|
| 307 |
(ple): Qwen4ExpTextPLELayer(
|
| 308 |
(ple_embedding): Qwen4ExpTextNGramEmbedding(
|
| 309 |
(ngram_embedding): Embedding(9216, 1)
|
| 310 |
)
|
| 311 |
+
(key_proj): Linear(in_features=16, out_features=32, bias=False)
|
| 312 |
+
(value_proj): Linear(in_features=16, out_features=8, bias=False)
|
| 313 |
+
(norm_key): Qwen4ExpTextRMSNorm((32,), eps=1e-06)
|
| 314 |
+
(norm_query): Qwen4ExpTextRMSNorm((32,), eps=1e-06)
|
| 315 |
+
(norm_conv): Qwen4ExpTextRMSNorm((32,), eps=1e-06)
|
| 316 |
+
(conv1d): Conv1d(32, 32, kernel_size=(4,), stride=(1,), dilation=(3,), groups=32, bias=False)
|
| 317 |
)
|
| 318 |
(attn_hyper_connection): Qwen4ExpTextGatedResidual(
|
| 319 |
+
(hc_norm): Qwen4ExpTextRMSNorm((32,), eps=1e-06)
|
| 320 |
+
(input_mix_weight_down): Linear(in_features=32, out_features=4, bias=False)
|
| 321 |
+
(input_mix_weight_up): Linear(in_features=4, out_features=32, bias=False)
|
| 322 |
+
(block_inject_weight): Linear(in_features=32, out_features=4, bias=False)
|
| 323 |
)
|
| 324 |
(mlp_hyper_connection): Qwen4ExpTextGatedResidual(
|
| 325 |
+
(hc_norm): Qwen4ExpTextRMSNorm((32,), eps=1e-06)
|
| 326 |
+
(input_mix_weight_down): Linear(in_features=32, out_features=4, bias=False)
|
| 327 |
+
(input_mix_weight_up): Linear(in_features=4, out_features=32, bias=False)
|
| 328 |
+
(block_inject_weight): Linear(in_features=32, out_features=4, bias=False)
|
| 329 |
)
|
| 330 |
)
|
| 331 |
(2): Qwen4ExpTextDecoderLayer(
|
| 332 |
(linear_attn): Qwen4ExpTextGatedDeltaNet(
|
| 333 |
(conv1d): Conv1d(640, 640, kernel_size=(4,), stride=(1,), padding=(3,), groups=640, bias=False)
|
| 334 |
(norm): Qwen4ExpTextRMSNormGated()
|
| 335 |
+
(out_proj): Linear(in_features=384, out_features=8, bias=False)
|
| 336 |
+
(in_proj_qkv): Linear(in_features=8, out_features=640, bias=False)
|
| 337 |
+
(in_proj_z): Linear(in_features=8, out_features=384, bias=False)
|
| 338 |
+
(in_proj_b): Linear(in_features=8, out_features=12, bias=False)
|
| 339 |
+
(in_proj_a): Linear(in_features=8, out_features=12, bias=False)
|
| 340 |
)
|
| 341 |
(mlp): Qwen4ExpTextSparseMoeBlock(
|
| 342 |
(gate): Qwen4ExpTextTopKRouter()
|
|
|
|
| 344 |
(act_fn): SiLUActivation()
|
| 345 |
)
|
| 346 |
(shared_expert): Qwen4ExpTextMLP(
|
| 347 |
+
(gate_proj): Linear(in_features=8, out_features=128, bias=False)
|
| 348 |
+
(up_proj): Linear(in_features=8, out_features=128, bias=False)
|
| 349 |
+
(down_proj): Linear(in_features=128, out_features=8, bias=False)
|
| 350 |
(act_fn): SiLUActivation()
|
| 351 |
)
|
| 352 |
+
(shared_expert_gate): Linear(in_features=8, out_features=1, bias=False)
|
| 353 |
)
|
| 354 |
(attn_hyper_connection): Qwen4ExpTextGatedResidual(
|
| 355 |
+
(hc_norm): Qwen4ExpTextRMSNorm((32,), eps=1e-06)
|
| 356 |
+
(input_mix_weight_down): Linear(in_features=32, out_features=4, bias=False)
|
| 357 |
+
(input_mix_weight_up): Linear(in_features=4, out_features=32, bias=False)
|
| 358 |
+
(block_inject_weight): Linear(in_features=32, out_features=4, bias=False)
|
| 359 |
)
|
| 360 |
(mlp_hyper_connection): Qwen4ExpTextGatedResidual(
|
| 361 |
+
(hc_norm): Qwen4ExpTextRMSNorm((32,), eps=1e-06)
|
| 362 |
+
(input_mix_weight_down): Linear(in_features=32, out_features=4, bias=False)
|
| 363 |
+
(input_mix_weight_up): Linear(in_features=4, out_features=32, bias=False)
|
| 364 |
+
(block_inject_weight): Linear(in_features=32, out_features=4, bias=False)
|
| 365 |
)
|
| 366 |
)
|
| 367 |
(3): Qwen4ExpTextDecoderLayer(
|
| 368 |
(self_attn): Qwen4ExpTextAttention(
|
| 369 |
+
(q_proj): Linear(in_features=8, out_features=768, bias=False)
|
| 370 |
+
(k_proj): Linear(in_features=8, out_features=32, bias=False)
|
| 371 |
+
(v_proj): Linear(in_features=8, out_features=32, bias=False)
|
| 372 |
+
(o_proj): Linear(in_features=384, out_features=8, bias=False)
|
| 373 |
(q_norm): Qwen4ExpTextRMSNorm((32,), eps=1e-06)
|
| 374 |
(k_norm): Qwen4ExpTextRMSNorm((32,), eps=1e-06)
|
| 375 |
(indexer): Qwen4ExpTextQSAIndexer(
|
| 376 |
+
(index_qk_proj): Linear(in_features=8, out_features=640, bias=False)
|
| 377 |
(q_layernorm): Qwen4ExpTextRMSNorm((128,), eps=1e-06)
|
| 378 |
(k_layernorm): Qwen4ExpTextRMSNorm((128,), eps=1e-06)
|
| 379 |
)
|
|
|
|
| 384 |
(act_fn): SiLUActivation()
|
| 385 |
)
|
| 386 |
(shared_expert): Qwen4ExpTextMLP(
|
| 387 |
+
(gate_proj): Linear(in_features=8, out_features=128, bias=False)
|
| 388 |
+
(up_proj): Linear(in_features=8, out_features=128, bias=False)
|
| 389 |
+
(down_proj): Linear(in_features=128, out_features=8, bias=False)
|
| 390 |
(act_fn): SiLUActivation()
|
| 391 |
)
|
| 392 |
+
(shared_expert_gate): Linear(in_features=8, out_features=1, bias=False)
|
| 393 |
)
|
| 394 |
(attn_hyper_connection): Qwen4ExpTextGatedResidual(
|
| 395 |
+
(hc_norm): Qwen4ExpTextRMSNorm((32,), eps=1e-06)
|
| 396 |
+
(input_mix_weight_down): Linear(in_features=32, out_features=4, bias=False)
|
| 397 |
+
(input_mix_weight_up): Linear(in_features=4, out_features=32, bias=False)
|
| 398 |
+
(block_inject_weight): Linear(in_features=32, out_features=4, bias=False)
|
| 399 |
)
|
| 400 |
(mlp_hyper_connection): Qwen4ExpTextGatedResidual(
|
| 401 |
+
(hc_norm): Qwen4ExpTextRMSNorm((32,), eps=1e-06)
|
| 402 |
+
(input_mix_weight_down): Linear(in_features=32, out_features=4, bias=False)
|
| 403 |
+
(input_mix_weight_up): Linear(in_features=4, out_features=32, bias=False)
|
| 404 |
+
(block_inject_weight): Linear(in_features=32, out_features=4, bias=False)
|
| 405 |
)
|
| 406 |
)
|
| 407 |
(4-6): 3 x Qwen4ExpTextDecoderLayer(
|
| 408 |
(linear_attn): Qwen4ExpTextGatedDeltaNet(
|
| 409 |
(conv1d): Conv1d(640, 640, kernel_size=(4,), stride=(1,), padding=(3,), groups=640, bias=False)
|
| 410 |
(norm): Qwen4ExpTextRMSNormGated()
|
| 411 |
+
(out_proj): Linear(in_features=384, out_features=8, bias=False)
|
| 412 |
+
(in_proj_qkv): Linear(in_features=8, out_features=640, bias=False)
|
| 413 |
+
(in_proj_z): Linear(in_features=8, out_features=384, bias=False)
|
| 414 |
+
(in_proj_b): Linear(in_features=8, out_features=12, bias=False)
|
| 415 |
+
(in_proj_a): Linear(in_features=8, out_features=12, bias=False)
|
| 416 |
)
|
| 417 |
(mlp): Qwen4ExpTextSparseMoeBlock(
|
| 418 |
(gate): Qwen4ExpTextTopKRouter()
|
|
|
|
| 420 |
(act_fn): SiLUActivation()
|
| 421 |
)
|
| 422 |
(shared_expert): Qwen4ExpTextMLP(
|
| 423 |
+
(gate_proj): Linear(in_features=8, out_features=128, bias=False)
|
| 424 |
+
(up_proj): Linear(in_features=8, out_features=128, bias=False)
|
| 425 |
+
(down_proj): Linear(in_features=128, out_features=8, bias=False)
|
| 426 |
(act_fn): SiLUActivation()
|
| 427 |
)
|
| 428 |
+
(shared_expert_gate): Linear(in_features=8, out_features=1, bias=False)
|
| 429 |
)
|
| 430 |
(attn_hyper_connection): Qwen4ExpTextGatedResidual(
|
| 431 |
+
(hc_norm): Qwen4ExpTextRMSNorm((32,), eps=1e-06)
|
| 432 |
+
(input_mix_weight_down): Linear(in_features=32, out_features=4, bias=False)
|
| 433 |
+
(input_mix_weight_up): Linear(in_features=4, out_features=32, bias=False)
|
| 434 |
+
(block_inject_weight): Linear(in_features=32, out_features=4, bias=False)
|
| 435 |
)
|
| 436 |
(mlp_hyper_connection): Qwen4ExpTextGatedResidual(
|
| 437 |
+
(hc_norm): Qwen4ExpTextRMSNorm((32,), eps=1e-06)
|
| 438 |
+
(input_mix_weight_down): Linear(in_features=32, out_features=4, bias=False)
|
| 439 |
+
(input_mix_weight_up): Linear(in_features=4, out_features=32, bias=False)
|
| 440 |
+
(block_inject_weight): Linear(in_features=32, out_features=4, bias=False)
|
| 441 |
)
|
| 442 |
)
|
| 443 |
(7): Qwen4ExpTextDecoderLayer(
|
| 444 |
(self_attn): Qwen4ExpTextAttention(
|
| 445 |
+
(q_proj): Linear(in_features=8, out_features=768, bias=False)
|
| 446 |
+
(k_proj): Linear(in_features=8, out_features=32, bias=False)
|
| 447 |
+
(v_proj): Linear(in_features=8, out_features=32, bias=False)
|
| 448 |
+
(o_proj): Linear(in_features=384, out_features=8, bias=False)
|
| 449 |
(q_norm): Qwen4ExpTextRMSNorm((32,), eps=1e-06)
|
| 450 |
(k_norm): Qwen4ExpTextRMSNorm((32,), eps=1e-06)
|
| 451 |
(indexer): Qwen4ExpTextQSAIndexer(
|
| 452 |
+
(index_qk_proj): Linear(in_features=8, out_features=640, bias=False)
|
| 453 |
(q_layernorm): Qwen4ExpTextRMSNorm((128,), eps=1e-06)
|
| 454 |
(k_layernorm): Qwen4ExpTextRMSNorm((128,), eps=1e-06)
|
| 455 |
)
|
|
|
|
| 460 |
(act_fn): SiLUActivation()
|
| 461 |
)
|
| 462 |
(shared_expert): Qwen4ExpTextMLP(
|
| 463 |
+
(gate_proj): Linear(in_features=8, out_features=128, bias=False)
|
| 464 |
+
(up_proj): Linear(in_features=8, out_features=128, bias=False)
|
| 465 |
+
(down_proj): Linear(in_features=128, out_features=8, bias=False)
|
| 466 |
(act_fn): SiLUActivation()
|
| 467 |
)
|
| 468 |
+
(shared_expert_gate): Linear(in_features=8, out_features=1, bias=False)
|
| 469 |
)
|
| 470 |
(attn_hyper_connection): Qwen4ExpTextGatedResidual(
|
| 471 |
+
(hc_norm): Qwen4ExpTextRMSNorm((32,), eps=1e-06)
|
| 472 |
+
(input_mix_weight_down): Linear(in_features=32, out_features=4, bias=False)
|
| 473 |
+
(input_mix_weight_up): Linear(in_features=4, out_features=32, bias=False)
|
| 474 |
+
(block_inject_weight): Linear(in_features=32, out_features=4, bias=False)
|
| 475 |
)
|
| 476 |
(mlp_hyper_connection): Qwen4ExpTextGatedResidual(
|
| 477 |
+
(hc_norm): Qwen4ExpTextRMSNorm((32,), eps=1e-06)
|
| 478 |
+
(input_mix_weight_down): Linear(in_features=32, out_features=4, bias=False)
|
| 479 |
+
(input_mix_weight_up): Linear(in_features=4, out_features=32, bias=False)
|
| 480 |
+
(block_inject_weight): Linear(in_features=32, out_features=4, bias=False)
|
| 481 |
)
|
| 482 |
)
|
| 483 |
)
|
| 484 |
(rotary_emb): Qwen4ExpTextRotaryEmbedding()
|
| 485 |
(hyper_connection_mixer): Qwen4ExpTextGatedResidual(
|
| 486 |
+
(hc_norm): Qwen4ExpTextRMSNorm((32,), eps=1e-06)
|
| 487 |
+
(input_mix_weight_down): Linear(in_features=32, out_features=4, bias=False)
|
| 488 |
+
(input_mix_weight_up): Linear(in_features=4, out_features=32, bias=False)
|
| 489 |
)
|
| 490 |
)
|
| 491 |
)
|
| 492 |
+
(lm_head): Linear(in_features=8, out_features=248320, bias=False)
|
| 493 |
(mtp): ModuleDict(
|
| 494 |
+
(fc_embedding): Linear(in_features=8, out_features=8, bias=False)
|
| 495 |
+
(fc_hidden): Linear(in_features=8, out_features=8, bias=False)
|
| 496 |
+
(pre_fc_norm_embedding): Qwen4ExpTextRMSNorm((8,), eps=1e-06)
|
| 497 |
+
(pre_fc_norm_hidden): Qwen4ExpTextRMSNorm((32,), eps=1e-06)
|
| 498 |
(layers): ModuleList(
|
| 499 |
(0): Qwen4ExpTextDecoderLayer(
|
| 500 |
(self_attn): Qwen4ExpTextAttention(
|
| 501 |
+
(q_proj): Linear(in_features=8, out_features=768, bias=False)
|
| 502 |
+
(k_proj): Linear(in_features=8, out_features=32, bias=False)
|
| 503 |
+
(v_proj): Linear(in_features=8, out_features=32, bias=False)
|
| 504 |
+
(o_proj): Linear(in_features=384, out_features=8, bias=False)
|
| 505 |
(q_norm): Qwen4ExpTextRMSNorm((32,), eps=1e-06)
|
| 506 |
(k_norm): Qwen4ExpTextRMSNorm((32,), eps=1e-06)
|
| 507 |
(indexer): Qwen4ExpTextQSAIndexer(
|
| 508 |
+
(index_qk_proj): Linear(in_features=8, out_features=640, bias=False)
|
| 509 |
(q_layernorm): Qwen4ExpTextRMSNorm((128,), eps=1e-06)
|
| 510 |
(k_layernorm): Qwen4ExpTextRMSNorm((128,), eps=1e-06)
|
| 511 |
)
|
|
|
|
| 516 |
(act_fn): SiLUActivation()
|
| 517 |
)
|
| 518 |
(shared_expert): Qwen4ExpTextMLP(
|
| 519 |
+
(gate_proj): Linear(in_features=8, out_features=128, bias=False)
|
| 520 |
+
(up_proj): Linear(in_features=8, out_features=128, bias=False)
|
| 521 |
+
(down_proj): Linear(in_features=128, out_features=8, bias=False)
|
| 522 |
(act_fn): SiLUActivation()
|
| 523 |
)
|
| 524 |
+
(shared_expert_gate): Linear(in_features=8, out_features=1, bias=False)
|
| 525 |
)
|
| 526 |
(attn_hyper_connection): Qwen4ExpTextGatedResidual(
|
| 527 |
+
(hc_norm): Qwen4ExpTextRMSNorm((32,), eps=1e-06)
|
| 528 |
+
(input_mix_weight_down): Linear(in_features=32, out_features=4, bias=False)
|
| 529 |
+
(input_mix_weight_up): Linear(in_features=4, out_features=32, bias=False)
|
| 530 |
+
(block_inject_weight): Linear(in_features=32, out_features=4, bias=False)
|
| 531 |
)
|
| 532 |
(mlp_hyper_connection): Qwen4ExpTextGatedResidual(
|
| 533 |
+
(hc_norm): Qwen4ExpTextRMSNorm((32,), eps=1e-06)
|
| 534 |
+
(input_mix_weight_down): Linear(in_features=32, out_features=4, bias=False)
|
| 535 |
+
(input_mix_weight_up): Linear(in_features=4, out_features=32, bias=False)
|
| 536 |
+
(block_inject_weight): Linear(in_features=32, out_features=4, bias=False)
|
| 537 |
)
|
| 538 |
)
|
| 539 |
)
|
| 540 |
(hyper_connection_mixer): Qwen4ExpTextGatedResidual(
|
| 541 |
+
(hc_norm): Qwen4ExpTextRMSNorm((32,), eps=1e-06)
|
| 542 |
+
(input_mix_weight_down): Linear(in_features=32, out_features=4, bias=False)
|
| 543 |
+
(input_mix_weight_up): Linear(in_features=4, out_features=32, bias=False)
|
| 544 |
)
|
| 545 |
)
|
| 546 |
)
|
|
|
|
| 550 |
|
| 551 |
### Test environment:
|
| 552 |
|
| 553 |
+
- Pillow: 13.0.0
|
| 554 |
+
- flashinfer-python: 0.7.0.post1
|
| 555 |
+
- huggingface_hub: 2.3.0
|
|
|
|
|
|
|
|
|
|
| 556 |
- numpy: 2.3.5
|
| 557 |
- safetensors: 0.8.0
|
| 558 |
+
- tokenizers: 0.23.3
|
| 559 |
+
- torch: 2.13.0
|
| 560 |
- torchcodec: 0.17.0
|
| 561 |
- transformers: 5.19.0
|
| 562 |
+
- python (vLLM): 3.12.13
|
| 563 |
+
- CUDA (vLLM): 13.0
|
| 564 |
+
- torch (vLLM): 2.13.0+cu130
|
| 565 |
+
- transformers (vLLM): 5.19.0
|
| 566 |
+
- vllm: 0.32.0
|
| 567 |
+
- flashinfer-python (vLLM): 0.7.0.post1
|
| 568 |
|
| 569 |
### Change log:
|
| 570 |
|
| 571 |
- 2026-10-23: Initial version.
|
| 572 |
- 2026-10-23: Creation examples use only public dependencies; source assets are copied unchanged.
|
| 573 |
+
- 2026-10-24: Verified vLLM TP=4 with CUDA Graph, MTP, text, image, and video requests.
|
| 574 |
|
| 575 |
This repo is generated by GPT-6.1-Sol
|
config.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
| 17 |
"head_dim": 32,
|
| 18 |
"heads_per_ngram": 8,
|
| 19 |
"hidden_act": "silu",
|
| 20 |
-
"hidden_size":
|
| 21 |
"indexer_budget": 2048,
|
| 22 |
"indexer_compress_ratio": 4,
|
| 23 |
"indexer_head_dim": 128,
|
|
@@ -104,7 +104,7 @@
|
|
| 104 |
"model_type": "qwen4_exp",
|
| 105 |
"num_heads": 4,
|
| 106 |
"num_position_embeddings": 2304,
|
| 107 |
-
"out_hidden_size":
|
| 108 |
"patch_size": 16,
|
| 109 |
"spatial_merge_size": 2,
|
| 110 |
"temporal_patch_size": 2
|
|
|
|
| 17 |
"head_dim": 32,
|
| 18 |
"heads_per_ngram": 8,
|
| 19 |
"hidden_act": "silu",
|
| 20 |
+
"hidden_size": 8,
|
| 21 |
"indexer_budget": 2048,
|
| 22 |
"indexer_compress_ratio": 4,
|
| 23 |
"indexer_head_dim": 128,
|
|
|
|
| 104 |
"model_type": "qwen4_exp",
|
| 105 |
"num_heads": 4,
|
| 106 |
"num_position_embeddings": 2304,
|
| 107 |
+
"out_hidden_size": 8,
|
| 108 |
"patch_size": 16,
|
| 109 |
"spatial_merge_size": 2,
|
| 110 |
"temporal_patch_size": 2
|
model.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0fd07e2bb01c975f7059d68ccac1654338bae0324df77ad1c9d322a222b3d600
|
| 3 |
+
size 10886632
|