Views
No views yet
| Component | Parameters |
|---|---|
| PanoLM LM | ~387 M |
| FastViT-HD vision encoder | ~123 M |
| Projector | ~3 M |
| Total | ~513 M |
1torch==2.12.0
2transformers==5.8.1
3flash-linear-attention==0.5.0
4timm==1.0.25<repo_id> with the HF Hub identifier.1from transformers import AutoModelForImageTextToText, AutoProcessor
2from PIL import Image
3import requests
4
5repo_id = "<repo_id>"
6model = AutoModelForImageTextToText.from_pretrained(
7 repo_id, trust_remote_code=True,
8).cuda() # fla's RMSNorm uses Triton kernels that only run on CUDA tensors.
9processor = AutoProcessor.from_pretrained(repo_id, trust_remote_code=True)
10
11url = "https://llava-vl.github.io/static/images/view.jpg"
12image = Image.open(requests.get(url, stream=True).raw)
13
14# PanoVLM's chat template wraps string content, so put the <|image|> placeholder
15# inline in the message text (the processor expands it into the image tokens).
16# Keep the space after <|image|>: the HF tokenizer, unlike the training tokenizer,
17# does not implicitly insert one at the special-token boundary.
18messages = [{"role": "user", "content": "<|image|> Is there a boat in the image?"}]
19prompt = processor.tokenizer.apply_chat_template(
20 messages, add_generation_prompt=True, tokenize=False,
21)
22inputs = processor(text=prompt, images=image, return_tensors="pt").to(model.device)
23
24out = model.generate(**inputs, max_new_tokens=512)
25print(processor.decode(out[0], skip_special_tokens=True))