Downloads · 30 days
4
6% of all-time downloads
outxci/lfm2.5-vl-450m-extract-ja-receipt-lora
lfm2.5-vl-450m-extract-ja-receipt-lora is a image-text-to-text model from outxci. 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. The card lists the license as other.
LoRA adapter that teaches LiquidAI/LFM2.5-VL-450M-Extract to extract structured fields from Japanese receipts (店名・日付・時刻・合計・税額・品目リスト).
Downloads · 30 days
4
6% of all-time downloads
All-time downloads
64
Public
Repo size
86 MB
Likes
0
Public
Click a slice to open those files.
.safetensors86 MB · 100%
From the Hugging Face model README
LoRA adapter that teaches LiquidAI/LFM2.5-VL-450M-Extract to extract structured fields from Japanese receipts (店名・日付・時刻・合計・税額・品目リスト).
The base model is a strong structured-extraction VLM but struggles severely with Japanese (CJK) text. This adapter fixes that for the receipt domain — trained in 41 minutes on 3× RTX 3090.
Evaluated on 200 held-out real receipts from llm-jp/jawildtext receipt_kie (never seen in training). Exact match / character similarity:
| Field | Base model | + this LoRA |
|---|---|---|
| Valid JSON | 120/200 | 192/200 |
| store_name | 3/200 (sim 0.224) | 20/200 (sim 0.556) |
| date | 35/200 (sim 0.485) | 172/200 (sim 0.946) |
| time | 78/200 (sim 0.496) | 159/200 (sim 0.878) |
| total_amount | 2/200 (sim 0.392) | 167/200 (sim 0.914) |
| tax_amount | 9/200 (sim 0.209) | 139/200 (sim 0.804) |
| line-item name F1 | 0.000 | 0.094 |
On out-of-distribution real receipt photos the base model frequently hallucinates totals and degenerates into repetition loops; with this adapter, totals / dates / item structure become reliable.
import torch
from transformers import AutoModelForImageTextToText, AutoProcessor
from peft import PeftModel
from PIL import Image
BASE = "LiquidAI/LFM2.5-VL-450M-Extract"
processor = AutoProcessor.from_pretrained(BASE)
model = AutoModelForImageTextToText.from_pretrained(BASE, dtype=torch.bfloat16, device_map="cuda")
model = PeftModel.from_pretrained(model, "outxci/lfm2.5-vl-450m-extract-ja-receipt-lora").merge_and_unload()
SYSTEM = """store_name: The name of the store as printed on the receipt
date: The purchase date as printed on the receipt
time: The purchase time as printed on the receipt
total_amount: The total amount paid
tax_amount: The tax amount
items: List of purchased items with name, price and quantity"""
image = Image.open("receipt.jpg").convert("RGB")
conv = [
{"role": "system", "content": [{"type": "text", "text": SYSTEM}]},
{"role": "user", "content": [{"type": "image", "image": image}]},
]
inputs = processor.apply_chat_template(conv, add_generation_prompt=True,
return_tensors="pt", return_dict=True, tokenize=True).to("cuda")
out = model.generate(**inputs, max_new_tokens=1024, do_sample=False)
print(processor.batch_decode(out[:, inputs["input_ids"].shape[1]:], skip_special_tokens=True)[0])
Output is a single JSON object:
{"store_name": "...", "date": "2020年4月24日(金)", "time": "19:10",
"total_amount": "¥1,187", "tax_amount": "¥93",
"items": [{"name": "...", "price": "108", "qty": ""}]}
llm-jp/jawildtext receipt_kie (951 real mobile-captured receipts with field-level GT, Apache 2.0) × 6 epochs, mixed with 4,000 synthetic Japanese text-line OCR samples from deepcopy/japanese-synthetic-ocr-150k (upstream Kaggle source jp-font-image-dataset-02 states CC0) to retain glyph-reading abilityq/k/v/out_proj, w1/w2/w3, conv in_proj) and vision tower (q/k/v/out_proj, fc1/fc2); multi-modal projector fully trained (25.7M trainable params, 5.4%)receipt_kie reserved for evaluationA two-stage approach was validated first: training on text-line OCR alone improves glyph reading but does not transfer to receipts — task-format data (image → fields JSON) was the key.
This adapter is a Derivative Work of LFM2.5-VL-450M-Extract and is distributed under the LFM Open License v1.0 (see LICENSE). Commercial use is permitted for entities below the license's annual-revenue threshold; see the license text for details.