Image-Text-to-Text
Transformers
Safetensors
granite_docling
granite
docling
doclang
ocr
document-parsing
document-conversion
layout-analysis
table-recognition
formula-recognition
vllm
autoround
w4a16
gptq
compressed-tensors
quantized
conversational
4-bit precision
auto-round
Run this model with HF Jobs
Run OpenTensorLab/granite-docling-v2-2b-AutoRound on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/OpenTensorLab/granite-docling-v2-2b-AutoRound. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/OpenTensorLab/granite-docling-v2-2b-AutoRound on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/OpenTensorLab/granite-docling-v2-2b-AutoRound. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Instructions to use OpenTensorLab/granite-docling-v2-2b-AutoRound with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use OpenTensorLab/granite-docling-v2-2b-AutoRound with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="OpenTensorLab/granite-docling-v2-2b-AutoRound") 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("OpenTensorLab/granite-docling-v2-2b-AutoRound") model = AutoModelForMultimodalLM.from_pretrained("OpenTensorLab/granite-docling-v2-2b-AutoRound", 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 OpenTensorLab/granite-docling-v2-2b-AutoRound with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "OpenTensorLab/granite-docling-v2-2b-AutoRound" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "OpenTensorLab/granite-docling-v2-2b-AutoRound", "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/OpenTensorLab/granite-docling-v2-2b-AutoRound
- SGLang
How to use OpenTensorLab/granite-docling-v2-2b-AutoRound 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 "OpenTensorLab/granite-docling-v2-2b-AutoRound" \ --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": "OpenTensorLab/granite-docling-v2-2b-AutoRound", "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 "OpenTensorLab/granite-docling-v2-2b-AutoRound" \ --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": "OpenTensorLab/granite-docling-v2-2b-AutoRound", "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 OpenTensorLab/granite-docling-v2-2b-AutoRound with Docker Model Runner:
docker model run hf.co/OpenTensorLab/granite-docling-v2-2b-AutoRound
Download config.json from OpenTensorLab/granite-docling-v2-2b-AutoRound: direct link, hf CLI and curl.
- Browser
- Download file 12.2 kB
-
https://huggingface.co/OpenTensorLab/granite-docling-v2-2b-AutoRound/resolve/main/config.json
- Command line
-
hf download hf://OpenTensorLab/granite-docling-v2-2b-AutoRound/config.json
-
curl -L -o config.json https://huggingface.co/OpenTensorLab/granite-docling-v2-2b-AutoRound/resolve/main/config.json
12.2 kB
| { | |
| "architectures": [ | |
| "GraniteDoclingForConditionalGeneration" | |
| ], | |
| "density_router_hidden_size": null, | |
| "density_router_loss_weight": 0.1, | |
| "density_router_threshold": 0.4, | |
| "dtype": "bfloat16", | |
| "image_token_id": 100337, | |
| "model_type": "granite_docling", | |
| "pad_token_id": 100256, | |
| "text_config": { | |
| "attention_bias": false, | |
| "attention_dropout": 0.0, | |
| "attention_multiplier": 0.0078125, | |
| "bos_token_id": 100257, | |
| "dtype": "bfloat16", | |
| "embedding_multiplier": 12, | |
| "eos_token_id": 100257, | |
| "hidden_act": "silu", | |
| "hidden_size": 2048, | |
| "initializer_range": 0.02, | |
| "intermediate_size": 8192, | |
| "logits_scaling": 8, | |
| "max_position_embeddings": 131072, | |
| "mlp_bias": false, | |
| "model_type": "granite_docling_text", | |
| "num_attention_heads": 16, | |
| "num_hidden_layers": 24, | |
| "num_key_value_heads": 4, | |
| "pad_token_id": 100256, | |
| "residual_multiplier": 0.22, | |
| "rms_norm_eps": 1e-05, | |
| "rope_parameters": { | |
| "rope_theta": 10000000, | |
| "rope_type": "default" | |
| }, | |
| "tie_word_embeddings": true, | |
| "use_cache": true, | |
| "vocab_size": 133800, | |
| "num_mtp_layers": 3 | |
| }, | |
| "tie_word_embeddings": true, | |
| "transformers_version": "5.23.0.dev0", | |
| "use_cache": true, | |
| "vision_config": { | |
| "attention_dropout": 0.0, | |
| "deepstack_visual_indexes": [ | |
| 8, | |
| 16, | |
| 24 | |
| ], | |
| "dtype": "bfloat16", | |
| "hidden_act": "gelu_pytorch_tanh", | |
| "hidden_size": 1152, | |
| "image_size": 512, | |
| "initializer_range": 0.02, | |
| "intermediate_size": 4304, | |
| "layer_norm_eps": 1e-06, | |
| "model_type": "granite_docling_vision", | |
| "num_attention_heads": 16, | |
| "num_channels": 3, | |
| "num_hidden_layers": 27, | |
| "out_hidden_size": 2048, | |
| "patch_size": 16, | |
| "scale_factor": 2, | |
| "use_fine_route": false | |
| }, | |
| "quantization_config": { | |
| "bits": 4, | |
| "data_type": "int", | |
| "group_size": 32, | |
| "sym": true, | |
| "amp": true, | |
| "batch_size": 2, | |
| "low_gpu_mem_usage": false, | |
| "nsamples": 512, | |
| "scale_dtype": "torch.float16", | |
| "seqlen": 4096, | |
| "iters": 1200, | |
| "lr": 0.0008333333333333334, | |
| "minmax_lr": 0.0008333333333333334, | |
| "enable_minmax_tuning": true, | |
| "enable_norm_bias_tuning": false, | |
| "enable_quanted_input": true, | |
| "gradient_accumulate_steps": 4, | |
| "autoround_version": "0.18.0", | |
| "block_name_to_quantize": [ | |
| "model.text_model.layers" | |
| ], | |
| "quant_method": "auto-round", | |
| "packing_format": "auto_round:auto_gptq", | |
| "extra_config": { | |
| ".*model\\.vision_model.*": { | |
| "bits": 16, | |
| "data_type": "float" | |
| }, | |
| "model.layers.0.eh_proj": { | |
| "bits": 16, | |
| "data_type": "bfloat16", | |
| "group_size": -1, | |
| "sym": true | |
| }, | |
| "model.layers.0.mtp_block.self_attn.q_proj": { | |
| "bits": 16, | |
| "data_type": "bfloat16", | |
| "group_size": -1, | |
| "sym": true | |
| }, | |
| "model.layers.0.mtp_block.self_attn.k_proj": { | |
| "bits": 16, | |
| "data_type": "bfloat16", | |
| "group_size": -1, | |
| "sym": true | |
| }, | |
| "model.layers.0.mtp_block.self_attn.v_proj": { | |
| "bits": 16, | |
| "data_type": "bfloat16", | |
| "group_size": -1, | |
| "sym": true | |
| }, | |
| "model.layers.0.mtp_block.self_attn.qkv_proj": { | |
| "bits": 16, | |
| "data_type": "bfloat16", | |
| "group_size": -1, | |
| "sym": true | |
| }, | |
| "model.layers.0.mtp_block.self_attn.o_proj": { | |
| "bits": 16, | |
| "data_type": "bfloat16", | |
| "group_size": -1, | |
| "sym": true | |
| }, | |
| "model.layers.0.mtp_block.mlp.gate_proj": { | |
| "bits": 16, | |
| "data_type": "bfloat16", | |
| "group_size": -1, | |
| "sym": true | |
| }, | |
| "model.layers.0.mtp_block.mlp.up_proj": { | |
| "bits": 16, | |
| "data_type": "bfloat16", | |
| "group_size": -1, | |
| "sym": true | |
| }, | |
| "model.layers.0.mtp_block.mlp.gate_up_proj": { | |
| "bits": 16, | |
| "data_type": "bfloat16", | |
| "group_size": -1, | |
| "sym": true | |
| }, | |
| "model.layers.0.mtp_block.mlp.down_proj": { | |
| "bits": 16, | |
| "data_type": "bfloat16", | |
| "group_size": -1, | |
| "sym": true | |
| }, | |
| "model.layers.1.eh_proj": { | |
| "bits": 16, | |
| "data_type": "bfloat16", | |
| "group_size": -1, | |
| "sym": true | |
| }, | |
| "model.layers.1.mtp_block.self_attn.q_proj": { | |
| "bits": 16, | |
| "data_type": "bfloat16", | |
| "group_size": -1, | |
| "sym": true | |
| }, | |
| "model.layers.1.mtp_block.self_attn.k_proj": { | |
| "bits": 16, | |
| "data_type": "bfloat16", | |
| "group_size": -1, | |
| "sym": true | |
| }, | |
| "model.layers.1.mtp_block.self_attn.v_proj": { | |
| "bits": 16, | |
| "data_type": "bfloat16", | |
| "group_size": -1, | |
| "sym": true | |
| }, | |
| "model.layers.1.mtp_block.self_attn.qkv_proj": { | |
| "bits": 16, | |
| "data_type": "bfloat16", | |
| "group_size": -1, | |
| "sym": true | |
| }, | |
| "model.layers.1.mtp_block.self_attn.o_proj": { | |
| "bits": 16, | |
| "data_type": "bfloat16", | |
| "group_size": -1, | |
| "sym": true | |
| }, | |
| "model.layers.1.mtp_block.mlp.gate_proj": { | |
| "bits": 16, | |
| "data_type": "bfloat16", | |
| "group_size": -1, | |
| "sym": true | |
| }, | |
| "model.layers.1.mtp_block.mlp.up_proj": { | |
| "bits": 16, | |
| "data_type": "bfloat16", | |
| "group_size": -1, | |
| "sym": true | |
| }, | |
| "model.layers.1.mtp_block.mlp.gate_up_proj": { | |
| "bits": 16, | |
| "data_type": "bfloat16", | |
| "group_size": -1, | |
| "sym": true | |
| }, | |
| "model.layers.1.mtp_block.mlp.down_proj": { | |
| "bits": 16, | |
| "data_type": "bfloat16", | |
| "group_size": -1, | |
| "sym": true | |
| }, | |
| "model.layers.2.eh_proj": { | |
| "bits": 16, | |
| "data_type": "bfloat16", | |
| "group_size": -1, | |
| "sym": true | |
| }, | |
| "model.layers.2.mtp_block.self_attn.q_proj": { | |
| "bits": 16, | |
| "data_type": "bfloat16", | |
| "group_size": -1, | |
| "sym": true | |
| }, | |
| "model.layers.2.mtp_block.self_attn.k_proj": { | |
| "bits": 16, | |
| "data_type": "bfloat16", | |
| "group_size": -1, | |
| "sym": true | |
| }, | |
| "model.layers.2.mtp_block.self_attn.v_proj": { | |
| "bits": 16, | |
| "data_type": "bfloat16", | |
| "group_size": -1, | |
| "sym": true | |
| }, | |
| "model.layers.2.mtp_block.self_attn.qkv_proj": { | |
| "bits": 16, | |
| "data_type": "bfloat16", | |
| "group_size": -1, | |
| "sym": true | |
| }, | |
| "model.layers.2.mtp_block.self_attn.o_proj": { | |
| "bits": 16, | |
| "data_type": "bfloat16", | |
| "group_size": -1, | |
| "sym": true | |
| }, | |
| "model.layers.2.mtp_block.mlp.gate_proj": { | |
| "bits": 16, | |
| "data_type": "bfloat16", | |
| "group_size": -1, | |
| "sym": true | |
| }, | |
| "model.layers.2.mtp_block.mlp.up_proj": { | |
| "bits": 16, | |
| "data_type": "bfloat16", | |
| "group_size": -1, | |
| "sym": true | |
| }, | |
| "model.layers.2.mtp_block.mlp.gate_up_proj": { | |
| "bits": 16, | |
| "data_type": "bfloat16", | |
| "group_size": -1, | |
| "sym": true | |
| }, | |
| "model.layers.2.mtp_block.mlp.down_proj": { | |
| "bits": 16, | |
| "data_type": "bfloat16", | |
| "group_size": -1, | |
| "sym": true | |
| }, | |
| "mtp.layers.0.eh_proj": { | |
| "bits": 16, | |
| "data_type": "bfloat16", | |
| "group_size": -1, | |
| "sym": true | |
| }, | |
| "mtp.layers.0.mtp_block.self_attn.q_proj": { | |
| "bits": 16, | |
| "data_type": "bfloat16", | |
| "group_size": -1, | |
| "sym": true | |
| }, | |
| "mtp.layers.0.mtp_block.self_attn.k_proj": { | |
| "bits": 16, | |
| "data_type": "bfloat16", | |
| "group_size": -1, | |
| "sym": true | |
| }, | |
| "mtp.layers.0.mtp_block.self_attn.v_proj": { | |
| "bits": 16, | |
| "data_type": "bfloat16", | |
| "group_size": -1, | |
| "sym": true | |
| }, | |
| "mtp.layers.0.mtp_block.self_attn.qkv_proj": { | |
| "bits": 16, | |
| "data_type": "bfloat16", | |
| "group_size": -1, | |
| "sym": true | |
| }, | |
| "mtp.layers.0.mtp_block.self_attn.o_proj": { | |
| "bits": 16, | |
| "data_type": "bfloat16", | |
| "group_size": -1, | |
| "sym": true | |
| }, | |
| "mtp.layers.0.mtp_block.mlp.gate_proj": { | |
| "bits": 16, | |
| "data_type": "bfloat16", | |
| "group_size": -1, | |
| "sym": true | |
| }, | |
| "mtp.layers.0.mtp_block.mlp.up_proj": { | |
| "bits": 16, | |
| "data_type": "bfloat16", | |
| "group_size": -1, | |
| "sym": true | |
| }, | |
| "mtp.layers.0.mtp_block.mlp.gate_up_proj": { | |
| "bits": 16, | |
| "data_type": "bfloat16", | |
| "group_size": -1, | |
| "sym": true | |
| }, | |
| "mtp.layers.0.mtp_block.mlp.down_proj": { | |
| "bits": 16, | |
| "data_type": "bfloat16", | |
| "group_size": -1, | |
| "sym": true | |
| }, | |
| "mtp.layers.1.eh_proj": { | |
| "bits": 16, | |
| "data_type": "bfloat16", | |
| "group_size": -1, | |
| "sym": true | |
| }, | |
| "mtp.layers.1.mtp_block.self_attn.q_proj": { | |
| "bits": 16, | |
| "data_type": "bfloat16", | |
| "group_size": -1, | |
| "sym": true | |
| }, | |
| "mtp.layers.1.mtp_block.self_attn.k_proj": { | |
| "bits": 16, | |
| "data_type": "bfloat16", | |
| "group_size": -1, | |
| "sym": true | |
| }, | |
| "mtp.layers.1.mtp_block.self_attn.v_proj": { | |
| "bits": 16, | |
| "data_type": "bfloat16", | |
| "group_size": -1, | |
| "sym": true | |
| }, | |
| "mtp.layers.1.mtp_block.self_attn.qkv_proj": { | |
| "bits": 16, | |
| "data_type": "bfloat16", | |
| "group_size": -1, | |
| "sym": true | |
| }, | |
| "mtp.layers.1.mtp_block.self_attn.o_proj": { | |
| "bits": 16, | |
| "data_type": "bfloat16", | |
| "group_size": -1, | |
| "sym": true | |
| }, | |
| "mtp.layers.1.mtp_block.mlp.gate_proj": { | |
| "bits": 16, | |
| "data_type": "bfloat16", | |
| "group_size": -1, | |
| "sym": true | |
| }, | |
| "mtp.layers.1.mtp_block.mlp.up_proj": { | |
| "bits": 16, | |
| "data_type": "bfloat16", | |
| "group_size": -1, | |
| "sym": true | |
| }, | |
| "mtp.layers.1.mtp_block.mlp.gate_up_proj": { | |
| "bits": 16, | |
| "data_type": "bfloat16", | |
| "group_size": -1, | |
| "sym": true | |
| }, | |
| "mtp.layers.1.mtp_block.mlp.down_proj": { | |
| "bits": 16, | |
| "data_type": "bfloat16", | |
| "group_size": -1, | |
| "sym": true | |
| }, | |
| "mtp.layers.2.eh_proj": { | |
| "bits": 16, | |
| "data_type": "bfloat16", | |
| "group_size": -1, | |
| "sym": true | |
| }, | |
| "mtp.layers.2.mtp_block.self_attn.q_proj": { | |
| "bits": 16, | |
| "data_type": "bfloat16", | |
| "group_size": -1, | |
| "sym": true | |
| }, | |
| "mtp.layers.2.mtp_block.self_attn.k_proj": { | |
| "bits": 16, | |
| "data_type": "bfloat16", | |
| "group_size": -1, | |
| "sym": true | |
| }, | |
| "mtp.layers.2.mtp_block.self_attn.v_proj": { | |
| "bits": 16, | |
| "data_type": "bfloat16", | |
| "group_size": -1, | |
| "sym": true | |
| }, | |
| "mtp.layers.2.mtp_block.self_attn.qkv_proj": { | |
| "bits": 16, | |
| "data_type": "bfloat16", | |
| "group_size": -1, | |
| "sym": true | |
| }, | |
| "mtp.layers.2.mtp_block.self_attn.o_proj": { | |
| "bits": 16, | |
| "data_type": "bfloat16", | |
| "group_size": -1, | |
| "sym": true | |
| }, | |
| "mtp.layers.2.mtp_block.mlp.gate_proj": { | |
| "bits": 16, | |
| "data_type": "bfloat16", | |
| "group_size": -1, | |
| "sym": true | |
| }, | |
| "mtp.layers.2.mtp_block.mlp.up_proj": { | |
| "bits": 16, | |
| "data_type": "bfloat16", | |
| "group_size": -1, | |
| "sym": true | |
| }, | |
| "mtp.layers.2.mtp_block.mlp.gate_up_proj": { | |
| "bits": 16, | |
| "data_type": "bfloat16", | |
| "group_size": -1, | |
| "sym": true | |
| }, | |
| "mtp.layers.2.mtp_block.mlp.down_proj": { | |
| "bits": 16, | |
| "data_type": "bfloat16", | |
| "group_size": -1, | |
| "sym": true | |
| } | |
| }, | |
| "ignore": [ | |
| "mtp", | |
| "mtp.*", | |
| "lm_head", | |
| "model.vision_model", | |
| "model.layers.0", | |
| "model.layers.1", | |
| "model.layers.2" | |
| ] | |
| } | |
| } |