File size: 1,804 Bytes
75459e5
 
 
 
 
 
 
 
 
f90f751
75459e5
 
 
 
 
6744bd0
75459e5
6744bd0
 
75459e5
6744bd0
75459e5
6744bd0
 
 
 
 
 
 
 
 
 
 
 
 
75459e5
f90f751
75459e5
f90f751
6744bd0
 
 
 
 
 
75459e5
f90f751
75459e5
f90f751
 
75459e5
f90f751
 
 
 
 
75459e5
6744bd0
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
---
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.