Instructions to use amd/Qwen3.8-2.4T-A95B-Quark-MXFP4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use amd/Qwen3.8-2.4T-A95B-Quark-MXFP4 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="amd/Qwen3.8-2.4T-A95B-Quark-MXFP4") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("amd/Qwen3.8-2.4T-A95B-Quark-MXFP4") model = AutoModelForCausalLM.from_pretrained("amd/Qwen3.8-2.4T-A95B-Quark-MXFP4", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.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(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use amd/Qwen3.8-2.4T-A95B-Quark-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-2.4T-A95B-Quark-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-2.4T-A95B-Quark-MXFP4", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/amd/Qwen3.8-2.4T-A95B-Quark-MXFP4
- SGLang
How to use amd/Qwen3.8-2.4T-A95B-Quark-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-2.4T-A95B-Quark-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-2.4T-A95B-Quark-MXFP4", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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-2.4T-A95B-Quark-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-2.4T-A95B-Quark-MXFP4", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use amd/Qwen3.8-2.4T-A95B-Quark-MXFP4 with Docker Model Runner:
docker model run hf.co/amd/Qwen3.8-2.4T-A95B-Quark-MXFP4
Model Overview
- Model Architecture: Qwen3_5MoeForCausalLM
- Input: Text
- Output: Text
- Supported Hardware Microarchitecture: AMD MI350 / MI355
- ROCm: 7.2.0
- PyTorch: 2.12.0
- Transformers: 5.14.1
- Operating System(s): Linux
- Inference Engine: SGLang/vLLM
- Model Optimizer: AMD-Quark (v0.12)
- Quantized layers: router experts
- Weight quantization: OCP MXFP4, Static
- Activation quantization: OCP MXFP4, Dynamic
Model Quantization
The model was quantized from Qwen/Qwen3.8-2.4T-A95B-FP8 using AMD-Quark. The weights and activations of the routed experts are quantized to MXFP4.
Quantization scripts:
from quark.torch import LLMTemplate, ModelQuantizer
qwen3_5_moe_text_template = LLMTemplate(
model_type="qwen3_5_moe_text",
kv_layers_name=["*k_proj", "*v_proj"],
q_layer_name="*q_proj"
)
LLMTemplate.register_template(qwen3_5_moe_text_template)
# === NOTE: Change the following source and output dir as needed ===
src_ckpt_path = "Qwen/Qwen3.8-2.4T-A95B-FP8"
output_dir = "amd/Qwen3.8-2.4T-A95B-Quark-MXFP4"
quant_scheme = "mxfp4"
exclude_layers = [
"lm_head",
"*self_attn*",
"*linear_attn*",
"*mlp.gate",
"*shared_expert*",
"mtp.fc",
]
template = LLMTemplate.get("qwen3_5_moe_text")
quant_config = template.get_config(scheme=quant_scheme, exclude_layers=exclude_layers)
# Quantize with File2File mode to avoid loading full model
quantizer = ModelQuantizer(quant_config)
quantizer.direct_quantize_checkpoint(
pretrained_model_path=src_ckpt_path,
save_path=output_dir,
)
For further details or issues, please refer to the AMD-Quark documentation or contact the respective developers.
Evaluation
The model was evaluated on the GSM8K benchmark using the SGLang framework. The baseline is the original Qwen/Qwen3.8-2.4T-A95B-FP8 checkpoint.
Accuracy
| Benchmark | Qwen/Qwen3.8-2.4T-A95B-FP8 | amd/Qwen3.8-2.4T-A95B-Quark-MXFP4 (this model) | Recovery |
|---|---|---|---|
| gsm8k | 97.49 | 97.49 | 100.00% |
Reproduction
The GSM8K results were obtained on SGLang based on the docker image rocm/sgl-dev:v0.5.8.post1-rocm720-mi35x-20260222 using the following recipe.
- Serve the model with SGLang:
python3 -m sglang.launch_server \
--model-path amd/Qwen3.8-2.4T-A95B-Quark-MXFP4 \
--served-model-name amd/Qwen3.8-2.4T-A95B-Quark-MXFP4 \
--tp-size 8 \
--attention-backend aiter \
--page-size 1 \
--kv-cache-dtype auto \
--chunked-prefill-size 16384 \
--watchdog-timeout 1200 \
--mem-fraction-static 0.9 \
--model-loader-extra-config '{"enable_multithread_load": true}' \
--trust-remote-code \
--host 0.0.0.0 \
--port 9001
- Evaluate the model
python3 -m sglang.test.run_eval \
--port 9001 \
--model amd/Qwen3.8-2.4T-A95B-Quark-MXFP4 \
--eval-name gsm8k \
--num-examples 1319 \
--num-threads 512 \
--max-tokens 2048 \
--chat-template-kwargs '{"enable_thinking": false}'
License
Modifications Copyright(c) 2026 Advanced Micro Devices, Inc. All rights reserved.
- Downloads last month
- -