Downloads · 30 days
8
10% of all-time downloads
graahand/qwen-vl-2b-lora
qwen-vl-2b-lora is a image-text-to-text model from graahand. Use it for the image-text-to-text task on the model card, and read the license before you ship it in a product. It is set up for peft.
LoRA adapter fine-tuned for OCR-style key-value extraction from document images.
Downloads · 30 days
8
10% of all-time downloads
All-time downloads
80
Public
Repo size
49.1 MB
Likes
1
Public
Click a slice to open those files.
.safetensors34.9 MB · 69%
From the Hugging Face model README
LoRA adapter fine-tuned for OCR-style key-value extraction from document images.
Use this adapter with the base model for document OCR and key-value extraction.
from transformers import AutoProcessor, AutoModelForVision2Seq
from peft import PeftModel
from PIL import Image
import torch
base_id = "Qwen/Qwen3-VL-2B-Instruct"
adapter_id = "graahand/qwen-vl-2b-lora"
model = AutoModelForVision2Seq.from_pretrained(base_id, device_map="auto")
model = PeftModel.from_pretrained(model, adapter_id)
processor = AutoProcessor.from_pretrained(adapter_id, trust_remote_code=True)
image = Image.open("your_image.png").convert("RGB")
messages = [
{"role": "system", "content": "You are a helpful assistant."},
{
"role": "user",
"content": [
{"type": "image"},
{"type": "text", "text": "Extract all key-value pairs from this document."},
],
},
]
prompt = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = processor(text=[prompt], images=[image], return_tensors="pt").to(model.device)
with torch.no_grad():
out = model.generate(**inputs, max_new_tokens=128)
print(processor.tokenizer.decode(out[0], skip_special_tokens=True))
Custom OCR dataset with lines formatted as:
image_path<TAB>key: value
No formal benchmark metrics reported yet.
LoRA adapter for Qwen/Qwen3-VL-2B-Instruct for image-text-to-text generation.
[More Information Needed]