Mickeymarsh02 commited on
Commit
8a137d5
·
verified ·
1 Parent(s): 842ec4a

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +83 -33
README.md CHANGED
@@ -3,62 +3,112 @@ library_name: transformers
3
  license: cc-by-nc-sa-4.0
4
  base_model: microsoft/layoutlmv3-base
5
  tags:
6
- - generated_from_trainer
 
 
 
 
7
  metrics:
8
  - accuracy
9
  - precision
10
  - recall
11
  - f1
12
  model-index:
13
- - name: layoutlmv3-finetuned
14
- results: []
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  ---
16
 
17
- <!-- This model card has been generated automatically according to the information the Trainer had access to. You
18
- should probably proofread and complete it, then remove this comment. -->
19
 
20
- # layoutlmv3-finetuned
 
21
 
22
- This model is a fine-tuned version of [microsoft/layoutlmv3-base](https://huggingface.co/microsoft/layoutlmv3-base) on the None dataset.
23
- It achieves the following results on the evaluation set:
24
- - Loss: 0.1696
25
- - Accuracy: 0.9559
26
- - Precision: 0.9572
27
- - Recall: 0.9559
28
- - F1: 0.9562
 
 
 
 
 
29
 
30
  ## Model description
31
 
32
- More information needed
 
 
 
 
 
 
33
 
34
  ## Intended uses & limitations
35
 
36
- More information needed
 
 
37
 
38
- ## Training and evaluation data
 
 
 
39
 
40
- More information needed
 
 
 
 
 
 
 
 
 
 
 
 
41
 
42
- ## Training procedure
 
 
 
 
43
 
44
- ### Training hyperparameters
45
 
46
- The following hyperparameters were used during training:
47
- - learning_rate: 5e-05
48
- - train_batch_size: 4
49
- - eval_batch_size: 8
50
- - seed: 42
51
- - optimizer: Use OptimizerNames.ADAMW_TORCH_FUSED with betas=(0.9,0.999) and epsilon=1e-08 and optimizer_args=No additional optimizer arguments
52
- - lr_scheduler_type: linear
53
- - num_epochs: 3
54
 
55
- ### Training results
 
56
 
 
57
 
 
 
58
 
59
- ### Framework versions
 
 
60
 
61
- - Transformers 4.56.0
62
- - Pytorch 2.8.0+cu126
63
- - Datasets 4.0.0
64
- - Tokenizers 0.22.0
 
3
  license: cc-by-nc-sa-4.0
4
  base_model: microsoft/layoutlmv3-base
5
  tags:
6
+ - layoutlmv3
7
+ - document-ai
8
+ - invoices
9
+ - token-classification
10
+ - pytorch
11
  metrics:
12
  - accuracy
13
  - precision
14
  - recall
15
  - f1
16
  model-index:
17
+ - name: layoutlmv3-finetuned-invoices
18
+ results:
19
+ - task:
20
+ type: token-classification
21
+ name: Named Entity Recognition (Invoices)
22
+ dataset:
23
+ name: Custom Invoice Dataset
24
+ type: invoices
25
+ split: test
26
+ metrics:
27
+ - name: Precision
28
+ type: precision
29
+ value: 0.9037
30
+ - name: Recall
31
+ type: recall
32
+ value: 0.8871
33
+ - name: F1
34
+ type: f1
35
+ value: 0.8954
36
  ---
37
 
38
+ # layoutlmv3-finetuned-invoices
 
39
 
40
+ This model is a fine-tuned version of [microsoft/layoutlmv3-base](https://huggingface.co/microsoft/layoutlmv3-base) on a **custom invoice dataset** for document understanding tasks.
41
+ It was trained using the Hugging Face `Trainer` API with early stopping and mixed precision.
42
 
43
+ ## Results
44
+
45
+ The model achieves the following results on the held-out validation set after 10 epochs:
46
+
47
+ | Epoch | Train Loss | Val Loss | Precision | Recall | F1 |
48
+ |-------|------------|----------|-----------|--------|--------|
49
+ | 1 | 0.8329 | 0.7094 | 0.7184 | 0.6524 | 0.6838 |
50
+ | 5 | 0.3815 | 0.3104 | 0.8625 | 0.8559 | 0.8592 |
51
+ | 8 | 0.2988 | 0.2350 | 0.8999 | 0.8803 | 0.8900 |
52
+ | 10 | 0.2499 | 0.2254 | **0.9037**| 0.8872 | **0.8954** |
53
+
54
+ ---
55
 
56
  ## Model description
57
 
58
+ - **Architecture**: LayoutLMv3
59
+ - **Base model**: microsoft/layoutlmv3-base
60
+ - **Task**: Token classification for invoice understanding (e.g., extracting key fields).
61
+ - **Input**: Scanned invoices (images + text tokens + bounding boxes).
62
+ - **Output**: Predicted entity labels (e.g., Invoice Number, Date, Vendor, Total).
63
+
64
+ ---
65
 
66
  ## Intended uses & limitations
67
 
68
+ - **Use cases**:
69
+ - Automatic information extraction from invoices, receipts, and financial documents.
70
+ - Document AI pipelines for expense management and automation.
71
 
72
+ - **Limitations**:
73
+ - Fine-tuned only on a limited invoice dataset.
74
+ - May not generalize well to other document types (contracts, ID cards, etc.).
75
+ - Sensitive to OCR quality — better input text = better results.
76
 
77
+ ---
78
+
79
+ ## Training details
80
+
81
+ ### Hyperparameters
82
+ - Learning rate: `3e-5`
83
+ - Train batch size: `4`
84
+ - Eval batch size: `4`
85
+ - Epochs: `10` (with early stopping)
86
+ - Optimizer: AdamW
87
+ - Weight decay: `0.01`
88
+ - Mixed precision (fp16): ✅
89
+ - Workers: `2`
90
 
91
+ ### Framework versions
92
+ - Transformers 4.56.0
93
+ - PyTorch 2.8.0+cu126
94
+ - Datasets 4.0.0
95
+ - Tokenizers 0.22.0
96
 
97
+ ---
98
 
99
+ ## How to use
 
 
 
 
 
 
 
100
 
101
+ ```python
102
+ from transformers import AutoModelForTokenClassification, AutoProcessor
103
 
104
+ repo_id = "your-username/layoutlmv3-finetuned-invoices"
105
 
106
+ model = AutoModelForTokenClassification.from_pretrained(repo_id)
107
+ processor = AutoProcessor.from_pretrained(repo_id)
108
 
109
+ # Example inference
110
+ from PIL import Image
111
+ image = Image.open("sample_invoice.png")
112
 
113
+ encoding = processor(image, return_tensors="pt")
114
+ outputs = model(**encoding)