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)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("ibm-granite/granite-docling-258M") model = AutoModelForMultimodalLM.from_pretrained("ibm-granite/granite-docling-258M", 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 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
Update README.md
Browse files
README.md
CHANGED
|
@@ -12,7 +12,7 @@ Granite Docling 258M builds upon the IDEFICS3 architecture, but introduces two k
|
|
| 12 |
- **Model type**: Multi-modal model (image+text-to-text)
|
| 13 |
- **Language(s)**: English (NLP)
|
| 14 |
- **License**: [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0)
|
| 15 |
-
- **Release Date**: September
|
| 16 |
|
| 17 |
Granite-docling-258M is fully integrated into the Docling pipelines, carrying over existing [features](https://huggingface.co/ds4sd/SmolDocling-256M-preview) while introducing a number of powerful new features, including:
|
| 18 |
|
|
@@ -21,14 +21,22 @@ Granite-docling-258M is fully integrated into the Docling pipelines, carrying ov
|
|
| 21 |
- 📸 Robust OCR for Documents in the wild: Accurately extracts text from handheld scans, photos, and low-quality images
|
| 22 |
- 🗝️ Key-Value Pair Extraction: Identifies structured key-value relationships (e.g., forms, receipts)
|
| 23 |
- 🧘 Improved Stability: Tends to avoid infinite loops more effectively
|
|
|
|
| 24 |
|
| 25 |
|
| 26 |
## Evaluations
|
| 27 |
|
| 28 |
-
| |
|
| 29 |
-
|------|------|-------|
|
| 30 |
-
|
|
| 31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
## Getting started
|
| 34 |
|
|
|
|
| 12 |
- **Model type**: Multi-modal model (image+text-to-text)
|
| 13 |
- **Language(s)**: English (NLP)
|
| 14 |
- **License**: [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0)
|
| 15 |
+
- **Release Date**: September 17, 2025
|
| 16 |
|
| 17 |
Granite-docling-258M is fully integrated into the Docling pipelines, carrying over existing [features](https://huggingface.co/ds4sd/SmolDocling-256M-preview) while introducing a number of powerful new features, including:
|
| 18 |
|
|
|
|
| 21 |
- 📸 Robust OCR for Documents in the wild: Accurately extracts text from handheld scans, photos, and low-quality images
|
| 22 |
- 🗝️ Key-Value Pair Extraction: Identifies structured key-value relationships (e.g., forms, receipts)
|
| 23 |
- 🧘 Improved Stability: Tends to avoid infinite loops more effectively
|
| 24 |
+
- 🌍 Japanese, Arabic and Chinese support (_experimental_)
|
| 25 |
|
| 26 |
|
| 27 |
## Evaluations
|
| 28 |
|
| 29 |
+
| | smoldocling-256m-preview | granite-docling-258m |
|
| 30 |
+
|------|------|-------|
|
| 31 |
+
| | OCR | | |
|
| 32 |
+
| | Layout | | |
|
| 33 |
+
| | Code | | |
|
| 34 |
+
| | Equation | | |
|
| 35 |
+
| | Table | | |
|
| 36 |
+
| | Loop | | |
|
| 37 |
+
| | MMStar | | |
|
| 38 |
+
| | OCRBench | | |
|
| 39 |
+
|
| 40 |
|
| 41 |
## Getting started
|
| 42 |
|