Image-Text-to-Text
Transformers
Safetensors
English
qwen2_5_vl
text-generation-inference
unsloth
conversational
Instructions to use erdem-erdem/ocr2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use erdem-erdem/ocr2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="erdem-erdem/ocr2") 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, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("erdem-erdem/ocr2") model = AutoModelForMultimodalLM.from_pretrained("erdem-erdem/ocr2", 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=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use erdem-erdem/ocr2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "erdem-erdem/ocr2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "erdem-erdem/ocr2", "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/erdem-erdem/ocr2
- SGLang
How to use erdem-erdem/ocr2 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 "erdem-erdem/ocr2" \ --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": "erdem-erdem/ocr2", "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 "erdem-erdem/ocr2" \ --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": "erdem-erdem/ocr2", "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" } } ] } ] }' - Unsloth Studio
How to use erdem-erdem/ocr2 with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for erdem-erdem/ocr2 to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for erdem-erdem/ocr2 to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for erdem-erdem/ocr2 to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="erdem-erdem/ocr2", max_seq_length=2048, ) - Docker Model Runner
How to use erdem-erdem/ocr2 with Docker Model Runner:
docker model run hf.co/erdem-erdem/ocr2
| { | |
| "architectures": [ | |
| "Qwen2_5_VLForConditionalGeneration" | |
| ], | |
| "attention_dropout": 0.0, | |
| "eos_token_id": 151645, | |
| "hidden_act": "silu", | |
| "hidden_size": 2048, | |
| "image_token_id": 151655, | |
| "initializer_range": 0.02, | |
| "intermediate_size": 11008, | |
| "max_position_embeddings": 128000, | |
| "max_window_layers": 70, | |
| "model_type": "qwen2_5_vl", | |
| "num_attention_heads": 16, | |
| "num_hidden_layers": 36, | |
| "num_key_value_heads": 2, | |
| "pad_token_id": 151654, | |
| "rms_norm_eps": 1e-06, | |
| "rope_scaling": { | |
| "mrope_section": [ | |
| 16, | |
| 24, | |
| 24 | |
| ], | |
| "rope_type": "default", | |
| "type": "default" | |
| }, | |
| "rope_theta": 1000000.0, | |
| "sliding_window": 32768, | |
| "text_config": { | |
| "architectures": [ | |
| "Qwen2_5_VLForConditionalGeneration" | |
| ], | |
| "attention_dropout": 0.0, | |
| "eos_token_id": 151645, | |
| "hidden_act": "silu", | |
| "hidden_size": 2048, | |
| "image_token_id": null, | |
| "initializer_range": 0.02, | |
| "intermediate_size": 11008, | |
| "layer_types": [ | |
| "full_attention", | |
| "full_attention", | |
| "full_attention", | |
| "full_attention", | |
| "full_attention", | |
| "full_attention", | |
| "full_attention", | |
| "full_attention", | |
| "full_attention", | |
| "full_attention", | |
| "full_attention", | |
| "full_attention", | |
| "full_attention", | |
| "full_attention", | |
| "full_attention", | |
| "full_attention", | |
| "full_attention", | |
| "full_attention", | |
| "full_attention", | |
| "full_attention", | |
| "full_attention", | |
| "full_attention", | |
| "full_attention", | |
| "full_attention", | |
| "full_attention", | |
| "full_attention", | |
| "full_attention", | |
| "full_attention", | |
| "full_attention", | |
| "full_attention", | |
| "full_attention", | |
| "full_attention", | |
| "full_attention", | |
| "full_attention", | |
| "full_attention", | |
| "full_attention" | |
| ], | |
| "max_position_embeddings": 128000, | |
| "max_window_layers": 70, | |
| "model_type": "qwen2_5_vl_text", | |
| "num_attention_heads": 16, | |
| "num_hidden_layers": 36, | |
| "num_key_value_heads": 2, | |
| "pad_token_id": 151654, | |
| "quantization_config": { | |
| "_load_in_4bit": true, | |
| "_load_in_8bit": false, | |
| "bnb_4bit_compute_dtype": "bfloat16", | |
| "bnb_4bit_quant_storage": "uint8", | |
| "bnb_4bit_quant_type": "nf4", | |
| "bnb_4bit_use_double_quant": true, | |
| "llm_int8_enable_fp32_cpu_offload": false, | |
| "llm_int8_has_fp16_weight": false, | |
| "llm_int8_skip_modules": [ | |
| "lm_head", | |
| "multi_modal_projector", | |
| "merger", | |
| "modality_projection", | |
| "model.layers.5.mlp", | |
| "visual.blocks.25.attn", | |
| "visual.merger.mlp", | |
| "visual.blocks.24.attn", | |
| "visual.blocks.29.attn", | |
| "visual.blocks.30.attn", | |
| "visual.blocks.26.attn", | |
| "visual.blocks.22.attn", | |
| "visual.blocks.31.attn", | |
| "visual.blocks.27.attn", | |
| "model.layers.30.mlp", | |
| "visual.blocks.30.mlp", | |
| "visual.blocks.28.attn", | |
| "visual.blocks.29.mlp", | |
| "visual.blocks.25.mlp", | |
| "visual.blocks.21.attn", | |
| "visual.blocks.18.attn", | |
| "visual.blocks.20.attn", | |
| "visual.blocks.26.mlp", | |
| "visual.blocks.16.attn", | |
| "visual.blocks.31.mlp", | |
| "visual.blocks.28.mlp", | |
| "visual.blocks.27.mlp", | |
| "visual.blocks.24.mlp", | |
| "visual.blocks.19.attn", | |
| "visual.blocks.23.mlp", | |
| "visual.blocks.19.mlp", | |
| "visual.blocks.17.attn", | |
| "visual.blocks.20.mlp", | |
| "visual.blocks.23.attn", | |
| "visual.blocks.13.attn", | |
| "visual.blocks.22.mlp", | |
| "visual.blocks.9.mlp", | |
| "visual.blocks.10.mlp", | |
| "visual.blocks.16.mlp", | |
| "visual.blocks.12.attn", | |
| "visual.blocks.18.mlp", | |
| "visual.blocks.21.mlp", | |
| "visual.blocks.6.mlp", | |
| "model.layers.1.mlp", | |
| "visual.blocks.14.attn", | |
| "visual.blocks.11.mlp", | |
| "visual.blocks.11.attn", | |
| "visual.blocks.9.attn", | |
| "model.layers.2.mlp", | |
| "visual.blocks.12.mlp", | |
| "visual.blocks.10.attn", | |
| "visual.blocks.6.attn", | |
| "visual.blocks.13.mlp", | |
| "visual.blocks.8.mlp", | |
| "visual.blocks.14.mlp", | |
| "visual.blocks.7.mlp", | |
| "visual.blocks.5.attn", | |
| "visual.blocks.8.attn", | |
| "visual.blocks.15.mlp", | |
| "visual.blocks.5.mlp", | |
| "visual.blocks.3.mlp", | |
| "visual.blocks.2.mlp", | |
| "visual.blocks.4.mlp", | |
| "visual.blocks.2.attn", | |
| "visual.blocks.7.attn", | |
| "visual.blocks.1.attn", | |
| "visual.blocks.17.mlp", | |
| "visual.blocks.15.attn", | |
| "visual.blocks.4.attn", | |
| "visual.blocks.1.mlp", | |
| "visual.blocks.0.attn", | |
| "visual.blocks.0.mlp", | |
| "visual.blocks.3.attn", | |
| "visual.blocks.31.mlp.down_proj" | |
| ], | |
| "llm_int8_threshold": 6.0, | |
| "load_in_4bit": true, | |
| "load_in_8bit": false, | |
| "quant_method": "bitsandbytes" | |
| }, | |
| "rms_norm_eps": 1e-06, | |
| "rope_scaling": { | |
| "mrope_section": [ | |
| 16, | |
| 24, | |
| 24 | |
| ], | |
| "rope_type": "default", | |
| "type": "default" | |
| }, | |
| "rope_theta": 1000000.0, | |
| "sliding_window": null, | |
| "tie_word_embeddings": true, | |
| "torch_dtype": "bfloat16", | |
| "unsloth_fixed": true, | |
| "use_cache": true, | |
| "use_sliding_window": false, | |
| "video_token_id": null, | |
| "vision_end_token_id": 151653, | |
| "vision_start_token_id": 151652, | |
| "vision_token_id": 151654, | |
| "vocab_size": 151936 | |
| }, | |
| "torch_dtype": "bfloat16", | |
| "transformers_version": "4.53.2", | |
| "unsloth_fixed": true, | |
| "unsloth_version": "2025.7.5", | |
| "use_cache": true, | |
| "use_sliding_window": false, | |
| "video_token_id": 151656, | |
| "vision_config": { | |
| "depth": 32, | |
| "fullatt_block_indexes": [ | |
| 7, | |
| 15, | |
| 23, | |
| 31 | |
| ], | |
| "hidden_act": "silu", | |
| "hidden_size": 1280, | |
| "in_channels": 3, | |
| "in_chans": 3, | |
| "initializer_range": 0.02, | |
| "intermediate_size": 3420, | |
| "model_type": "qwen2_5_vl", | |
| "num_heads": 16, | |
| "out_hidden_size": 2048, | |
| "patch_size": 14, | |
| "spatial_merge_size": 2, | |
| "spatial_patch_size": 14, | |
| "temporal_patch_size": 2, | |
| "tokens_per_second": 2, | |
| "torch_dtype": "bfloat16", | |
| "window_size": 112 | |
| }, | |
| "vision_end_token_id": 151653, | |
| "vision_start_token_id": 151652, | |
| "vision_token_id": 151654, | |
| "vocab_size": 151936 | |
| } |