Image-Text-to-Text
Transformers
Safetensors
English
idefics3
text-generation
documents
code
formula
chart
ocr
layout
table
document-parse
docling
granite
extraction
math
conversational
Instructions to use ibm-granite/granite-docling-258M with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ibm-granite/granite-docling-258M with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="ibm-granite/granite-docling-258M") 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 AutoProcessor, AutoModelForImageTextToText processor = AutoProcessor.from_pretrained("ibm-granite/granite-docling-258M") model = AutoModelForImageTextToText.from_pretrained("ibm-granite/granite-docling-258M") 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=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use ibm-granite/granite-docling-258M with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ibm-granite/granite-docling-258M" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ibm-granite/granite-docling-258M", "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/ibm-granite/granite-docling-258M
- SGLang
How to use ibm-granite/granite-docling-258M 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 "ibm-granite/granite-docling-258M" \ --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": "ibm-granite/granite-docling-258M", "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 "ibm-granite/granite-docling-258M" \ --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": "ibm-granite/granite-docling-258M", "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 ibm-granite/granite-docling-258M with Docker Model Runner:
docker model run hf.co/ibm-granite/granite-docling-258M
Let transformers use cache for LLM by default
#45 opened 4 months ago
by
auerchristoph
no simple compatible
2
#44 opened 5 months ago
by
kalle07
IBM Granite Docling
#43 opened 7 months ago
by
MadhavGaur
output endless <ecel>
1
#42 opened 8 months ago
by
openmartin
Which model are you using for the demo?
1
#41 opened 8 months ago
by
MelikaNLP
MarCognity-AI for IBM โ Granite DocLing
#40 opened 8 months ago
by
elly99
Hallucinations
3
#39 opened 8 months ago
by
ntsarb
Docling OCR output
โ 1
5
#38 opened 8 months ago
by
InformaticsSolutions
Why is granite-docling-258M so slow?
๐ค 2
35
#37 opened 8 months ago
by
hgarp-prozis
How are these bounding boxes being generated on top of the demo images
1
#36 opened 8 months ago
by
hsuyab
having trouble with efficiency/speed
1
#35 opened 8 months ago
by
hammertime23
MarCognity-AI for ibm-granite/granite-docling-258M
#34 opened 8 months ago
by
elly99
Doesn't work for simple PDFs
1
#33 opened 8 months ago
by
hanshupe
ONNX Conversion Available - Performance Benchmarks & Implementation Guide
๐โค๏ธ 2
7
#32 opened 8 months ago
by
glamberson
chore: add/update description via script
#29 opened 8 months ago
by
ACanser
Request: DOI
#28 opened 8 months ago
by
Carolinehere10
Granite-Docling-258M Variants, Docker and Inference Snippets Starting Point
#27 opened 8 months ago
by
daybytez
Repetition for page headings
2
#24 opened 8 months ago
by
kevinqn
Request for ONNX version
๐๐ 2
5
#21 opened 8 months ago
by
harisnaeem
granite-docling-258M docker image?
3
#19 opened 8 months ago
by
nossi99
can you provide onnx model weights?
๐ฅ๐ 2
2
#17 opened 8 months ago
by
ningpp
llama.cpp
โ 2
4
#16 opened 9 months ago
by
engrtipusultan
Local Installation Video and Testing - Step by Step
โค๏ธ 3
#15 opened 9 months ago
by
fahdmirzac
Single page image inference using plain tranformers not working
18
#10 opened 9 months ago
by
zoldaten