Qwen2-VL-2B Arabic OCR (LoRA adapter)

LoRA adapter for Qwen2-VL-2B-Instruct, fine-tuned on 300 samples from the KITAB-Bench synthesizear subset. This is a small-scale learning project and not an official KITAB-Bench result.

Results

CER WER
Base, in-domain 0.349 0.589
LoRA, in-domain 0.043 0.167
Base, out-of-domain 0.873 0.950
LoRA, out-of-domain 0.691 0.840

In-domain: 30 held-out samples from arocrbench_synthesizear. Out-of-domain: 30 samples from arocrbench_hindawi. Scores use KITAB-Bench's Arabic text normalization and jiwer.

Training details

  • LoRA r=16, alpha=32, dropout 0.05 on attention and MLP projections (18.5M trainable parameters)
  • 300 training samples, 1 epoch (38 steps), learning rate 1e-4, effective batch size 8
  • fp16 on a Tesla T4; loss computed on answer tokens only
  • Prompt: "Extract the text in the image. Give me the final text, nothing else."

How to use

import torch
from transformers import Qwen2VLForConditionalGeneration, AutoProcessor
from peft import PeftModel

base = Qwen2VLForConditionalGeneration.from_pretrained(
    "Qwen/Qwen2-VL-2B-Instruct", torch_dtype=torch.float16, device_map="auto"
)
model = PeftModel.from_pretrained(base, "YOUR-USERNAME/qwen2vl-arabic-ocr-lora")
processor = AutoProcessor.from_pretrained("Qwen/Qwen2-VL-2B-Instruct")

For a full inference example, see the notebook in the GitHub repo.

Limitations

  • Tiny test sets (30 samples each) and a single run, so treat results as indicative only
  • The in-domain test is synthetic text matching the training distribution
  • Out-of-domain performance on book pages is still weak
  • KITAB-Bench evaluates 7B models; this is a 2B model, so numbers are not comparable with the paper

Credits

KITAB-Bench (Heakl et al., MBZUAI-Oryx), Qwen2-VL (Alibaba), Hugging Face Transformers and PEFT.

Framework versions

  • PEFT 0.21.2
Downloads last month
-
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for moneebaa/qwen2vl-arabic-ocr-lora

Base model

Qwen/Qwen2-VL-2B
Adapter
(206)
this model