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
Upload folder using huggingface_hub
Browse files
README.md
CHANGED
|
@@ -52,22 +52,14 @@ import requests
|
|
| 52 |
repo_id = "<repo_id>"
|
| 53 |
model = AutoModelForImageTextToText.from_pretrained(
|
| 54 |
repo_id, trust_remote_code=True,
|
| 55 |
-
).cuda()
|
| 56 |
processor = AutoProcessor.from_pretrained(repo_id, trust_remote_code=True)
|
| 57 |
|
| 58 |
url = "https://llava-vl.github.io/static/images/view.jpg"
|
| 59 |
image = Image.open(requests.get(url, stream=True).raw)
|
|
|
|
|
|
|
| 60 |
|
| 61 |
-
# PanoVLM's chat template wraps string content, so put the <|image|> placeholder
|
| 62 |
-
# inline in the message text (the processor expands it into the image tokens).
|
| 63 |
-
messages = [{"role": "user", "content": "<|image|>Describe this image."}]
|
| 64 |
-
prompt = processor.tokenizer.apply_chat_template(
|
| 65 |
-
messages, add_generation_prompt=True, tokenize=False,
|
| 66 |
-
)
|
| 67 |
-
inputs = processor(text=prompt, images=image, return_tensors="pt").to(model.device)
|
| 68 |
-
|
| 69 |
-
# use_cache=False: HF's generate() passes a DynamicCache that fla indexes as a
|
| 70 |
-
# list, which the new transformers API no longer supports.
|
| 71 |
out = model.generate(**inputs, max_new_tokens=512, temperature=1.0, top_k=10,
|
| 72 |
top_p=1.0, do_sample=True, use_cache=False)
|
| 73 |
print(processor.decode(out[0], skip_special_tokens=True))
|
|
|
|
| 52 |
repo_id = "<repo_id>"
|
| 53 |
model = AutoModelForImageTextToText.from_pretrained(
|
| 54 |
repo_id, trust_remote_code=True,
|
| 55 |
+
).cuda()
|
| 56 |
processor = AutoProcessor.from_pretrained(repo_id, trust_remote_code=True)
|
| 57 |
|
| 58 |
url = "https://llava-vl.github.io/static/images/view.jpg"
|
| 59 |
image = Image.open(requests.get(url, stream=True).raw)
|
| 60 |
+
inputs = processor(text="<|image|>An image of", images=image,
|
| 61 |
+
return_tensors="pt").to(model.device)
|
| 62 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
out = model.generate(**inputs, max_new_tokens=512, temperature=1.0, top_k=10,
|
| 64 |
top_p=1.0, do_sample=True, use_cache=False)
|
| 65 |
print(processor.decode(out[0], skip_special_tokens=True))
|
model-00001-of-00001.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 2052770433
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6c545658c0c55d652b878c0814f69d802960aad2d1f2629951370df1b480d226
|
| 3 |
size 2052770433
|
sharded/shard-00001-model-00001-of-00001.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 2052858480
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0b31434754ac80fd0884c829fcb39706781194a8914fb332ae51def8efe4f539
|
| 3 |
size 2052858480
|