Image-to-Text
PEFT
Safetensors
Oriya
odia
ocr
vision-language
qwen2-vl
lora
optical-character-recognition
Instructions to use shantipriya/odia-ocr-qwen-finetuned_v2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use shantipriya/odia-ocr-qwen-finetuned_v2 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, "shantipriya/odia-ocr-qwen-finetuned_v2") - Notebooks
- Google Colab
- Kaggle
Update README: training progress at step 5000/12387
Browse files
README.md
CHANGED
|
@@ -1,377 +1,88 @@
|
|
| 1 |
---
|
| 2 |
-
base_model: Qwen/Qwen2.5-VL-3B-Instruct
|
| 3 |
-
library_name: peft
|
| 4 |
-
pipeline_tag: image-to-text
|
| 5 |
language:
|
| 6 |
- or
|
|
|
|
| 7 |
tags:
|
| 8 |
-
- odia
|
| 9 |
- ocr
|
| 10 |
-
-
|
| 11 |
-
- lora
|
| 12 |
- qwen2.5-vl
|
| 13 |
- fine-tuned
|
| 14 |
-
-
|
| 15 |
-
-
|
| 16 |
-
license: apache-2.0
|
| 17 |
datasets:
|
| 18 |
- shantipriya/odia-ocr-merged
|
|
|
|
|
|
|
| 19 |
---
|
| 20 |
|
| 21 |
# Odia OCR — Qwen2.5-VL-3B Fine-tuned (v2)
|
| 22 |
|
| 23 |
-
|
| 24 |
-
Built on top of `Qwen/Qwen2.5-VL-3B-Instruct`, fine-tuned on 145K+ Odia word images.
|
| 25 |
-
|
| 26 |
-
---
|
| 27 |
|
| 28 |
-
##
|
| 29 |
|
| 30 |
-
|
|
| 31 |
-
|---|---|
|
| 32 |
| Base model | `Qwen/Qwen2.5-VL-3B-Instruct` |
|
| 33 |
-
|
|
| 34 |
-
|
|
| 35 |
-
|
|
| 36 |
-
|
|
| 37 |
-
|
|
| 38 |
-
|
|
| 39 |
-
|
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
|
| 50 |
-
|-
|
| 51 |
-
|
|
| 52 |
-
| checkpoint-4400 | 4400 | 36% | **68.0%** | **8.33%** |
|
| 53 |
-
|
| 54 |
-
> Training is ongoing (12,387 total steps). Results will be updated as training progresses.
|
| 55 |
-
|
| 56 |
-
### Error Analysis (checkpoint-4400, 50 test samples)
|
| 57 |
-
|
| 58 |
-
- **34/50 exact matches (68.0%)**
|
| 59 |
-
- **Mean CER: 8.33%** (improved from 9.60% at step 3600)
|
| 60 |
-
- Errors concentrated on visually similar Odia diacritic variants (e.g. `ଵ` vs `ବ`, `ଧ୍ଵ` vs `ଧ୍ୱ`)
|
| 61 |
-
- Numeric-only samples (e.g. `୫୨`) are handled perfectly
|
| 62 |
-
|
| 63 |
-
---
|
| 64 |
-
|
| 65 |
-
## Model Inference Results
|
| 66 |
-
|
| 67 |
-

|
| 68 |
-
|
| 69 |
-
Sample predictions from checkpoint-4400 on 10 test images:
|
| 70 |
-
|
| 71 |
-
| # | Image | Ground Truth | Predicted | Match | CER |
|
| 72 |
-
|---|---|---|---|---|---|
|
| 73 |
-
| 1 |  | ଚଳେଇବାପାଇଁ | ଚଳେଇବାପାଇଁ | ✅ | 0.0% |
|
| 74 |
-
| 2 |  | ପୁନର୍ନଭା | ପୁନର୍ନଭା | ✅ | 0.0% |
|
| 75 |
-
| 3 |  | ଟ୍ରଷ୍ଟର | ଟୁଷ୍ଟର | ⚠️ | 23.1% |
|
| 76 |
-
| 4 |  | ସୀମାର | ସୀମାର | ✅ | 0.0% |
|
| 77 |
-
| 5 |  | ଟ୍ୟୁବରକୁଲୋସିସ | ଟ୍ୟୁବଲକୁଲୋସିସ | ⚠️ | 7.7% |
|
| 78 |
-
| 6 |  | ଟ୍ରାନ୍ସଭର୍ସସ | ଟ୍ରାନ୍ସଭର୍ସ | ⚠️ | 4.4% |
|
| 79 |
-
| 7 |  | ପ୍ଲାଜ୍ମାରେ | ପ୍ଲାଜ୍ମାରେ | ✅ | 0.0% |
|
| 80 |
-
| 8 |  | ଖଣ୍ଡଗିରିରେ | ଖଣ୍ଡଗିରିରେ | ✅ | 0.0% |
|
| 81 |
-
| 9 |  | ହାଇପରଆନିମିଆ | ହାଇପରଆନିମିଆ | ✅ | 0.0% |
|
| 82 |
-
| 10 |  | ହୋଇଯାନ୍ତି | ହୋଇଯାଆନ୍ତି | ⚠️ | 5.3% |
|
| 83 |
-
|
| 84 |
-
**10-sample summary:** 7/10 exact match, mean CER 4.0%
|
| 85 |
-
|
| 86 |
-
---
|
| 87 |
|
| 88 |
## Usage
|
| 89 |
|
| 90 |
-
### Quick Inference
|
| 91 |
-
|
| 92 |
```python
|
| 93 |
-
import torch
|
| 94 |
-
from PIL import Image
|
| 95 |
from transformers import AutoProcessor, Qwen2_5_VLForConditionalGeneration
|
| 96 |
from peft import PeftModel
|
| 97 |
-
|
|
|
|
| 98 |
|
| 99 |
-
|
| 100 |
-
ADAPTER
|
| 101 |
|
| 102 |
-
processor = AutoProcessor.from_pretrained(
|
| 103 |
model = Qwen2_5_VLForConditionalGeneration.from_pretrained(
|
| 104 |
-
|
| 105 |
)
|
| 106 |
model = PeftModel.from_pretrained(model, ADAPTER)
|
| 107 |
-
model.eval()
|
| 108 |
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
)
|
| 118 |
-
|
| 119 |
-
inputs = processor(
|
| 120 |
-
text=[text_input], images=image_inputs, return_tensors="pt"
|
| 121 |
-
).to(model.device)
|
| 122 |
-
with torch.no_grad():
|
| 123 |
-
out = model.generate(**inputs, max_new_tokens=128, do_sample=False)
|
| 124 |
-
return processor.decode(
|
| 125 |
-
out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True
|
| 126 |
-
).strip()
|
| 127 |
-
|
| 128 |
-
print(ocr("your_odia_image.png"))
|
| 129 |
```
|
| 130 |
|
| 131 |
-
### Install Dependencies
|
| 132 |
-
|
| 133 |
-
```bash
|
| 134 |
-
pip install transformers peft accelerate qwen-vl-utils torch pillow
|
| 135 |
-
```
|
| 136 |
-
|
| 137 |
-
---
|
| 138 |
-
|
| 139 |
-
## Training Details
|
| 140 |
-
|
| 141 |
-
### Dataset
|
| 142 |
-
|
| 143 |
-
- **Source:** [shantipriya/odia-ocr-merged](https://huggingface.co/datasets/shantipriya/odia-ocr-merged)
|
| 144 |
-
- **Size:** 145,000+ word-level OCR samples
|
| 145 |
-
- **Format:** image → Odia Unicode text pairs
|
| 146 |
-
- **Word length:** 3–20 characters per sample
|
| 147 |
-
|
| 148 |
-
### LoRA Configuration
|
| 149 |
-
|
| 150 |
-
```python
|
| 151 |
-
LoraConfig(
|
| 152 |
-
r=128,
|
| 153 |
-
lora_alpha=256,
|
| 154 |
-
target_modules=[
|
| 155 |
-
"q_proj", "k_proj", "v_proj", "o_proj",
|
| 156 |
-
"gate_proj", "up_proj", "down_proj"
|
| 157 |
-
],
|
| 158 |
-
lora_dropout=0.05,
|
| 159 |
-
bias="none",
|
| 160 |
-
task_type="CAUSAL_LM",
|
| 161 |
-
)
|
| 162 |
-
```
|
| 163 |
-
|
| 164 |
-
### Training Hyperparameters
|
| 165 |
-
|
| 166 |
-
| Parameter | Value |
|
| 167 |
-
|---|---|
|
| 168 |
-
| Per-device batch size | 4 |
|
| 169 |
-
| Gradient accumulation steps | 4 (effective batch = 16) |
|
| 170 |
-
| Learning rate | 2e-4 |
|
| 171 |
-
| LR scheduler | Cosine |
|
| 172 |
-
| Warmup steps | 100 |
|
| 173 |
-
| Total steps | 12,387 |
|
| 174 |
-
| Optimizer | AdamW (bf16) |
|
| 175 |
-
| Hardware | NVIDIA H100 80 GB |
|
| 176 |
-
|
| 177 |
-
---
|
| 178 |
-
|
| 179 |
## Limitations
|
| 180 |
|
| 181 |
-
-
|
| 182 |
-
-
|
| 183 |
-
-
|
| 184 |
-
- Performance improves as training continues toward 12,387 total steps
|
| 185 |
-
|
| 186 |
-
---
|
| 187 |
|
| 188 |
-
##
|
| 189 |
|
| 190 |
-
``
|
| 191 |
-
@misc{odia-ocr-qwen-v2-2026,
|
| 192 |
-
title = {Odia OCR Fine-tuned Qwen2.5-VL-3B (v2)},
|
| 193 |
-
author = {Shantipriya Parida},
|
| 194 |
-
year = {2026},
|
| 195 |
-
url = {https://huggingface.co/shantipriya/odia-ocr-qwen-finetuned_v2}
|
| 196 |
-
}
|
| 197 |
-
```
|
| 198 |
-
|
| 199 |
-
---
|
| 200 |
|
| 201 |
-
##
|
| 202 |
-
|
| 203 |
-
- Base model: [Qwen/Qwen2.5-VL-3B-Instruct](https://huggingface.co/Qwen/Qwen2.5-VL-3B-Instruct)
|
| 204 |
-
- Dataset: [shantipriya/odia-ocr-merged](https://huggingface.co/datasets/shantipriya/odia-ocr-merged)
|
| 205 |
-
- OdiaGenAI copy: [OdiaGenAIOCR/odia-ocr-qwen-finetuned](https://huggingface.co/OdiaGenAIOCR/odia-ocr-qwen-finetuned)
|
| 206 |
-
|
| 207 |
-
---
|
| 208 |
-
|
| 209 |
-
### Framework Versions
|
| 210 |
-
|
| 211 |
-
- PEFT 0.18.1
|
| 212 |
-
- Transformers >= 4.48.0
|
| 213 |
-
- PyTorch >= 2.5.0 (CUDA 12.4)
|
| 214 |
-
|
| 215 |
-
## 📄 Paragraph OCR Samples
|
| 216 |
-
|
| 217 |
-
Samples from [OdiaGenAIOCR/Odia-lipi-ocr-data](https://huggingface.co/datasets/OdiaGenAIOCR/Odia-lipi-ocr-data).
|
| 218 |
-
Each shows the original paragraph image, the ground truth, and the model's extracted text.
|
| 219 |
-
|
| 220 |
-
### ⚠️ Current Limitation — Paragraph OCR
|
| 221 |
-
|
| 222 |
-
The current fine-tune (checkpoint-4800) was trained **exclusively on word-level crops**
|
| 223 |
-
from `shantipriya/odia-ocr-merged` (~145K samples, each containing 1–3 Odia words).
|
| 224 |
-
This means:
|
| 225 |
-
|
| 226 |
-
| Issue | Cause |
|
| 227 |
-
|---|---|
|
| 228 |
-
| Model outputs short fragments | Training distribution = short strings → model stops early |
|
| 229 |
-
| Hallucinated text | Full-page images are out-of-distribution; model generates plausible-but-wrong Odia |
|
| 230 |
-
| Even tiled strips fail | A 400 px strip (~5 text lines) is still OOD for a word-crop OCR model |
|
| 231 |
-
|
| 232 |
-
**Fix (Phase 3):** `train_mixed_para_word.py` mixes 20 % paragraph samples from
|
| 233 |
-
`OdiaGenAIOCR/Odia-lipi-ocr-data` with 80 % word samples and warm-starts from
|
| 234 |
-
checkpoint-4800. This teaches the model to recognise multi-line input as a cue to
|
| 235 |
-
generate longer output.
|
| 236 |
-
|
| 237 |
-
---
|
| 238 |
-
|
| 239 |
-
### Sample 1 — index 14 (1477×2126 px)
|
| 240 |
-
|
| 241 |
-
<img src="https://huggingface.co/shantipriya/odia-ocr-qwen-finetuned_v2/resolve/main/assets/para_sample_1.png" width="380" alt="Paragraph sample 1">
|
| 242 |
-
|
| 243 |
-
**Ground truth** (excerpt, 1203 chars):
|
| 244 |
-
```
|
| 245 |
-
ବାଳକକ୍ଷା
|
| 246 |
-
ଗୋଶୃଙ୍ଗ ନଖ କେଶୈସ୍ତୁ ଧୂପତ୍ୟେଦ୍ୱାଳକଂ ତତଃ।
|
| 247 |
-
ମଗ୍ନ ସ୍ନାନାୟକଂ ସବଂ ପ୍ରଥମେ ଧ୍ରୁବମେଣ ବୈ॥
|
| 248 |
-
|
| 249 |
-
ନବମ ଦିବସ ବାଇ ରକ୍ଷା
|
| 250 |
-
ନବମେ ଦିବସେ କାଳୀ ମେତା ଗୃଦ୍ଘାତ ବୈ ଶିଶୁ।
|
| 251 |
-
ତଇଷ୍ଟ୍ରା ୱାସନୋଦ୍ଦେ ଶଃ ସ୍ୱମୁଷ୍ଟି ଦ୍ବସ୍ତ ଖାଦନ॥
|
| 252 |
-
ବଗ୍ଧ ଚନ୍ଦନ କୁଷ୍ଠୋସ୍ଥା ସର୍ବପି ହ୍ରଦୟେ ଲେପଭୂ।
|
| 253 |
-
ନଖ ବାନର ଛେମ୍ମାଦ ଧୂପ ଯେଓ ସ।
|
| 254 |
-
|
| 255 |
-
ଦଶମ ଦିବସ ବାଇ ରକ୍ଷା
|
| 256 |
-
ଦଶମେ ଦିବସେ ନାମ୍ନୀ ଶ୍ୱେଦନା ନମତେ ଶଂ।
|
| 257 |
-
ଉତ୍ତିଷ୍ଠ ଜ୍ୱର କହନଂ ରୌଦ୍ର ବେଦନଂ ମୁଷ୍ଟି କନ୍ଧନଂ॥
|
| 258 |
-
କୁଷ୍ଠୋଗ ସକ୍ତ ସିଦ୍ଧାର୍ଥି ଲଖେଳ କମ୍ବେନ ଧୂ...
|
| 259 |
-
```
|
| 260 |
-
|
| 261 |
-
**Model output** (text coverage ≈ 9% with strip tiling — improving in Phase 3):
|
| 262 |
-
```
|
| 263 |
-
ତଳବେ
|
| 264 |
-
ନଦେଲାସିଛା
|
| 265 |
-
ବୁଝାଏଇଥିଲା
|
| 266 |
-
ଚେଳମିଠାଚିଲକିହେବାରେପଡ଼ିଲା।ଯାଉଛିନେତାଙ୍କନାଥିବାର
|
| 267 |
-
ରାବୁତିଦେଓ
|
| 268 |
-
ବାଣିଜ୍ଯକୁଣ୍ଡମାନଙ୍କାଳକୁରାଜାତାଃ,ସଂରକ୍ଷଣ
|
| 269 |
-
```
|
| 270 |
-
|
| 271 |
-
---
|
| 272 |
-
|
| 273 |
-
### Sample 2 — index 3 (1418×2186 px)
|
| 274 |
-
|
| 275 |
-
<img src="https://huggingface.co/shantipriya/odia-ocr-qwen-finetuned_v2/resolve/main/assets/para_sample_2.png" width="380" alt="Paragraph sample 2">
|
| 276 |
-
|
| 277 |
-
**Ground truth** (excerpt, 1099 chars):
|
| 278 |
-
```
|
| 279 |
-
ସୂଚିପତ୍ର
|
| 280 |
-
|
| 281 |
-
ବିଷୟ ପୃଷ୍ଠଙ୍କ
|
| 282 |
-
୧ । ମାତୃସ୍ତବ ୧
|
| 283 |
-
୨ । ଶରଣ ୪
|
| 284 |
-
୩ । ଗୋଟିଏ ପ୍ରାର୍ଥନା ୬
|
| 285 |
-
୪ । କୃଟକ ୮
|
| 286 |
-
୫ । ମୌନୀ ୧୦
|
| 287 |
-
୬ । ବଞ୍ଚି ମୁଁ ରହିବ ଆଉ କେଉଁ
|
| 288 |
-
ସୁଖ ଆଶେ ? ୧୧
|
| 289 |
-
୭ । କପୋତ କପୋତୀ ୧୩
|
| 290 |
-
୮ । ବୃକ୍ଷବଟିକା ୧୪
|
| 291 |
-
୯ । ଜାପାନ ରୁଷ ୧୬
|
| 292 |
-
୧୦ । ମୋ—ମୋହନବଂଶୀ ୧୮
|
| 293 |
-
୧୧ । ଯୁଗ୍ମ କୁସୁମ ୨୦
|
| 294 |
-
୧୨ । ମୁଁ ୨୨
|
| 295 |
-
୧୩ । କ୍ଷଣିକ ୨୪
|
| 296 |
-
୧୪ । ମନ ଉଚ୍ଚାଟନ ୨୫
|
| 297 |
-
୧୫ । ଭଣ୍ତ ସନ୍ନ୍ଯାସୀ ୨୬
|
| 298 |
-
୧୬ । ସୁଖ ଦୁଃଖର ପରିଣାମ ୨୮
|
| 299 |
-
୧୭ । ମେଲାଣି ୨୯
|
| 300 |
-
୧୮ । କବିତା ସାନ୍ତୁନା ୩୦
|
| 301 |
-
୧୯ । ସ୍ବପ୍ନ ଦେବୀ ୩୧
|
| 302 |
-
୨୦ ।...
|
| 303 |
-
```
|
| 304 |
-
|
| 305 |
-
**Model output** (text coverage ≈ 4% with strip tiling — improving in Phase 3):
|
| 306 |
-
```
|
| 307 |
-
ସଂପତ୍ର
|
| 308 |
-
ବଚ୍ଚୁ
|
| 309 |
-
କାମେସ
|
| 310 |
-
ମେ-ମେଚେଦଶ
|
| 311 |
-
ବୁଝିଛାଏ
|
| 312 |
-
୨୩ମୂର୍ତ୍ତି
|
| 313 |
-
```
|
| 314 |
-
|
| 315 |
-
---
|
| 316 |
-
|
| 317 |
-
### Sample 3 — index 35 (945×1654 px)
|
| 318 |
-
|
| 319 |
-
<img src="https://huggingface.co/shantipriya/odia-ocr-qwen-finetuned_v2/resolve/main/assets/para_sample_3.png" width="380" alt="Paragraph sample 3">
|
| 320 |
-
|
| 321 |
-
**Ground truth** (excerpt, 569 chars):
|
| 322 |
-
```
|
| 323 |
-
-BABU GIRISH CHANDRA BASU. M. A.
|
| 324 |
-
» BYOMKESH CHAKRAVERTY. M. A.
|
| 325 |
-
|
| 326 |
-
Dear Sirs,
|
| 327 |
-
• With sentiments of deep respect and affection
|
| 328 |
-
I beg to inscribe this treatise on Agriculture to
|
| 329 |
-
you in appreciation of the noble zeal which ani-
|
| 330 |
-
mated you to acquire knowledge of the useful
|
| 331 |
-
science of Agriculture in spite of the perils of
|
| 332 |
-
the sea and thereby to render important service
|
| 333 |
-
to this country by bringing your sci...
|
| 334 |
-
```
|
| 335 |
-
|
| 336 |
-
**Model output** (text coverage ≈ 11% with strip tiling — improving in Phase 3):
|
| 337 |
-
```
|
| 338 |
-
ବାରୁସ୍ଥଳିଚାର୍ଯ୍ୟ
|
| 339 |
-
ବାବୁଗିବିଶଚନ୍ଦ୍ରବାସୁ.ମାଆ
|
| 340 |
-
ଯୁନାିଗ୍ରାଫି
|
| 341 |
-
ଯୁସ୍,
|
| 342 |
-
ସୁଜନି
|
| 343 |
-
```
|
| 344 |
-
|
| 345 |
-
---
|
| 346 |
-
|
| 347 |
-
### Sample 4 — index 31 (1024×1654 px)
|
| 348 |
-
|
| 349 |
-
<img src="https://huggingface.co/shantipriya/odia-ocr-qwen-finetuned_v2/resolve/main/assets/para_sample_4.png" width="380" alt="Paragraph sample 4">
|
| 350 |
-
|
| 351 |
-
**Ground truth** (excerpt, 821 chars):
|
| 352 |
-
```
|
| 353 |
-
[1]
|
| 354 |
-
ଦ୍ଵିତୀୟ ପ♦ ଉତ୍ତୋଳନ ।
|
| 355 |
-
( ଶୀତର ସଭାଗୃହସ୍ଥ ୟୁଷ୍ପଷ୍ଠିଭ, ଭୀମ, ନକୁଲ, ସହଦେବ ସାଈ
|
| 356 |
-
ନେକ୍ସରେ ଅଧେ।ବଦନରେ ଦଣ୍ଡାମାନ )
|
| 357 |
-
ଯୁଷ୍ପଷ୍ଠିର ।— ଅହୋ ! ଅଳ୍ପ କ ଦୁର୍ଯୋଗ ଉପସ୍ଥିତ ମୋହର
|
| 358 |
-
ଊର୍ଦ୍ଧ୍ଵ ଜୀବନ କାନ୍ଥ କ ଶସ୍ତ୍ର ଭଗକରୁନାQ” ।
|
| 359 |
-
ଅଜ ମୋହର ପ୍ରାଣ ରୁ ପ୍ରି ପୂତମ ସୁ ଭଦ୍ରାକୁମ→
|
| 360 |
-
ଅଉ ଏ ସଂସାରେ ନାହାଈ । ମୁଁ ଭଣ୍ଡାଲ, ସେହ
|
| 361 |
-
ଶିଶୁକ୍ଷକ ଏଡେ ଗୁ ବ୍ଲୁଭର କର୍ମ ସାଧନରେ କାଉଁ’କ
|
| 362 |
-
ଜ��ୁକ୍ତ କଲ । ଅଳ ମୋଠାରୁ ନୃଶଂସ, ଋଣ୍ଡାଲ;
|
| 363 |
-
ପାପିଷ୍ଠ, ନଗ୍ଧମ, ସ୍ଵକ୍ଷସ ଏ.ମନ୍ତ୍ରୀ ମଣ୍ଡଲରେ ନାହାଈ ।
|
| 364 |
-
ଯ...
|
| 365 |
-
```
|
| 366 |
-
|
| 367 |
-
**Model output** (text coverage ≈ 15% with strip tiling — improving in Phase 3):
|
| 368 |
-
```
|
| 369 |
-
ଦୃଶ୍ୟପଟଳାଳନା
|
| 370 |
-
ଶାବ୍କଚାର୍ଯ୍ୟାଦ୍ୟକାର,ଜାମ,ନକଳା,ହୁଏବାର
|
| 371 |
-
ଶ୍ରିବିଜ୍ଯକୁଣ୍ଠାନ୍ତାଙ୍କୁଣ୍ଡା
|
| 372 |
-
ସମାବର୍ତ୍ତେଆସାଇଏଛିଓକୁଛାନାଳୁ
|
| 373 |
-
ବରୁଏଶାମୋରଚ୍ଛିଦରୁହକରିଥିଲା
|
| 374 |
-
```
|
| 375 |
-
|
| 376 |
-
---
|
| 377 |
|
|
|
|
|
|
| 1 |
---
|
|
|
|
|
|
|
|
|
|
| 2 |
language:
|
| 3 |
- or
|
| 4 |
+
license: apache-2.0
|
| 5 |
tags:
|
|
|
|
| 6 |
- ocr
|
| 7 |
+
- odia
|
|
|
|
| 8 |
- qwen2.5-vl
|
| 9 |
- fine-tuned
|
| 10 |
+
- vision-language
|
| 11 |
+
- lora
|
|
|
|
| 12 |
datasets:
|
| 13 |
- shantipriya/odia-ocr-merged
|
| 14 |
+
base_model: Qwen/Qwen2.5-VL-3B-Instruct
|
| 15 |
+
pipeline_tag: image-text-to-text
|
| 16 |
---
|
| 17 |
|
| 18 |
# Odia OCR — Qwen2.5-VL-3B Fine-tuned (v2)
|
| 19 |
|
| 20 |
+
Fine-tuned **Qwen2.5-VL-3B-Instruct** for Odia-script OCR using LoRA on 145 K word-level crops from the merged Odia OCR dataset.
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
+
## Training Progress 🏃
|
| 23 |
|
| 24 |
+
| Metric | Value |
|
| 25 |
+
|--------|-------|
|
| 26 |
| Base model | `Qwen/Qwen2.5-VL-3B-Instruct` |
|
| 27 |
+
| Dataset | `shantipriya/odia-ocr-merged` (145 K samples) |
|
| 28 |
+
| Total planned steps | 12,387 |
|
| 29 |
+
| **Current step** | **5,000 / 12,387 (40%)** |
|
| 30 |
+
| Current epoch | 1.2 |
|
| 31 |
+
| Latest loss | ~4.78 |
|
| 32 |
+
| Saved checkpoints | 3200 · 4800 · **5000** |
|
| 33 |
+
| Strategy | LoRA r=64 α=128, bf16, batch=4×4=16 eff |
|
| 34 |
+
| Hardware | 1× H100 80 GB |
|
| 35 |
+
|
| 36 |
+
> Training is ongoing. This repo holds the **checkpoint-5000** weights as the latest stable snapshot.
|
| 37 |
+
|
| 38 |
+
## Checkpoints
|
| 39 |
+
|
| 40 |
+
| Checkpoint | Step | Notes |
|
| 41 |
+
|------------|------|-------|
|
| 42 |
+
| `checkpoint-3200` | 3200 | Early stage |
|
| 43 |
+
| `checkpoint-4800` | 4800 | ~38% complete |
|
| 44 |
+
| `checkpoint-5000` | 5000 | **Latest pushed** — 40% complete |
|
| 45 |
+
| *(final)* | ~12387 | ~2 epochs |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
|
| 47 |
## Usage
|
| 48 |
|
|
|
|
|
|
|
| 49 |
```python
|
|
|
|
|
|
|
| 50 |
from transformers import AutoProcessor, Qwen2_5_VLForConditionalGeneration
|
| 51 |
from peft import PeftModel
|
| 52 |
+
import torch
|
| 53 |
+
from PIL import Image
|
| 54 |
|
| 55 |
+
BASE = "Qwen/Qwen2.5-VL-3B-Instruct"
|
| 56 |
+
ADAPTER = "shantipriya/odia-ocr-qwen-finetuned_v2"
|
| 57 |
|
| 58 |
+
processor = AutoProcessor.from_pretrained(BASE, trust_remote_code=True)
|
| 59 |
model = Qwen2_5_VLForConditionalGeneration.from_pretrained(
|
| 60 |
+
BASE, torch_dtype=torch.float16, device_map="auto", trust_remote_code=True
|
| 61 |
)
|
| 62 |
model = PeftModel.from_pretrained(model, ADAPTER)
|
|
|
|
| 63 |
|
| 64 |
+
image = Image.open("odia_word_crop.png").convert("RGB")
|
| 65 |
+
messages = [{"role": "user", "content": [
|
| 66 |
+
{"type": "image", "image": image},
|
| 67 |
+
{"type": "text", "text": "Extract the Odia text from this image. Return only the text."},
|
| 68 |
+
]}]
|
| 69 |
+
text = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
| 70 |
+
inputs = processor(images=[image], text=[text], return_tensors="pt").to(model.device)
|
| 71 |
+
with torch.no_grad():
|
| 72 |
+
out = model.generate(**inputs, max_new_tokens=64, temperature=0.1, do_sample=False)
|
| 73 |
+
print(processor.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
```
|
| 75 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
## Limitations
|
| 77 |
|
| 78 |
+
- Trained on **word-level** crops → best accuracy on individual words/short lines
|
| 79 |
+
- Paragraph / full-page OCR: outputs only 4–16% of text (known limitation)
|
| 80 |
+
- **Phase 3** (mixed word + paragraph training) is planned after the current run completes
|
|
|
|
|
|
|
|
|
|
| 81 |
|
| 82 |
+
## Dataset
|
| 83 |
|
| 84 |
+
`shantipriya/odia-ocr-merged` — 145 K curated Odia word crops with ground-truth labels.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
|
| 86 |
+
## License
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
|
| 88 |
+
Apache 2.0
|