Views
No views yet
1vllm serve RedHatAI/Qwen3.5-9B-quantized.w4a16 \
2 --reasoning-parser qwen3 \
3 --max-model-len 2621441vllm serve RedHatAI/Qwen3.5-9B-quantized.w4a16 \
2 --reasoning-parser qwen3 \
3 --max-model-len 262144 \
4 --language-model-only1from openai import OpenAI
2
3openai_api_key = "EMPTY"
4openai_api_base = "http://localhost:8000/v1"
5
6client = OpenAI(
7 api_key=openai_api_key,
8 base_url=openai_api_base,
9)
10
11model = "RedHatAI/Qwen3.5-9B-quantized.w4a16"
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)1from compressed_tensors.utils import save_mtp_tensors_to_checkpoint
2from datasets import load_dataset
3from llmcompressor import oneshot
4from llmcompressor.modifiers.quantization import GPTQModifier
5from transformers import AutoProcessor, AutoTokenizer, Qwen3_5ForConditionalGeneration
6
7MODEL_ID = "Qwen/Qwen3.5-9B"
8NUM_CALIBRATION_SAMPLES = 1024
9MAX_SEQUENCE_LENGTH = 8192
10
11IGNORE_LAYERS = [
12 "re:.*lm_head",
13 "re:.*embed_tokens$",
14 "re:.*visual.*",
15 "re:.*model.visual.*",
16 "re:.*linear_attn.*",
17]
18
19model = Qwen3_5ForConditionalGeneration.from_pretrained(MODEL_ID, dtype="auto")
20tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
21processor = AutoProcessor.from_pretrained(MODEL_ID)
22
23ds = load_dataset("garage-bAInd/Open-Platypus", split=f"train[:{NUM_CALIBRATION_SAMPLES}]")
24ds = ds.shuffle(seed=42)
25
26def preprocess(ex):
27 text = ex["instruction"]
28 if ex.get("input"):
29 text += "\n" + ex["input"]
30 return {"text": text}
31
32def tokenize(sample):
33 return tokenizer(
34 sample["text"],
35 padding=False,
36 max_length=MAX_SEQUENCE_LENGTH,
37 truncation=True,
38 add_special_tokens=False,
39 )
40
41ds = ds.map(preprocess).map(tokenize, remove_columns=ds.column_names)
42
43recipe = GPTQModifier(
44 targets="Linear",
45 scheme="W4A16",
46 sequential_targets=["Qwen3_5DecoderLayer"],
47 ignore=IGNORE_LAYERS,
48 dampening_frac=0.05,
49)
50
51oneshot(
52 model=model,
53 dataset=ds,
54 recipe=recipe,
55 max_seq_length=MAX_SEQUENCE_LENGTH,
56 num_calibration_samples=NUM_CALIBRATION_SAMPLES,
57)
58
59model.save_pretrained("Qwen3.5-9B-quantized.w4a16", save_compressed=True)
60processor.save_pretrained("Qwen3.5-9B-quantized.w4a16")
61save_mtp_tensors_to_checkpoint(source_model=MODEL_ID, dest_dir="Qwen3.5-9B-quantized.w4a16")llm-compressor==0.10.1.dev44+g437f8afecompressed-tensors==0.14.1a20260325transformers==5.3.0vllm==0.18.1lm-eval — neuralmagic/lm-evaluation-harness@741f1d8 (branch: mmlu-pro-chat-variant)lighteval — neuralmagic/lighteval@6f0f351 (branch: eldar-fix-litellm)| Category | Benchmark | Qwen/Qwen3.5-9B | RedHatAI/Qwen3.5-9B-quantized.w4a16 | Recovery |
|---|---|---|---|---|
| Instruction Following | GSM8k-Platinum (0-shot) | 94.4% | 94.6% | 100.1% |
| MMLU-Pro (0-shot) | 82.4% | 81.7% | 99.1% | |
| IFEval — prompt strict (0-shot) | 89.5% | 87.7% | 97.9% | |
| IFEval — instruction strict (0-shot) | 92.5% | 91.3% | 98.7% | |
| Reasoning | Math 500 (0-shot) | 85.2% | 83.8% | 98.4% |
| AIME 2025 (0-shot) | 85.4% | 68.8% | 80.5% | |
| GPQA Diamond (0-shot) | 82.2% | 77.9% | 94.9% |
--language-model-only for all evaluations.1lm_eval --model local-chat-completions \
2 --tasks gsm8k_platinum_cot_llama \
3 --model_args "model=inference-optimization/Qwen3.5-9B-quantized.w4a16,max_length=96000,base_url=http://0.0.0.0:8000/v1/chat/completions,num_concurrent=100,max_retries=3,tokenized_requests=False,tokenizer_backend=None,timeout=3600" \
4 --num_fewshot 0 \
5 --apply_chat_template \
6 --output_path results_gsm8k_platinum.json \
7 --seed <SEED> \
8 --gen_kwargs "do_sample=True,temperature=1.0,top_p=0.95,top_k=20,min_p=0.0,presence_penalty=1.5,repetition_penalty=1.0,max_gen_toks=65536,seed=<SEED>"1lm_eval --model local-chat-completions \
2 --tasks mmlu_pro_chat \
3 --model_args "model=inference-optimization/Qwen3.5-9B-quantized.w4a16,max_length=96000,base_url=http://0.0.0.0:8000/v1/chat/completions,num_concurrent=100,max_retries=3,tokenized_requests=False,tokenizer_backend=None,timeout=3600" \
4 --num_fewshot 0 \
5 --apply_chat_template \
6 --output_path results_mmlu_pro.json \
7 --seed <SEED> \
8 --gen_kwargs "do_sample=True,temperature=1.0,top_p=0.95,top_k=20,min_p=0.0,presence_penalty=1.5,repetition_penalty=1.0,max_gen_toks=65536,seed=<SEED>"1lm_eval --model local-chat-completions \
2 --tasks ifeval \
3 --model_args "model=RedHatAI/Qwen3.5-9B-quantized.w4a16,max_length=96000,base_url=http://0.0.0.0:8000/v1/chat/completions,num_concurrent=100,max_retries=3,tokenized_requests=False,tokenizer_backend=None,timeout=3600" \
4 --num_fewshot 0 \
5 --apply_chat_template \
6 --output_path results_ifeval.json \
7 --seed <SEED> \
8 --gen_kwargs "do_sample=True,temperature=1.0,top_p=0.95,top_k=20,min_p=0.0,presence_penalty=1.5,repetition_penalty=1.0,max_gen_toks=65536,seed=<SEED>"1lighteval endpoint litellm \
2 "model_name=hosted_vllm/RedHatAI/Qwen3.5-9B-quantized.w4a16,provider=hosted_vllm,base_url=http://0.0.0.0:8000/v1,timeout=3600,concurrent_requests=100,generation_parameters={temperature:1.0,max_new_tokens:65536,top_p:0.95,top_k:20,min_p:0.0,presence_penalty:1.5,repetition_penalty:1.0,seed:<SEED>}" \
3 "math_500@k=1@n=1|0" \
4 --output-dir results_math500 \
5 --save-details1lighteval endpoint litellm \
2 "model_name=hosted_vllm/RedHatAI/Qwen3.5-9B-quantized.w4a16,provider=hosted_vllm,base_url=http://0.0.0.0:8000/v1,timeout=3600,concurrent_requests=100,generation_parameters={temperature:1.0,max_new_tokens:65536,top_p:0.95,top_k:20,min_p:0.0,presence_penalty:1.5,repetition_penalty:1.0,seed:<SEED>}" \
3 "aime25@k=1@n=1|0" \
4 --output-dir results_aime25 \
5 --save-details1lighteval endpoint litellm \
2 "model_name=hosted_vllm/RedHatAI/Qwen3.5-9B-quantized.w4a16,provider=hosted_vllm,base_url=http://0.0.0.0:8000/v1,timeout=3600,concurrent_requests=100,generation_parameters={temperature:1.0,max_new_tokens:65536,top_p:0.95,top_k:20,min_p:0.0,presence_penalty:1.5,repetition_penalty:1.0,seed:<SEED>}" \
3 "gpqa:diamond@k=1@n=1|0" \
4 --output-dir results_gpqa_diamond \
5 --save-details