Views
No views yet
1vllm serve RedHatAI/Qwen3.5-4B-quantized.w8a8 \
2 --reasoning-parser qwen3 \
3 --max-model-len 2621441vllm serve RedHatAI/Qwen3.5-4B-quantized.w8a8 \
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-4B-quantized.w8a8"
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-4B"
8NUM_CALIBRATION_SAMPLES = 512
9MAX_SEQUENCE_LENGTH = 2048
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="W8A8",
46 sequential_targets=["Qwen3_5DecoderLayer"],
47 ignore=IGNORE_LAYERS,
48 dampening_frac=0.01,
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-4B-quantized.w8a8", save_compressed=True)
60processor.save_pretrained("Qwen3.5-4B-quantized.w8a8")
61save_mtp_tensors_to_checkpoint(source_model=MODEL_ID, dest_dir="Qwen3.5-4B-quantized.w8a8")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-4B | RedHatAI/Qwen3.5-4B-quantized.w8a8 | Recovery |
|---|---|---|---|---|
| Instruction Following | GSM8k-Platinum (0-shot) | 94.5% | 94.2% | 99.7% |
| MMLU-Pro (0-shot) | 79.3% | 79.0% | 99.6% | |
| IFEval — prompt strict (0-shot) | 88.3% | 87.7% | 99.3% | |
| IFEval — instruction strict (0-shot) | 91.5% | 91.2% | 99.7% | |
| Reasoning | Math 500 (0-shot) | 84.5% | 83.9% | 99.3% |
| AIME 2025 (0-shot) | 82.2% | 81.2% | 98.8% | |
| GPQA Diamond (0-shot) | 79.6% | 78.5% | 98.5% |
--language-model-only for all evaluations.1lm_eval --model local-chat-completions \
2 --tasks gsm8k_platinum_cot_llama \
3 --model_args "model=RedHatAI/Qwen3.5-4B-quantized.w8a8,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=RedHatAI/Qwen3.5-4B-quantized.w8a8,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-4B-quantized.w8a8,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-4B-quantized.w8a8,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-4B-quantized.w8a8,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-4B-quantized.w8a8,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