Image-Text-to-Text
MLX
Safetensors
Japanese
qwen3_vl
japanese
document-understanding
invoice
lora
conversational
Instructions to use tokimoa/jp-invoice-reader-2b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use tokimoa/jp-invoice-reader-2b with MLX:
# Make sure mlx-vlm is installed # pip install --upgrade mlx-vlm from mlx_vlm import load, generate from mlx_vlm.prompt_utils import apply_chat_template from mlx_vlm.utils import load_config # Load the model model, processor = load("tokimoa/jp-invoice-reader-2b") config = load_config("tokimoa/jp-invoice-reader-2b") # Prepare input image = ["http://images.cocodataset.org/val2017/000000039769.jpg"] prompt = "Describe this image." # Apply chat template formatted_prompt = apply_chat_template( processor, config, prompt, num_images=1 ) # Generate output output = generate(model, processor, formatted_prompt, image) print(output) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Pi
How to use tokimoa/jp-invoice-reader-2b with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "tokimoa/jp-invoice-reader-2b"
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "mlx-lm": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "tokimoa/jp-invoice-reader-2b" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use tokimoa/jp-invoice-reader-2b with Hermes Agent:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "tokimoa/jp-invoice-reader-2b"
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default tokimoa/jp-invoice-reader-2b
Run Hermes
hermes
- OpenClaw new
How to use tokimoa/jp-invoice-reader-2b with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "tokimoa/jp-invoice-reader-2b"
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "tokimoa/jp-invoice-reader-2b" \ --custom-provider-id mlx-lm \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
jp-invoice-reader-2b (MLX bf16 fused) — 日本語帳票リーダー
Qwen3-VL-2B-Instructを合成日本語帳票データ(GT既知方式)でLoRA post-trainingした、tokimoa初の自作派生モデルです。請求書・見積書・納品書・領収書の読み取り(QA・構造化JSON抽出)に特化しています。LoRA融合済みの単体モデル(4.0GB)で、そのままload()で動きます。
設計思想: ベースの2B VLMは帳票の数値は読めるのに「請求元を聞くと宛先を答える」「表参照で回避回答する」など応答行動が未調教でした(実測で特定)。訓練データは自作ジェネレータで合成し(画像を自分で生成するのでGTが完全に既知)、この行動を狙い撃ちで矯正しています。
実測スコア(未見語彙の合成評価セット300枚: QA1,200問・抽出2,100フィールド)
| 構成 | ja-docs QA | 帳票QA | 抽出フィールド |
|---|---|---|---|
| ベース(Qwen3-VL-2B 4bit) | 5/6 | 52.7% | 0.3% |
| このモデル(fused bf16) | 6/6 | 93.5% | 90.1% |
- 評価は訓練と語彙を完全分離(会社名・品目の語幹レベルで分離)した未見データ
- 金額系はほぼ完璧(合計299/300・税295/300・明細293/300)。残る誤りは未見カタカナ社名の1文字誤読が中心
- 兄弟構成: 8bit(2.5GB)/ 4bit+adapter(**最高精度94.3%**・1.7GB)
使い方
from mlx_vlm import load, generate
from mlx_vlm.prompt_utils import apply_chat_template
from mlx_vlm.utils import load_config
repo = "tokimoa/jp-invoice-reader-2b"
model, processor = load(repo)
config = load_config(repo)
prompt = apply_chat_template(processor, config, "この帳票から主要項目を抽出してJSONで出力してください。", num_images=1)
out = generate(model, processor, prompt, image=["invoice.png"], max_tokens=600, temperature=0.0)
print(out.text)
訓練情報
- ベース:
Qwen/Qwen3-VL-2B-Instruct(Apache-2.0) - データ: 自作合成帳票ジェネレータ(4帳票種×2レイアウト・会社名5,415種・768px低DPIスキャン相当)train 6,000枚/24,000ペア(抽出JSON1:QA3・発行元/宛先の役割問題を必須収録)
- 訓練: mlx-vlm QLoRA(rank 8・4bitベース・batch1×accum4・lr1e-4・6,000 iters・M4 Max単機約3.3時間)
- 制約: 合成ドメイン最適化のため実写スキャン・手書き・特殊レイアウトは未検証です。写真由来の帳票では精度が下がる可能性があります
ライセンス
Apache-2.0(ベースモデルに準拠)
Built with a synthetic-data pipeline where ground truth is known by construction — 検証方法・データ製法の詳細は追って技術記事で公開予定です。
- Downloads last month
- -
Model size
2B params
Tensor type
BF16
·
Hardware compatibility
Log In to add your hardware
Quantized
Model tree for tokimoa/jp-invoice-reader-2b
Base model
Qwen/Qwen3-VL-2B-Instruct