Views
No views yet
vllm serve RedHatAI/Qwen3-Next-80B-A3B-Instruct-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-Instruct-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-Instruct"
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-Instruct-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-Instruct-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-Instruct-FP8-block" \
--dataset "humaneval" \
--backend vllm \
--tp 2 \
--greedy
evalplus.evaluate --model "RedHatAI/Qwen3-Next-80B-A3B-Instruct-FP8-block" \
--dataset "mbpp" \
--backend vllm \
--tp 2 \
--greedy
| Category | Metric | Qwen/Qwen3-Next-80B-A3B-Instruct | RedHatAI/Qwen3-Next-80B-A3B-Instruct-FP8-block | Recovery (%) |
|---|---|---|---|---|
| OpenLLM V1 | ARC-Challenge (Acc-Norm, 25-shot) | 75.85 | 76.02 | 100.22 |
| GSM8K (Strict-Match, 5-shot) | 31.01 | 31.99 | 103.18 | |
| HellaSwag (Acc-Norm, 10-shot) | 83.25 | 83.21 | 99.95 | |
| MMLU (Acc, 5-shot) | 85.56 | 85.55 | 99.98 | |
| TruthfulQA (MC2, 0-shot) | 60.70 | 60.79 | 100.15 | |
| Winogrande (Acc, 5-shot) | 78.30 | 78.93 | 100.81 | |
| Average Score | 69.11 | 69.42 | 100.44 | |
| OpenLLM V2 | IFEval (Inst Level Strict Acc, 0-shot) | 90.41 | 90.53 | 100.13 |
| BBH (Acc-Norm, 3-shot) | 67.78 | 67.77 | 99.97 | |
| Math-Hard (Exact-Match, 4-shot) | 56.04 | 57.02 | 101.75 | |
| GPQA (Acc-Norm, 0-shot) | 28.61 | 29.61 | 103.52 | |
| MUSR (Acc-Norm, 0-shot) | 39.68 | 40.21 | 101.33 | |
| MMLU-Pro (Acc, 5-shot) | 59.73 | 59.67 | 99.90 | |
| Average Score | 57.04 | 57.47 | 100.75 |