Instructions to use amd/Qwen3.8-27B-Quark-AWQ-MXFP4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use amd/Qwen3.8-27B-Quark-AWQ-MXFP4 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="amd/Qwen3.8-27B-Quark-AWQ-MXFP4") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("amd/Qwen3.8-27B-Quark-AWQ-MXFP4") model = AutoModelForMultimodalLM.from_pretrained("amd/Qwen3.8-27B-Quark-AWQ-MXFP4", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use amd/Qwen3.8-27B-Quark-AWQ-MXFP4 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "amd/Qwen3.8-27B-Quark-AWQ-MXFP4" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "amd/Qwen3.8-27B-Quark-AWQ-MXFP4", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/amd/Qwen3.8-27B-Quark-AWQ-MXFP4
- SGLang
How to use amd/Qwen3.8-27B-Quark-AWQ-MXFP4 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "amd/Qwen3.8-27B-Quark-AWQ-MXFP4" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "amd/Qwen3.8-27B-Quark-AWQ-MXFP4", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "amd/Qwen3.8-27B-Quark-AWQ-MXFP4" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "amd/Qwen3.8-27B-Quark-AWQ-MXFP4", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use amd/Qwen3.8-27B-Quark-AWQ-MXFP4 with Docker Model Runner:
docker model run hf.co/amd/Qwen3.8-27B-Quark-AWQ-MXFP4
Qwen3.8-27B-Quark-AWQ-MXFP4
Qwen/Qwen3.8-27B quantized to MXFP4 weights + MXFP4 activations with AMD Quark, using the AWQ (Activation-aware Weight Quantization) algorithm.
- Weights: MXFP4 (OCP microscaling FP4, group size 32, E8M0 shared scale)
- Activations: MXFP4, dynamic (per-block, computed at runtime)
- Algorithm: AWQ
- Calibration: 128 samples, seq_len 512,
pilevaldataset (Quark default) - Base model: Qwen/Qwen3.8-27B (bf16)
- Vision tower: left unquantized (bf16) — only the language-model decoder (
model.language_model.layers) is quantized;model.visual.*is excluded
Benchmark results
| Benchmark | Setting | This model (AWQ) | BF16 base | Recovery % |
|---|---|---|---|---|
| GSM8K, 5-shot (flexible-extract / strict-match) | Thinking: temperature=1.0, top_p=0.95, top_k=20, min_p=0.0, presence_penalty=0.0, repetition_penalty=1.0, max_gen_toks=3072 | 94.996% / 95.30% | 93.33% / 93.33% | 101.8% |
| GSM8K, 5-shot (flexible-extract / strict-match) | Non-thinking: temperature=0.7, top_p=0.80, top_k=20, min_p=0.0, presence_penalty=1.5, repetition_penalty=1.0, max_gen_toks=1024 | 89.92% / 89.76% | 90.67% / 89.76% | 99.2% |
Recovery % is computed on the flexible-extract metric (this model / bf16 base).
Eval commands
Thinking mode:
lm-eval run --model local-completions \
--model_args model=awq,base_url=http://localhost:8002/v1/completions,tokenizer=amd/Qwen3.8-27B-Quark-AWQ-MXFP4,num_concurrent=16,max_retries=5,timeout=900,tokenized_requests=False,max_length=16384 \
--gen_kwargs max_gen_toks=3072 temperature=1.0 top_p=0.95 top_k=20 min_p=0.0 presence_penalty=0.0 repetition_penalty=1.0 do_sample=True \
--tasks gsm8k \
--output_path ./results/awq_gsm8k \
--log_samples
Non-thinking mode: the raw-completions endpoint used above doesn't support passing enable_thinking=False through a chat template, so non-thinking mode is approximated with a custom task that pre-closes an empty <think></think> block in the prompt:
gsm8k_nothink.yaml:
tag:
- math_word_problems
task: gsm8k_nothink
dataset_path: openai/gsm8k
dataset_name: main
output_type: generate_until
training_split: train
fewshot_split: train
test_split: test
doc_to_text: "Question: {{question}}\nAnswer:<think>\n\n</think>\n\n"
doc_to_target: "{{answer}}"
metric_list:
- metric: exact_match
aggregation: mean
higher_is_better: true
ignore_case: true
ignore_punctuation: false
regexes_to_ignore:
- ","
- "\\$"
- "(?s).*#### "
- "\\.$"
generation_kwargs:
until:
- "Question:"
- "</s>"
- "<|im_end|>"
do_sample: false
temperature: 0.0
repeats: 1
num_fewshot: 5
filter_list:
- name: "strict-match"
filter:
- function: "regex"
regex_pattern: "#### (\\-?[0-9\\.\\,]+)"
- function: "take_first"
- name: "flexible-extract"
filter:
- function: "regex"
group_select: -1
regex_pattern: "(-?[$0-9.,]{2,})|(-?[0-9]+)"
- function: "take_first"
metadata:
version: 3.0
lm-eval run --model local-completions \
--model_args model=awq,base_url=http://localhost:8002/v1/completions,tokenizer=amd/Qwen3.8-27B-Quark-AWQ-MXFP4,num_concurrent=16,max_retries=5,timeout=900,tokenized_requests=False,max_length=16384 \
--include_path ./custom_tasks \
--gen_kwargs max_gen_toks=1024 temperature=0.7 top_p=0.80 top_k=20 min_p=0.0 presence_penalty=1.5 repetition_penalty=1.0 do_sample=True \
--tasks gsm8k_nothink \
--output_path ./results/awq_gsm8k_nothink \
--log_samples
Quantization command
HIP_VISIBLE_DEVICES=<gpu> python3 quantize_quark.py \
--model_dir Qwen/Qwen3.8-27B \
--output_dir ./Qwen3.8-27B-w_mxfp4_a_mxfp4-awq \
--quant_scheme mxfp4 \
--num_calib_data 128 \
--seq_len 512 \
--quant_algo awq \
--model_export hf_format \
--data_type auto \
--device cuda \
--trust_remote_code
Serving
vllm serve amd/Qwen3.8-27B-Quark-AWQ-MXFP4 \
--served-model-name awq \
--trust-remote-code \
--tensor-parallel-size 1 \
--max-model-len 16384
License
Modifications Copyright(c) 2026 Advanced Micro Devices, Inc. All rights reserved.
- Downloads last month
- 2,881