sarcasticcoder/cord-extraction-lora
Viewer • Updated • 220 • 384
How to use sarcasticcoder/qwen2.5-vl-7b-cord-lora with PEFT:
from peft import PeftModel
from transformers import AutoModelForCausalLM
base_model = AutoModelForCausalLM.from_pretrained("unsloth/qwen2.5-vl-7b-instruct-unsloth-bnb-4bit")
model = PeftModel.from_pretrained(base_model, "sarcasticcoder/qwen2.5-vl-7b-cord-lora")QLoRA adapter that fine-tunes Qwen/Qwen2.5-VL-7B-Instruct to read a document image and emit structured JSON (receipt fields + line items), trained on a small CORD subset.
Qwen/Qwen2.5-VL-7B-Instruct| Field EM | Field F1 | Line-item F1 | |
|---|---|---|---|
| Zero-shot v3 prompt | 0.869 | 0.834 | 0.934 |
| This LoRA | 0.865 | 0.830 | 0.957 |
Matches the already-strong prompt baseline on fields and lifts line-item F1 +0.02.
from peft import PeftModel
from transformers import Qwen2_5_VLForConditionalGeneration, AutoProcessor
base = Qwen2_5_VLForConditionalGeneration.from_pretrained("Qwen/Qwen2.5-VL-7B-Instruct", device_map="auto")
model = PeftModel.from_pretrained(base, "sarcasticcoder/qwen2.5-vl-7b-cord-lora")
proc = AutoProcessor.from_pretrained("Qwen/Qwen2.5-VL-7B-Instruct")
Base model
Qwen/Qwen2.5-VL-7B-Instruct