Views
No views yet


vllm serve RedHatAI/Qwen3.5-122B-A10B-NVFP4 --reasoning-parser qwen3 --language-model-only --moe_backend flashinfer_cutlassvllm serve RedHatAI/Qwen3.5-122B-A10B-NVFP4 --reasoning-parser qwen3 --moe_backend flashinfer_cutlassvllm serve RedHatAI/Qwen3.5-122B-A10B-NVFP4 --reasoning-parser qwen3 --enable-auto-tool-choice --tool-call-parser qwen3_coder --moe_backend flashinfer_cutlassvllm serve RedHatAI/Qwen3.5-122B-A10B-NVFP4 --reasoning-parser qwen3 --speculative-config '{"method":"qwen3_next_mtp","num_speculative_tokens":2}' --moe_backend flashinfer_cutlass1from openai import OpenAI
2
3openai_api_key = "EMPTY"
4openai_api_base = "http://<your-server-host>:8000/v1"
5
6client = OpenAI(
7 api_key=openai_api_key,
8 base_url=openai_api_base,
9)
10
11model = "RedHatAI/Qwen3.5-122B-A10B-NVFP4"
12
13messages = [
14 {"role": "user", "content": "Explain quantum mechanics clearly and concisely."},
15]
16
17outputs = client.chat.completions.create(
18 model=model,
19 messages=messages,
20)
21
22generated_text = outputs.choices[0].message.content
23print(generated_text)1import torch
2from compressed_tensors.utils import save_mtp_tensors_to_checkpoint
3from datasets import load_dataset
4from transformers import AutoProcessor, Qwen3_5MoeForConditionalGeneration
5
6from llmcompressor import oneshot
7from llmcompressor.modifiers.quantization import QuantizationModifier
8
9# NOTE: This example requires transformers >= v5
10
11MODEL_ID = "Qwen/Qwen3.5-122B-A10B"
12
13# Load model.
14model = Qwen3_5MoeForConditionalGeneration.from_pretrained(MODEL_ID, dtype="auto")
15processor = AutoProcessor.from_pretrained(MODEL_ID)
16
17# No need to include mtp layers as they are not loaded
18# through Qwen3_5MoeForConditionalGeneration
19recipe = QuantizationModifier(
20 targets="Linear",
21 scheme="NVFP4",
22 ignore=[
23 "re:.*lm_head",
24 "re:visual.*",
25 "re:model.visual.*",
26 "re:.*mlp.gate$",
27 "re:.*embed_tokens$",
28 "re:.*shared_expert_gate$",
29 "re:.*linear_attn.*",
30 ],
31)
32
33NUM_CALIBRATION_SAMPLES = 256
34MAX_SEQUENCE_LENGTH = 4096
35
36ds = load_dataset(
37 "HuggingFaceH4/ultrachat_200k",
38 split=f"train_sft[:{NUM_CALIBRATION_SAMPLES}]",
39)
40ds = ds.select_columns(["messages"])
41ds = ds.shuffle(seed=42)
42
43
44def preprocess_function(example):
45 messages = [
46 {"role": m["role"], "content": [{"type": "text", "text": m["content"]}]}
47 for m in example["messages"]
48 ]
49 return processor.apply_chat_template(
50 messages,
51 return_tensors="pt",
52 padding=False,
53 truncation=True,
54 max_length=MAX_SEQUENCE_LENGTH,
55 tokenize=True,
56 add_special_tokens=False,
57 return_dict=True,
58 add_generation_prompt=False,
59 )
60
61
62ds = ds.map(preprocess_function, batched=False, remove_columns=ds.column_names)
63
64
65def data_collator(batch):
66 assert len(batch) == 1
67 return {key: torch.tensor(value) for key, value in batch[0].items()}
68
69
70# Apply quantization.
71oneshot(
72 model=model,
73 recipe=recipe,
74 dataset=ds,
75 max_seq_length=MAX_SEQUENCE_LENGTH,
76 num_calibration_samples=NUM_CALIBRATION_SAMPLES,
77 moe_calibrate_all_experts=True,
78 data_collator=data_collator,
79)
80
81# Save to disk in compressed-tensors format.
82SAVE_DIR = MODEL_ID.rstrip("/").split("/")[-1] + "-NVFP4"
83model.save_pretrained(SAVE_DIR)
84processor.save_pretrained(SAVE_DIR)
85
86# MTP layers are excluded from the model through Qwen3_5MoeForConditionalGeneration
87# Save them as-is from the original checkpoint into the quantized output.
88save_mtp_tensors_to_checkpoint(source_model=MODEL_ID, dest_dir=SAVE_DIR)lm_eval --model local-chat-completions \
--tasks mmlu_pro_chat \
--model_args "model=RedHatAI/Qwen3.5-122B-A10B-NVFP4,max_length=262144,base_url=http://0.0.0.0:8000/v1/chat/completions,num_concurrent=128,max_retries=3,tokenized_requests=False,tokenizer_backend=None,timeout=1200" \
--num_fewshot 0 \
--apply_chat_template \
--gen_kwargs "do_sample=True,temperature=1.0,top_p=0.95,top_k=20,min_p=0.0,max_gen_toks=64000,presence_penalty=1.5,repetition_penalty=1.0,seed=5678"lm_eval --model local-chat-completions \
--tasks ifeval \
--model_args "model=RedHatAI/Qwen3.5-122B-A10B-NVFP4,max_length=262144,base_url=http://0.0.0.0:8000/v1/chat/completions,num_concurrent=128,max_retries=3,tokenized_requests=False,tokenizer_backend=None,timeout=1200" \
--num_fewshot 0 \
--apply_chat_template \
--gen_kwargs "do_sample=True,temperature=1.0,top_p=0.95,top_k=20,min_p=0.0,max_gen_toks=64000,presence_penalty=1.5,repetition_penalty=1.0,seed=5678"lm_eval --model local-chat-completions \
--tasks gsm8k_platinum_cot_llama \
--model_args "model=RedHatAI/Qwen3.5-122B-A10B-NVFP4,max_length=262144,base_url=http://0.0.0.0:8000/v1/chat/completions,num_concurrent=128,max_retries=3,tokenized_requests=False,tokenizer_backend=None,timeout=1200" \
--num_fewshot 0 \
--apply_chat_template \
--gen_kwargs "do_sample=True,temperature=1.0,top_p=0.95,top_k=20,min_p=0.0,max_gen_toks=64000,presence_penalty=1.5,repetition_penalty=1.0,seed=5678"1model_parameters:
2 provider: "hosted_vllm"
3 model_name: "hosted_vllm/RedHatAI/Qwen3.5-122B-A10B-NVFP4"
4 base_url: "http://0.0.0.0:8000/v1"
5 api_key: ""
6 timeout: 2400
7 concurrent_requests: 128
8 generation_parameters:
9 temperature: 1.0
10 max_new_tokens: 64000
11 top_p: 0.95
12 top_k: 20
13 min_p: 0.0
14 presence_penalty: 1.5
15 repetition_penalty: 1.0
16 seed: 5678lighteval endpoint litellm lighteval_model_arguments.yaml \
"aime25|0,math_500|0,gpqa:diamond|0"| Benchmark | Qwen3.5-122B-A10B | Qwen3.5-122B-A10B-NVFP4 (this model) | Recovery (%) |
|---|---|---|---|
| GSM8k Platinum (0-shot) | 95.59 | 95.37 | 99.77 |
| MMLU-Pro (0-shot) | 86.96 | 86.62 | 99.61 |
| IfEval (0-shot) | 93.80 | 93.32 | 99.49 |
| AIME 2025 | 92.92 | 91.66 | 98.65 |
| GPQA diamond | 87.54 | 86.70 | 99.04 |
| Math 500 | 84.73 | 84.80 | 100.08 |