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
Commit History
-
Add Troubleshooting section to README
Verified signature10ae2e8
-
Update README.md
Verified signature377322a -
token_alignment (#13)
Verified signature- tokenizer alignment (48d1631122017c80068ff7cf45d1138820a6142b)97b0a53 -
Adding `transformers` tag to the library field (#11)
Verified signature- Adding `transformers` tag to the library field (d944bd0de7cceadf9143f0e09c4356b9b360227a) Co-authored-by: Aritra Roy Gosthipaty <ariG23498@users.noreply.huggingface.co>70e26c5
-
Update README.md
Verified signaturea1ff0fe -
Update README.md
Verified signature5289190 -
Update README.md
Verified signatureda240aa -
Update README.md
Verified signature0281789 -
Update README.md
Verified signature9e1ee78 -
Update README.md (#9)
Verified signature- Update README.md (b979ea88773395bfab4c2776bdde383a5b3768aa)a709291 -
Update README.md
Verified signature2e257e0 -
Update README.md (#8)
Verified signature- Update README.md (53afe882bf2d9856472f14176d47698954fe706a)b0d56bd -
Update README.md
Verified signature3299088 -
Upload granite_docling_split_page.png
Verified signature3e1f4b0 -
Update README.md
Verified signature906d75c -
Update README.md
Verified signature46d5666 -
Update README.md
Verified signature595d39b -
Update README.md
Verified signature24a14e1 -
Update README.md
Verified signature65f280a -
Update README.md
Verified signaturef0856a8 -
Update README.md (#7)
Verified signature- Update README.md (d79c468b61f17ea6fb515a1d87c2079ac27aacd9)8903fa1 -
Update README.md
Verified signature9a7beaf -
Update README.md (#6)
Verified signature- Update README.md (6e7faae999a4dc1b37ffbe146e06319422d544c2)a0903a5 -
Upload assets/new_arxiv.png with huggingface_hub
Verified signature3beb7d8 -
Update README.md (#5)
Verified signature- Update README.md (d3e58e550be5e57b115e32dad7bcf5b129e19674)40d7a97
-
Update README.md
Verified signature5ead9c9 -
Update README.md
Verified signature7e97417 -
Update README.md
Verified signaturecbc889a -
Update README.md
Verified signaturecd1a8df -
Update README.md
Verified signature6d56bf5 -
Update README.md
Verified signaturebe2da5a -
Pre release update.
22024b7
-
Update README.md
Verified signaturef3e9d3a -
Update README.md
Verified signature0e8c0b2
-
Update README.md
Verified signaturec5b5483 -
Update README.md
Verified signature8b625a8
-
Update README.md
Verified signature4492f6a
-
Upload model.safetensors (#4)
Verified signature- Upload model.safetensors (331fef74446e643336ff3eceb8e617652d164cc6)c868e6b -
Upload config.json
Verified signaturec8f0b3a -
updated logo
Verified signaturecc7f1e5 -
v0.0.2 (#3)
Verified signature- v0.0.2 (ecba62ead2399d4df4d3f69a180419e09d2dbb67)6298576
-
init checkpoint and chat template
Ahmed Nassar AHN@zurich.ibm.com341382d -
tokenizer and config
Ahmed Nassar AHN@zurich.ibm.com2d59cb9 -
Upload granite_docling.png (#1)
Verified signature- Upload granite_docling.png (0437536cebc02b04b7a1db875329fa1b914d196a) Co-authored-by: Ahmed Nassar <asnassar@users.noreply.huggingface.co>0cfca41
-
initial commit
Verified signature63ab4f3