Views
No views yet
vllm serve RedHatAI/Qwen3-Next-80B-A3B-Thinking-FP8-block --tensor_parallel_size 21from openai import OpenAI
2
3# Modify OpenAI's API key and API base to use vLLM's API server.
4openai_api_key = "EMPTY"
5openai_api_base = "http://<your-server-host>:8000/v1"
6
7client = OpenAI(
8 api_key=openai_api_key,
9 base_url=openai_api_base,
10)
11
12model = "RedHatAI/Qwen3-Next-80B-A3B-Thinking-FP8-block"
13
14messages = [
15 {"role": "user", "content": "Explain quantum mechanics clearly and concisely."},
16]
17
18
19outputs = client.chat.completions.create(
20 model=model,
21 messages=messages,
22)
23
24generated_text = outputs.choices[0].message.content
25print(generated_text)1from datasets import load_dataset
2from transformers import AutoModelForCausalLM, AutoTokenizer
3
4from llmcompressor import oneshot
5from llmcompressor.modifiers.quantization import QuantizationModifier
6from llmcompressor.utils import dispatch_for_generation
7
8# NOTE: Requires a minimum of transformers 4.57.0
9
10MODEL_ID = "Qwen/Qwen3-Next-80B-A3B-Thinking"
11
12# Load model.
13model = AutoModelForCausalLM.from_pretrained(MODEL_ID, torch_dtype="auto")
14tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
15
16
17# Configure the quantization algorithm and scheme.
18# In this case, we:
19# * quantize the weights to fp8 with per channel via ptq
20# * quantize the activations to fp8 with dynamic per token
21recipe = QuantizationModifier(
22 targets="Linear", scheme="FP8_BLOCK", ignore=[
23 "lm_head",
24 "re:.*mlp.gate$",
25 "re:.*mlp.shared_expert_gate$",
26 "re:.*linear_attn.*",
27 ],
28)
29
30# Apply quantization.
31oneshot(model=model, recipe=recipe)
32
33# Confirm generations of the quantized model look sane.
34print("========== SAMPLE GENERATION ==============")
35dispatch_for_generation(model)
36input_ids = tokenizer("Hello my name is", return_tensors="pt").input_ids.to(
37 model.device
38)
39output = model.generate(input_ids, max_new_tokens=20)
40print(tokenizer.decode(output[0]))
41print("==========================================")
42
43# Save to disk in compressed-tensors format.
44SAVE_DIR = MODEL_ID.rstrip("/").split("/")[-1] + "-FP8-block"
45model.save_pretrained(SAVE_DIR)
46tokenizer.save_pretrained(SAVE_DIR)lm_eval \
--model vllm \
--model_args pretrained="RedHatAI/Qwen3-Next-80B-A3B-Thinking-FP8-block",dtype=auto,add_bos_token=True,max_model_len=16384,tensor_parallel_size=2,gpu_memory_utilization=0.9,enable_chunked_prefill=True,trust_remote_code=True \
--tasks openllm \
--write_out \
--batch_size auto \
--show_configlm_eval \
--model vllm \
--model_args pretrained="RedHatAI/Qwen3-Next-80B-A3B-Thinking-FP8-block",dtype=auto,add_bos_token=False,max_model_len=16384,tensor_parallel_size=2,gpu_memory_utilization=0.7,disable_log_stats=True,enable_chunked_prefill=True,trust_remote_code=True \
--tasks leaderboard \
--apply_chat_template \
--fewshot_as_multiturn \
--write_out \
--batch_size auto \
--show_configevalplus.evaluate --model "RedHatAI/Qwen3-Next-80B-A3B-Thinking-FP8-block" \
--dataset "humaneval" \
--backend vllm \
--tp 2 \
--greedy
evalplus.evaluate --model "RedHatAI/Qwen3-Next-80B-A3B-Thinking-FP8-block" \
--dataset "mbpp" \
--backend vllm \
--tp 2 \
--greedy
| Benchmark | Qwen/Qwen3-Next-80B-A3B-Thinking | Qwen/Qwen3-Next-80B-A3B-Thinking-FP8 | Recovery (%) | RedHatAI/Qwen3-Next-80B-A3B-Thinking-FP8-block | Recovery (%) | RedHatAI/Qwen3-Next-80B-A3B-Thinking-FP8-dynamic | Recovery (%) | RedHatAI/Qwen3-Next-80B-A3B-Thinking-quantized.w4a16 | Recovery (%) |
|---|---|---|---|---|---|---|---|---|---|
| AIME 2025 | 60.00 | 50.00 | 83.33 | 50.00 | 83.33 | 50.00 | 83.33 | 50.00 | 83.33 |
| MATH-500 | 94.00 | 87.60 | 93.19 | 94.40 | 100.43 | 86.80 | 92.34 | 87.20 | 92.77 |
| GPQA Diamond | 73.74 | 76.77 | 104.11 | 76.77 | 104.11 | 74.75 | 101.37 | 73.74 | 100.00 |