Instructions to use sahilchachra/Mage-VL-NVFP4A16 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use sahilchachra/Mage-VL-NVFP4A16 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="sahilchachra/Mage-VL-NVFP4A16", trust_remote_code=True) 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 AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("sahilchachra/Mage-VL-NVFP4A16", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use sahilchachra/Mage-VL-NVFP4A16 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "sahilchachra/Mage-VL-NVFP4A16" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "sahilchachra/Mage-VL-NVFP4A16", "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/sahilchachra/Mage-VL-NVFP4A16
- SGLang
How to use sahilchachra/Mage-VL-NVFP4A16 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 "sahilchachra/Mage-VL-NVFP4A16" \ --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": "sahilchachra/Mage-VL-NVFP4A16", "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 "sahilchachra/Mage-VL-NVFP4A16" \ --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": "sahilchachra/Mage-VL-NVFP4A16", "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 sahilchachra/Mage-VL-NVFP4A16 with Docker Model Runner:
docker model run hf.co/sahilchachra/Mage-VL-NVFP4A16
Mage-VL-NVFP4A16
NVFP4A16 quantization of
microsoft/Mage-VL
— a ~5B streaming vision-language model from Microsoft (mage_vl, custom architecture): a Mage-ViT visual encoder + a Qwen3-4B-Instruct language backbone, with native support for proactive streaming and neural-codec video. Only the Qwen3 LM backbone is quantized here; the vision encoder is kept in BF16.
Variant: NVFP4 A16 — 4-bit NVFP4 (FP4 E2M1, group size 16) weights, activations BF16. Native on NVIDIA Blackwell.
Quantized by: sahilchachra
Tooling: llm-compressor model_free_ptq (data-free, RTN) -> compressed-tensors
This is a quantized derivative. Weights, behavior, and license follow the base model — see the original card for full details, benchmarks, and citation.
What is quantized
Quantized to 4-bit:
- LM backbone
model.language_model.*.self_attn.{q,k,v,o}_proj - LM backbone
model.language_model.*.mlp.{gate,up,down}_proj(all 36 layers)
Kept in BF16: Mage-ViT vision encoder (model.visual.*), token embeddings, lm_head, all norms (incl. q_norm / k_norm).
Decode speed (measured)
Benchmarked on an NVIDIA Thor (Blackwell, aarch64) via transformers generate(), single 448px image + text prompt, greedy (do_sample=False), 96 new tokens, GPU otherwise idle:
| Variant | Decode speed | On-disk size |
|---|---|---|
| BF16 (base) | ~16.8 tok/s | ~9.5 GB |
| NVFP4A16 | ~14.0 tok/s | ~6.0 GB |
| AWQ W4A16 | ~11.7 tok/s | ~3.9 GB |
Quantization here reduces size, not decode latency. On a 5B VLM at batch=1 on the eager transformers path, decode is compute / vision-encoder bound rather than weight-bandwidth bound, so 4-bit weights bring no bandwidth win and the on-the-fly dequant (FP4→BF16 for NVFP4, int4-unpack for AWQ) adds a little overhead — so the quantized variants are actually slightly slower than BF16 in this setup. The benefit is memory / disk footprint (AWQ ≈ 40% of BF16). Turning that size reduction into a throughput win would require a serving stack with native 4-bit kernels (vLLM / TensorRT-LLM), which do not yet implement the mage_vl architecture.
Runtime
Load with transformers + trust_remote_code=True and the repo's AutoProcessor (custom mage_vl code); vLLM has no mage_vl implementation yet.
Calibration
Data-free — weight-only (model_free_ptq, round-to-nearest); no calibration data. Weights are quantized by streaming the safetensors from disk.
Prompt template & sampling
Custom mage_vl architecture — load with trust_remote_code=True and the repo's AutoProcessor. OpenAI-style messages with image content, e.g. messages=[{"role":"user","content":[{"type":"image"},{"type":"text","text":"Describe this image."}]}], rendered via processor.apply_chat_template(...), images passed as PIL objects via images=[...]. The card recommends do_sample=False for deterministic outputs. Note: vLLM does not yet implement mage_vl, so run it via transformers.
Recommended sampling: do_sample=False (deterministic) per the model card; max_new_tokens per use case.
Usage (vLLM)
from vllm import LLM, SamplingParams
# Weight-only quantized (custom architecture -> requires trust_remote_code).
# Load like the original model in any runtime that implements this arch.
llm = LLM(
model="sahilchachra/Mage-VL-NVFP4A16",
trust_remote_code=True,
)
out = llm.chat(
[{"role": "user", "content": "Hello!"}],
SamplingParams(temperature=0.6, top_p=0.95, max_tokens=512),
)
print(out[0].outputs[0].text)
Serving via the CLI, pass the flag directly:
vllm serve sahilchachra/Mage-VL-NVFP4A16 \
--trust-remote-code \
--max-model-len 262144
- Downloads last month
- 110
Model tree for sahilchachra/Mage-VL-NVFP4A16
Base model
microsoft/Mage-VL