Image-Text-to-Text
Transformers
Safetensors
English
panovlm
feature-extraction
fastvit
vision-language
linear-attention
conversational
custom_code
Instructions to use PanocularAI/PanoVLM-500M with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use PanocularAI/PanoVLM-500M with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="PanocularAI/PanoVLM-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)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("PanocularAI/PanoVLM-500M", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use PanocularAI/PanoVLM-500M with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "PanocularAI/PanoVLM-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/PanoVLM-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" } } ] } ] }'Use Docker
docker model run hf.co/PanocularAI/PanoVLM-500M
- SGLang
How to use PanocularAI/PanoVLM-500M 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 "PanocularAI/PanoVLM-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/PanoVLM-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" } } ] } ] }'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 "PanocularAI/PanoVLM-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/PanoVLM-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 Runner
How to use PanocularAI/PanoVLM-500M with Docker Model Runner:
docker model run hf.co/PanocularAI/PanoVLM-500M
| library_name: transformers | |
| license: apache-2.0 | |
| language: | |
| - en | |
| pipeline_tag: image-text-to-text | |
| tags: | |
| - panovlm | |
| - fastvit | |
| - vision-language | |
| - linear-attention | |
| # PanoVLM-500M | |
| PanoVLM is a linear-attention vision-language model: a FastViT-HD vision encoder (timm) feeding a PanoLM linear-attention causal LM through a lightweight | |
| projector. | |
| - Type: Vision-Language (image-text-to-text) Model | |
| - LM: PanoLM-380M | |
| - Vision encoder: FastViT-HD (timm), NCHW input | |
| - Projector: BitLinear (encoder dim → LM dim) | |
| - Default image resolution: 1024×1024 (pad-resized; only the resolution is meant to be changed) | |
| ## Parameters | |
| | Component | Parameters | | |
| |---------------------------|-----------:| | |
| | PanoLM LM | ~387 M | | |
| | FastViT-HD vision encoder | ~123 M | | |
| | Projector | ~3 M | | |
| | **Total** | **~513 M** | | |
| ## Requirements | |
| ```text | |
| torch==2.12.0 | |
| transformers==5.8.1 | |
| flash-linear-attention==0.5.0 | |
| timm==1.0.25 | |
| ``` | |
| ## Usage | |
| Replace `<repo_id>` with the HF Hub identifier. | |
| ```python | |
| from transformers import AutoModelForImageTextToText, AutoProcessor | |
| from PIL import Image | |
| import requests | |
| repo_id = "<repo_id>" | |
| 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) | |
| # PanoVLM's chat template wraps string content, so put the <|image|> placeholder | |
| # inline in the message text (the processor expands it into the image tokens). | |
| # Keep the space after <|image|>: the HF tokenizer, unlike the training tokenizer, | |
| # does not implicitly insert one at the special-token boundary. | |
| messages = [{"role": "user", "content": "<|image|> Is there a boat in the image?"}] | |
| prompt = processor.tokenizer.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)) | |
| ``` | |