Views
No views yet
vllm serve RedHatAI/Qwen3-VL-32B-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-VL-32B-Instruct-FP8-block"
13
14messages = [
15 {
16 "role": "user",
17 "content": [
18 {
19 "type": "image_url",
20 "image_url": {"url": "https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-VL/assets/demo.jpeg"},
21 },
22 {"type": "text", "text": "Describe this image."},
23 ],
24 }
25]
26
27outputs = client.chat.completions.create(
28 model=model,
29 messages=messages,
30)
31
32generated_text = outputs.choices[0].message.content
33print(generated_text)1from transformers import AutoProcessor, Qwen3VLForConditionalGeneration
2
3from llmcompressor import oneshot
4from llmcompressor.modifiers.quantization import QuantizationModifier
5
6# NOTE: Requires a minimum of transformers 4.57.0
7
8MODEL_ID = "Qwen/Qwen3-VL-32B-Instruct"
9
10# Load model.
11model = Qwen3VLForConditionalGeneration.from_pretrained(MODEL_ID, torch_dtype="auto")
12processor = AutoProcessor.from_pretrained(MODEL_ID)
13
14# Configure the quantization algorithm and scheme.
15# In this case, we:
16# * quantize the weights to fp8 with channel-wise quantization
17# * quantize the activations to fp8 with dynamic token activations
18# NOTE: only datafree quantization is supported for Qwen3-VL-MoE currently
19recipe = QuantizationModifier(
20 targets="Linear",
21 scheme="FP8_BLOCK",
22 ignore=[
23 "re:.*lm_head",
24 "re:visual.*",
25 "re:model.visual.*",
26 "re:.*mlp.gate$",
27 ],
28)
29
30# Apply quantization.
31oneshot(model=model, recipe=recipe)
32
33# Save to disk in compressed-tensors format.
34SAVE_DIR = MODEL_ID.rstrip("/").split("/")[-1] + "-FP8-BLOCK"
35model.save_pretrained(SAVE_DIR)
36processor.save_pretrained(SAVE_DIR)lm_eval \
--model vllm-vlm \
--model_args pretrained="RedHatAI/Qwen3-VL-32B-Instruct-FP8-block",dtype=auto,add_bos_token=False,max_model_len=262144,tensor_parallel_size=2,gpu_memory_utilization=0.9,enable_chunked_prefill=True,trust_remote_code=True,max_images=10 \
--tasks chartqa \
--apply_chat_template \
--batch_size autolm_eval \
--model vllm-vlm \
--model_args pretrained="RedHatAI/Qwen3-VL-32B-Instruct-FP8-block",dtype=auto,add_bos_token=False,max_model_len=262144,tensor_parallel_size=2,gpu_memory_utilization=0.9,enable_chunked_prefill=True,trust_remote_code=True,max_images=10 \
--tasks mmlu \
--apply_chat_template \
--batch_size auto| Model | Accuracy | Recovery (%) |
|---|---|---|
| Qwen/Qwen3-VL-32B-Instruct | 61.52 | 100.00 |
| Qwen/Qwen3-VL-32B-Instruct-FP8 | 86.92 | 141.32 |
| RedHatAI/Qwen3-VL-32B-Instruct-FP8-block | 86.60 | 140.82 |
| RedHatAI/Qwen3-VL-32B-Instruct-FP8-dynamic | 86.68 | 140.95 |
| Model | Accuracy | Recovery (%) |
|---|---|---|
| Qwen/Qwen3-VL-32B-Instruct | 78.03 | 100.00 |
| Qwen/Qwen3-VL-32B-Instruct-FP8 | 77.80 | 99.71 |
| RedHatAI/Qwen3-VL-32B-Instruct-FP8-block | 77.72 | 99.60 |
| RedHatAI/Qwen3-VL-32B-Instruct-FP8-dynamic | 77.89 | 99.82 |