PanoVLM
Collection
2 items โข Updated
How to use PanocularAI/PanoVLM1.5-500M with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("image-text-to-text", model="PanocularAI/PanoVLM1.5-500M", 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("PanocularAI/PanoVLM1.5-500M", trust_remote_code=True, device_map="auto")How to use PanocularAI/PanoVLM1.5-500M with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "PanocularAI/PanoVLM1.5-500M"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "PanocularAI/PanoVLM1.5-500M",
"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 run hf.co/PanocularAI/PanoVLM1.5-500M
How to use PanocularAI/PanoVLM1.5-500M with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "PanocularAI/PanoVLM1.5-500M" \
--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": "PanocularAI/PanoVLM1.5-500M",
"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 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 "PanocularAI/PanoVLM1.5-500M" \
--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": "PanocularAI/PanoVLM1.5-500M",
"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"
}
}
]
}
]
}'How to use PanocularAI/PanoVLM1.5-500M with Docker Model Runner:
docker model run hf.co/PanocularAI/PanoVLM1.5-500M
PanoVLM1.5 is a vision-language model: a FastViT-HD vision encoder (timm) feeding the PanoLM1.5-400M causal LM through a linear projector. The LM is a hybrid: 20 of its 24 layers use KDA linear attention, the other 4 use multi-head latent attention (MLA).
| Component | Parameters |
|---|---|
| PanoLM1.5 LM | 388.5 M |
| FastViT-HD vision encoder | 122.7 M |
| Projector | 3.1 M |
| Total | 514.3 M |
torch==2.12.0
transformers==5.8.1
flash-linear-attention==0.5.0
timm==1.0.25
import requests
from PIL import Image
from transformers import AutoModelForImageTextToText, AutoProcessor
repo_id = "PanocularAI/PanoVLM1.5-500M"
model = AutoModelForImageTextToText.from_pretrained(
repo_id,
trust_remote_code=True,
).cuda() # fla's RMSNorm uses Triton kernels that only run on CUDA tensors.
processor = AutoProcessor.from_pretrained(repo_id, trust_remote_code=True)
url = "https://llava-vl.github.io/static/images/view.jpg"
image = Image.open(requests.get(url, stream=True).raw)
# Put the <|image|> placeholder inline in the message text (the processor expands
# it into the image tokens). processor.apply_chat_template strips the whitespace
# around the placeholder, as the training data pipeline did.
messages = [{"role": "user", "content": "<|image|>\nAre there mountains in the image?"}]
prompt = processor.apply_chat_template(
messages,
add_generation_prompt=True,
tokenize=False,
)
inputs = processor(text=prompt, images=image, return_tensors="pt").to(model.device)
out = model.generate(**inputs, max_new_tokens=512)
print(processor.decode(out[0], skip_special_tokens=True))
Evaluated with lmms-eval (commit 7439e2bf): greedy decoding, each task's default prompt and answer length, batch size 16. Answer parsing is lenient about format only: one trailing period is stripped, and the option letter is read out of answers like "Answer: B".
| Benchmark | Score |
|---|---|
| POPE (F1) | 83.3 |
| MME (/2800) | 1109.5 |
| HallusionBench | 25.8 |
| COCO captions (CIDEr) | 93.9 |
| NoCaps (CIDEr) | 84.2 |
| GQA (testdev) | 42.6 |
| TextVQA (val) | 42.5 |
| RealWorldQA | 36.7 |