Instructions to use Panorama-grounding/PANORAMA-4B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Panorama-grounding/PANORAMA-4B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="Panorama-grounding/PANORAMA-4B", 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)# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Panorama-grounding/PANORAMA-4B", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Panorama-grounding/PANORAMA-4B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Panorama-grounding/PANORAMA-4B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Panorama-grounding/PANORAMA-4B", "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/Panorama-grounding/PANORAMA-4B
- SGLang
How to use Panorama-grounding/PANORAMA-4B 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 "Panorama-grounding/PANORAMA-4B" \ --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": "Panorama-grounding/PANORAMA-4B", "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 "Panorama-grounding/PANORAMA-4B" \ --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": "Panorama-grounding/PANORAMA-4B", "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 Panorama-grounding/PANORAMA-4B with Docker Model Runner:
docker model run hf.co/Panorama-grounding/PANORAMA-4B
PANORAMA-4B
PANORAMA is a model for panoptic grounded captioning: it writes a full-scene caption and grounds every mentioned entity to a pixel-level mask. Grounding is formulated as mask proposal selection: for each phrase the VLM produces a concept vector that conditions a promptable segmenter to generate candidate masks, and a learned scorer selects the relevant subset, so a phrase can ground to one region, several instances, or none.
This repository hosts the 4B variant, built on Qwen3-VL-4B-Instruct and SAM 3.
It is a generalist model (see Training data).
The package is self-contained: from_pretrained(..., trust_remote_code=True) needs no
external code.
Quick start
pip install -r requirements.txt # inference deps only; skip if you use the repo's environment
python predict_panocaps.py --model . --image examples/robot_table.png --out ./out # caption + masks
python visualize.py --image examples/robot_table.png --pred ./out # overlay + per-phrase panels
For the full evaluation — PanoCaps and the other benchmarks reported in the paper (grounded conversation generation, referring expression segmentation, GroundingSuite) — use the code repository and its environment; the metric stack is not part of this package.
Or directly:
import torch
from PIL import Image
from transformers import AutoModel, AutoProcessor, AutoTokenizer
path = 'Panorama-grounding/PANORAMA-4B'
model = AutoModel.from_pretrained(path, dtype=torch.bfloat16,
low_cpu_mem_usage=True, trust_remote_code=True).eval().cuda()
tokenizer = AutoTokenizer.from_pretrained(path, trust_remote_code=True)
processor = AutoProcessor.from_pretrained(path, trust_remote_code=True)
image = Image.open('photo.jpg').convert('RGB')
with torch.no_grad():
out = model.predict_forward(
image=image,
text='<image>\nWrite a caption covering all objects and background regions in the image, '
'inserting the matching segmentation mask after each phrase.',
tokenizer=tokenizer, processor=processor)
caption = out['prediction'].replace('<|im_end|>', '').strip() # "... <p> red mug </p> [SEG] ..."
masks = out['prediction_masks'] # one (1, H, W) bool mask per [SEG] (union); per-instance: see predict_panocaps.py
Use the prompt verbatim — the model was trained with a deliberate split between this phrasing (dense panoptic coverage) and "describe the image"-style prompts (sparser output), so paraphrasing quietly thins the coverage.
Output format
The caption marks every grounded phrase as <p> phrase </p> [SEG]; the i-th [SEG] maps to
the i-th mask. A phrase may own several instance masks (masks_per_phrase in the
predict_panocaps.py json gives the split), and background regions ("stuff") are grounded
like objects.
Model family
| Model | Base VLM | Proposal model |
|---|---|---|
| PANORAMA-2B | Qwen3-VL-2B-Instruct | SAM 3 |
| PANORAMA-4B | Qwen3-VL-4B-Instruct | SAM 3 |
Training data
Trained on the 957K-sample data mixture described in the paper, including our released PanoCaps, COCONut-PanCap-Recaptioned and MRSeg-Referring-Expressions datasets.
License
For research and non-commercial use only. The package contains weights derived from SAM 3 (Meta, under its own license) and Qwen3-VL-4B-Instruct (Apache 2.0); their terms apply to the corresponding components.
Citation
@article{pieri2026panorama,
title = {PANORAMA: Panoptic Grounded Captioning via Mask Proposal Selection},
author = {Pieri, Sara and Kazakos, Evangelos and Chen, Shizhe and Sivic, Josef and Schmid, Cordelia},
journal = {arXiv preprint arXiv:2609.19143},
year = {2026}
}
- Downloads last month
- -
Model tree for Panorama-grounding/PANORAMA-4B
Base model
Qwen/Qwen3-VL-4B-Instruct