Instructions to use docling-project/SmolDocling-256M-preview with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use docling-project/SmolDocling-256M-preview with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="docling-project/SmolDocling-256M-preview") 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("docling-project/SmolDocling-256M-preview") model = AutoModelForMultimodalLM.from_pretrained("docling-project/SmolDocling-256M-preview", 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 docling-project/SmolDocling-256M-preview with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "docling-project/SmolDocling-256M-preview" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "docling-project/SmolDocling-256M-preview", "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/docling-project/SmolDocling-256M-preview
- SGLang
How to use docling-project/SmolDocling-256M-preview 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 "docling-project/SmolDocling-256M-preview" \ --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": "docling-project/SmolDocling-256M-preview", "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 "docling-project/SmolDocling-256M-preview" \ --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": "docling-project/SmolDocling-256M-preview", "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 docling-project/SmolDocling-256M-preview with Docker Model Runner:
docker model run hf.co/docling-project/SmolDocling-256M-preview
Commit History
-
Update README.md
Verified signaturece51f56 -
Update README.md
Verified signature607718f
-
Update README.md
Verified signature83c9645
-
update load_from_doctags usage
Verified signaturef443b0a
-
Corrected variable name from output_filoutput_path_htmle_path to output_path_html (#26)
Verified signature- Corrected variable name from output_filoutput_path_htmle_path to output_path_html (0b21b419d8e9315be55a21600cd2135253dbd6a4) Co-authored-by: Narendra Kalekar <kalekarnn@users.noreply.huggingface.co>492bde8
-
Update README.md
Verified signature4634ad6 -
Added ONNX code, and fixed examples for saving to avoid confusion. (#20)
Verified signature- Added ONNX code, and fixed examples for saving to avoid confusion. (d69aea178cf98e849c0ebf38a6c224997f15b120)8ef36d9
-
Upload ONNX weights (#7)
Verified signature- Upload ONNX weights (a254de22948510b593ecf4258a1d9a4d60c310b4) - Update config.json (60375ee206ef2bd0467088e5511c84888f3db3ee) - Upload folder using huggingface_hub (009620751b7925e8012cb72d1ad824c101433abd) Co-authored-by: Joshua <Xenova@users.noreply.huggingface.co>11fa51a
-
Update README.md -> Finetune of SmolVLM-256M-Instruct not Idefics (#9)
Verified signature- Update README.md (a797ef924d3b1bf405754508c1752bbbc7224310) Co-authored-by: SebastianB <SebastianBodza@users.noreply.huggingface.co>95f09ca -
Update README.md typo (#10)
Verified signature- Update README.md (c63ae00973c8e7cc68b8d55bba7189dcacee0425) Co-authored-by: g <env@users.noreply.huggingface.co>930b9b2 -
Add MLX example link (#4)
Verified signature- Add MLX example link (b53f7012887a4c5d4865330e850b7e55fb44f41f) Co-authored-by: Christoph Auer <auerchristoph@users.noreply.huggingface.co>cb6aeee -
fix: Correct license to CDLA-permissive-2.0 (#5)
Verified signature- fix: Correct license to CDLA-permissive-2.0 (5a60cc2c24427b45522c412c74fec6e5a4968df7) Co-authored-by: Christoph Auer <auerchristoph@users.noreply.huggingface.co>5be1f5a -
Update README.md
Verified signature9086eeb -
Add link to paper and project page (#3)
Verified signature- Add link to paper and project page (a357c910307598c6ffacd79d1fa2c68594bfa4cb) Co-authored-by: Niels Rogge <nielsr@users.noreply.huggingface.co>a6a2fd8
-
Upload model.safetensors
Verified signature668322a -
Upload Idefics3ForConditionalGeneration
Verified signature97633d4 -
Update README.md
Verified signature34a37cc -
Update README.md
Verified signature8477e02
-
Update README.md
Verified signature5196877 -
Update README.md
Verified signaturea6ad18b -
Update README.md
Verified signatureec6ba0f -
Update README.md
Verified signatureb7182b2 -
Update README.md
Verified signaturefd16117 -
Update README.md
Verified signature60e3cdc -
Update README.md
Verified signaturea3dd76f -
Update README.md
Verified signature904b2d3 -
Update README.md
Verified signature3e8f36f -
Update README.md
Verified signatureUpdated single page and multipage examplesa4c943f -
Update README.md
Verified signaturee9cfa1f -
Update README.md
Verified signatureb8d9a03
-
Update README.md
Verified signaturef432cdc
-
Update README.md
Verified signaturee3c14a7 -
pre-release (11)
Ahmed Nassar AHN@zurich.ibm.com95e922e -
Update README.md
Verified signature2624dcc -
Update README.md
Verified signature414466c -
Update README.md
Verified signatureb742d1c -
Upload 2 files
Verified signaturea344b13
-
Update README.md
Verified signature1074b94 -
Update README.md
Verified signaturecd2c4cb -
Upload SmolDocling_doctags1.png
Verified signatureb1e7508 -
Update README.md
Verified signature56b796c
-
Update README.md
Verified signature04e22bf -
Upload doctags_v2.png
Verified signatureb077c9d -
Update README.md
Verified signaturede6b20e -
Update README.md
Verified signatured456bf8 -
Update README.md
Verified signature6dabef2 -
Update README.md
Verified signature82305a1 -
Update README.md
Verified signature06310a9 -
Update README.md
Verified signature60b40ea -
Update README.md
Verified signaturebc66c00