Instructions to use flintglass/PrismParse-2B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use flintglass/PrismParse-2B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="flintglass/PrismParse-2B") 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 AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("flintglass/PrismParse-2B") model = AutoModelForMultimodalLM.from_pretrained("flintglass/PrismParse-2B", device_map="auto") 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?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use flintglass/PrismParse-2B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "flintglass/PrismParse-2B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "flintglass/PrismParse-2B", "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/flintglass/PrismParse-2B
- SGLang
How to use flintglass/PrismParse-2B 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 "flintglass/PrismParse-2B" \ --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": "flintglass/PrismParse-2B", "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 "flintglass/PrismParse-2B" \ --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": "flintglass/PrismParse-2B", "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 flintglass/PrismParse-2B with Docker Model Runner:
docker model run hf.co/flintglass/PrismParse-2B
Flintglass PrismParse-2B
Flintglass PrismParse-2B is an ultra-compact, Apache-2.0 2.2B Vision-Language Document Parsing & OCR specialist built on Qwen/Qwen3.5-2B (4.2 GB BF16, ~1.5 GB Q4_K_M GGUF). Designed for edge, CPU, Apple Silicon, and high-throughput RAG document ingestion pipelines, PrismParse-2B outperforms the 4Γ larger Qwen/Qwen3.5-9B on scientific PDF table extraction (79.58% Cell F1 / 90.98% HTML 1-NED vs. 76.81% / 70.92%) and printed/handwritten math LaTeX OCR (95.07% 1-NED / 57.04% Exact Match vs. 92.52% / 46.65%), while achieving 100% valid JSON on receipts and invoices (87.27% CORD-v2 F1, 91.45% Invoices F1).
- Higher-precision 4B sibling:
flintglass/PrismParse-4B(90.05%Avg 5-Bench,83.95%PubTabNet Cell F1,95.80%LaTeX-OCR) - GGUF +
mmprojquantizations (llama.cpp / Ollama / LM Studio):flintglass/PrismParse-2B-GGUF
Zero-Leakage 5-Benchmark Evaluation (2,244 Held-Out Document Images)
| Model (All Apache 2.0) | Avg 5-Bench | CORD-v2 Receipts (Field F1 / Valid JSON) | Invoices (Field F1 / Valid JSON) | PubTabNet Tables (Cell F1 / HTML 1-NED) | LaTeX-OCR Math (1-NED / Exact) | DocVQA (ANLS) |
|---|---|---|---|---|---|---|
Qwen/Qwen3.5-2B (Base) |
49.65% | 2.87% / 99.0% | 3.08% / 100% | 61.99% / 64.50% | 90.71% / 37.68% | 89.62% |
Qwen/Qwen3.5-4B (Base) |
53.83% | 7.75% / 100% | 3.60% / 78.9% | 72.84% / 67.84% | 91.59% / 40.67% | 93.36% |
Qwen/Qwen3.5-9B (Base, 4Γ larger) |
54.06% | 4.64% / 100% | 2.35% / 76.3% | 76.81% / 70.92% | 92.52% / 46.65% | 94.00% |
flintglass/PrismParse-2B (2.2B) |
88.44% | 87.27% / 100% | 91.45% / 100% | 79.58% / 90.98% | 95.07% / 57.04% | 88.82% |
flintglass/PrismParse-4B (4.5B) |
90.05% | 87.61% / 100% | 91.18% / 100% | 83.95% / 93.00% | 95.80% / 59.33% | 91.69% |
Quickstart
import torch
from PIL import Image
from transformers import AutoModelForImageTextToText, AutoProcessor
model_id = "flintglass/PrismParse-2B"
processor = AutoProcessor.from_pretrained(model_id)
model = AutoModelForImageTextToText.from_pretrained(
model_id, torch_dtype=torch.bfloat16, device_map="auto"
)
image = Image.open("receipt.jpg").convert("RGB")
prompt = (
"Extract all structured fields from this receipt image as a single valid JSON object "
"(with keys such as menu, sub_total, total). Output ONLY valid JSON with no markdown or extra text."
)
messages = [{"role": "user", "content": [{"type": "image", "image": image}, {"type": "text", "text": prompt}]}]
inputs = processor.apply_chat_template(
messages, tokenize=True, add_generation_prompt=True,
return_dict=True, return_tensors="pt", enable_thinking=False
).to(model.device)
out = model.generate(**inputs, max_new_tokens=1024, do_sample=False)
print(processor.decode(out[0, inputs["input_ids"].shape[1]:], skip_special_tokens=True))
See flintglass/PrismParse-4B for the full prompt reference table, LaTeX printed/handwritten breakdown, and permissive data provenance.
License
Apache 2.0. Built by Flintglass Labs.
- Downloads last month
- 37