CoolFace
Modelpublic

Mickeymarsh02/layoutlmv3-multimodel-finetuned-invoices03

sourceHugging Facecc-by-nc-sa-4.0updated 1y agoView on Hugging Face
0likes65downloads
Model Card

layoutlmv3-finetuned-invoices

This model is a fine-tuned version of microsoft/layoutlmv3-base on a custom invoice dataset for document understanding tasks. It was trained using the Hugging Face Trainer API with early stopping and mixed precision.

Results

The model achieves the following results on the held-out validation set after 10 epochs:

EpochTrain LossVal LossPrecisionRecallF1
10.83290.70940.71840.65240.6838
50.38150.31040.86250.85590.8592
80.29880.23500.89990.88030.8900
100.24990.22540.90370.88720.8954

Model description

  • —Architecture: LayoutLMv3
  • —Base model: microsoft/layoutlmv3-base
  • —Task: Token classification for invoice understanding (e.g., extracting key fields).
  • —Input: Scanned invoices (images + text tokens + bounding boxes).
  • —Output: Predicted entity labels (e.g., Invoice Number, Date, Vendor, Total).

Intended uses & limitations

  • —Use cases:
  • —Automatic information extraction from invoices, receipts, and financial documents.
  • —Document AI pipelines for expense management and automation.
  • —Limitations:
  • —Fine-tuned only on a limited invoice dataset.
  • —May not generalize well to other document types (contracts, ID cards, etc.).
  • —Sensitive to OCR quality — better input text = better results.

Training details

Hyperparameters

  • —Learning rate: 3e-5
  • —Train batch size: 4
  • —Eval batch size: 4
  • —Epochs: 10 (with early stopping)
  • —Optimizer: AdamW
  • —Weight decay: 0.01
  • —Mixed precision (fp16): ✅
  • —Workers: 2

Framework versions

  • —Transformers 4.56.0
  • —PyTorch 2.8.0+cu126
  • —Datasets 4.0.0
  • —Tokenizers 0.22.0

How to use

python
from transformers import AutoModelForTokenClassification, AutoProcessor

repo_id = "your-username/layoutlmv3-finetuned-invoices"

model = AutoModelForTokenClassification.from_pretrained(repo_id)
processor = AutoProcessor.from_pretrained(repo_id)

# Example inference
from PIL import Image
image = Image.open("sample_invoice.png")

encoding = processor(image, return_tensors="pt")
outputs = model(**encoding)