Image-Text-to-Text
PEFT
Safetensors
Transformers
qwen2_5_vl
lora
ocr
multilingual
government-id
qwen2.5-vl
conversational
text-generation-inference
Instructions to use Chhagan005/Chhagan_ML-VL-OCR-v1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use Chhagan005/Chhagan_ML-VL-OCR-v1 with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2.5-VL-3B-Instruct") model = PeftModel.from_pretrained(base_model, "Chhagan005/Chhagan_ML-VL-OCR-v1") - Transformers
How to use Chhagan005/Chhagan_ML-VL-OCR-v1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="Chhagan005/Chhagan_ML-VL-OCR-v1") 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, AutoModelForImageTextToText processor = AutoProcessor.from_pretrained("Chhagan005/Chhagan_ML-VL-OCR-v1") model = AutoModelForImageTextToText.from_pretrained("Chhagan005/Chhagan_ML-VL-OCR-v1") 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
- vLLM
How to use Chhagan005/Chhagan_ML-VL-OCR-v1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Chhagan005/Chhagan_ML-VL-OCR-v1" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Chhagan005/Chhagan_ML-VL-OCR-v1", "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/Chhagan005/Chhagan_ML-VL-OCR-v1
- SGLang
How to use Chhagan005/Chhagan_ML-VL-OCR-v1 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 "Chhagan005/Chhagan_ML-VL-OCR-v1" \ --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": "Chhagan005/Chhagan_ML-VL-OCR-v1", "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 "Chhagan005/Chhagan_ML-VL-OCR-v1" \ --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": "Chhagan005/Chhagan_ML-VL-OCR-v1", "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 Chhagan005/Chhagan_ML-VL-OCR-v1 with Docker Model Runner:
docker model run hf.co/Chhagan005/Chhagan_ML-VL-OCR-v1
Chhagan_ML-VL-OCR-v1
Multilingual OCR model for government ID cards, fine-tuned with LoRA on Qwen2.5-VL-3B.
Supported Documents
- 🇴🇲 Oman Resident Card
- 🇦🇪 UAE Identity Card
- 🇸🇦 Saudi National ID
- 🇮🇳 Aadhaar Card, PAN Card, Passport
- 🇿🇦 South Africa ID
Languages
English, Arabic (عربي), Hindi (हिन्दी), Urdu (اردو)
Usage
Option 1: Load as LoRA Adapter (~74MB download)
from transformers import Qwen2_5_VLForConditionalGeneration, AutoProcessor
from peft import PeftModel
base = Qwen2_5_VLForConditionalGeneration.from_pretrained("Qwen/Qwen2.5-VL-3B-Instruct")
model = PeftModel.from_pretrained(base, "Chhagan005/Chhagan_ML-VL-OCR-v1")
processor = AutoProcessor.from_pretrained("Chhagan005/Chhagan_ML-VL-OCR-v1")
Option 2: Load as Standalone Model (~4.4GB download)
from transformers import Qwen2_5_VLForConditionalGeneration, AutoProcessor
model = Qwen2_5_VLForConditionalGeneration.from_pretrained(
"Chhagan005/Chhagan_ML-VL-OCR-v1",
torch_dtype=torch.float16, device_map="auto"
)
processor = AutoProcessor.from_pretrained("Chhagan005/Chhagan_ML-VL-OCR-v1")
Training
- Base: Qwen/Qwen2.5-VL-3B-Instruct
- Method: LoRA (r=32, α=64)
- Data: Synthetic IDs + ANETAC Arabic names + Ara-Eng Parallel Corpus
- Focus: OCR extraction from government identity documents
- Downloads last month
- -