gst-layoutlm-tiny / README.md
Mosal1985's picture
v10: README update with v10 metrics (macroF1 0.598, entityF1 0.626, ONNX INT8 13.8MB)
6744bd0 verified
|
Raw History Blame Contribute Delete
1.8 kB
---
language: en
license: cc-by-nc-4.0
tags:
- layoutlm
- token-classification
- invoice-extraction
- gst
- pytorch
- onnx
datasets:
- Mosal1985/gst-smoke-dataset
pipeline_tag: token-classification
---
# GST LayoutLM Tiny (v10)
A tiny LayoutLM-style student for extracting fields from Indian GST invoices.
Architecture: 6 layers / 256 hidden / 4 attention heads (~13M parameters).
## v10 training and evaluation
- **Training:** 2,422 pages, 40 epochs, 48,440 steps, Tesla T4
- **Evaluation:** 18 held-out pages across four vendor families
- **Macro field F1:** **0.598**
- **Entity F1:** **0.626** (precision 0.601, recall 0.654)
- **Token accuracy:** 0.476
- **BUYER_NAME F1:** 0.805
- **INVOICE_DATE F1:** 0.818
- **CGST_AMOUNT / SGST_AMOUNT / PLACE_OF_SUPPLY F1:** 1.000
- **INT8 ONNX size:** 13.8 MB
The v10 dataset contains 2,440 records in total (2,422 train + 18 evaluation)
and includes retail-layout, title-negative, buyer/GSTIN/POS, and multi-page PDF
augmentation fixes.
## Files
| File | Size | Use |
|---|---:|---|
| `pytorch_model.bin` | 52.4 MB | PyTorch `from_pretrained` weights |
| `model_int8.onnx` | 13.8 MB | INT8 ONNX Runtime / Android deployment |
| `config.json` / `label2id.json` | — | Model configuration and BIO labels |
| `report.json` | — | Evaluation report and per-field metrics |
| `onnx_benchmark.json` | — | ONNX benchmark results |
## Quickstart
```python
from transformers import LayoutLMConfig, LayoutLMForTokenClassification
config = LayoutLMConfig.from_pretrained("Mosal1985/gst-layoutlm-tiny")
model = LayoutLMForTokenClassification.from_pretrained(
"Mosal1985/gst-layoutlm-tiny", config=config
)
```
For mobile/edge inference, use `model_int8.onnx` with ONNX Runtime and the
corresponding `config.json` / `label2id.json` files.