Instructions to use prithivMLmods/AREX-2-FP8 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use prithivMLmods/AREX-2-FP8 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="prithivMLmods/AREX-2-FP8") 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("prithivMLmods/AREX-2-FP8") model = AutoModelForMultimodalLM.from_pretrained("prithivMLmods/AREX-2-FP8", 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 prithivMLmods/AREX-2-FP8 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "prithivMLmods/AREX-2-FP8" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "prithivMLmods/AREX-2-FP8", "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/prithivMLmods/AREX-2-FP8
- SGLang
How to use prithivMLmods/AREX-2-FP8 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 "prithivMLmods/AREX-2-FP8" \ --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": "prithivMLmods/AREX-2-FP8", "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 "prithivMLmods/AREX-2-FP8" \ --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": "prithivMLmods/AREX-2-FP8", "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 prithivMLmods/AREX-2-FP8 with Docker Model Runner:
docker model run hf.co/prithivMLmods/AREX-2-FP8
AREX-2-FP8
AREX-2-FP8 is an FP8 (W8A8) dynamic-quantized variant of BAAI/AREX-2, a 27B long-horizon, self-improving agent model built on a Qwen3.8-compatible multimodal dense architecture. Compression was performed with LLM Compressor using the FP8_DYNAMIC scheme, which quantizes weights to FP8 per-channel and activations to FP8 per-token at runtime, so no calibration data is required. The result reduces memory footprint and improves inference throughput on FP8-capable GPUs, with the checkpoint stored in the compressed-tensors format for direct loading in vLLM. For model architecture, training details, intended use, evaluation results, and the citation, refer to the original model card: BAAI/AREX-2.
Model Overview
| Attribute | Value |
|---|---|
| Base model | BAAI/AREX-2 (derived from Qwen/Qwen3.8-27B) |
| Quantized model | prithivMLmods/AREX-2-FP8 |
| Parameters | 27B |
| Context length | 262,144 tokens |
| Modality | Image-Text-to-Text |
| Quantization scheme | FP8_DYNAMIC (W8A8) |
| Weights | FP8, per-channel |
| Activations | FP8, per-token, dynamic |
| Calibration data | Not required |
| Format | compressed-tensors (safetensors) |
| Tooling | LLM Compressor |
| License | Apache 2.0 |
Quantization Details
Only Linear layers are quantized. The following modules are excluded and remain in their original precision to preserve output quality: the language-model head, the token embeddings, the entire vision tower, and all linear-attention layers.
recipe.yaml
default_stage:
default_modifiers:
QuantizationModifier:
targets: [Linear]
ignore: ['re:.*lm_head', 're:.*embed_tokens$', 're:.*visual.*', 're:.*model.visual.*',
're:.*linear_attn.*']
scheme: FP8_DYNAMIC
bypass_divisibility_checks: false
requires_calibration_data: false
| Setting | Value |
|---|---|
| targets | Linear |
| ignore | lm_head, embed_tokens, visual, model.visual, linear_attn |
| scheme | FP8_DYNAMIC |
| bypass_divisibility_checks | false |
| requires_calibration_data | false |
Inference with vLLM
Install a recent vLLM release with Qwen3.8 support.
pip install -U vllm
Serve
vllm serve prithivMLmods/AREX-2-FP8 \
--max-model-len 32768 \
--trust-remote-code
Raise --max-model-len toward the native 262,144 tokens as GPU memory allows. Add --tensor-parallel-size N for multi-GPU setups.
Query the OpenAI-compatible endpoint
from openai import OpenAI
client = OpenAI(base_url="http://localhost:8000/v1", api_key="EMPTY")
response = client.chat.completions.create(
model="prithivMLmods/AREX-2-FP8",
messages=[
{
"role": "user",
"content": "Propose a solution and explain how you would improve it over several rounds.",
}
],
max_tokens=1024,
seed=42,
)
print(response.choices[0].message.content)
Offline inference
from vllm import LLM, SamplingParams
llm = LLM(
model="prithivMLmods/AREX-2-FP8",
max_model_len=32768,
trust_remote_code=True,
)
params = SamplingParams(max_tokens=1024, seed=42)
messages = [{
"role": "user",
"content": "Propose a solution and explain how you would improve it over several rounds.",
}]
outputs = llm.chat(messages, params)
print(outputs[0].outputs[0].text)
Reproducing the Quantization
pip install -U llmcompressor transformers accelerate torch
import torch
from transformers import AutoModelForMultimodalLM, AutoProcessor
from llmcompressor import oneshot
model_id = "BAAI/AREX-2"
save_dir = "AREX-2-FP8"
model = AutoModelForMultimodalLM.from_pretrained(
model_id, dtype=torch.bfloat16, device_map="auto"
)
processor = AutoProcessor.from_pretrained(model_id)
oneshot(model=model, recipe="recipe.yaml")
model.save_pretrained(save_dir, save_compressed=True)
processor.save_pretrained(save_dir)
Notes
- FP8 hardware support is required for full speed benefits (NVIDIA Hopper, Ada Lovelace, or newer). Other GPUs may fall back to weight-only behavior with reduced gains.
- Quantization can introduce small deviations from the BF16 reference. Benchmark scores reported on the BAAI/AREX-2 card apply to the original weights and were not re-measured for this checkpoint.
- Follow the license terms and notices of the original AREX-2 release and the Qwen base model.
Acknowledgements
- BAAI for AREX-2.
- vLLM Project for LLM Compressor.
- Downloads last month
- -