Szczotar93
commited on
Commit
•
42c69d6
1
Parent(s):
eb30ca7
End of training
Browse files- README.md +75 -0
- config.json +56 -0
- preprocessor_config.json +14 -0
- pytorch_model.bin +3 -0
- special_tokens_map.json +7 -0
- tokenizer.json +0 -0
- tokenizer_config.json +38 -0
- training_args.bin +3 -0
- vocab.txt +0 -0
README.md
ADDED
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: mit
|
3 |
+
base_model: microsoft/layoutlm-base-uncased
|
4 |
+
tags:
|
5 |
+
- generated_from_trainer
|
6 |
+
datasets:
|
7 |
+
- layoutlmv4
|
8 |
+
model-index:
|
9 |
+
- name: layoutlm_alltags
|
10 |
+
results: []
|
11 |
+
---
|
12 |
+
|
13 |
+
<!-- This model card has been generated automatically according to the information the Trainer had access to. You
|
14 |
+
should probably proofread and complete it, then remove this comment. -->
|
15 |
+
|
16 |
+
# layoutlm_alltags
|
17 |
+
|
18 |
+
This model is a fine-tuned version of [microsoft/layoutlm-base-uncased](https://huggingface.co/microsoft/layoutlm-base-uncased) on the layoutlmv4 dataset.
|
19 |
+
It achieves the following results on the evaluation set:
|
20 |
+
- Loss: 0.0891
|
21 |
+
- Customer Address: {'precision': 0.7764705882352941, 'recall': 0.8048780487804879, 'f1': 0.7904191616766466, 'number': 82}
|
22 |
+
- Customer Name: {'precision': 0.6666666666666666, 'recall': 0.8333333333333334, 'f1': 0.7407407407407408, 'number': 12}
|
23 |
+
- Invoice Number: {'precision': 0.8571428571428571, 'recall': 1.0, 'f1': 0.923076923076923, 'number': 12}
|
24 |
+
- Tax Amount: {'precision': 0.0, 'recall': 0.0, 'f1': 0.0, 'number': 2}
|
25 |
+
- Total Amount: {'precision': 0.7142857142857143, 'recall': 0.9090909090909091, 'f1': 0.8, 'number': 11}
|
26 |
+
- Vendor Name: {'precision': 1.0, 'recall': 1.0, 'f1': 1.0, 'number': 12}
|
27 |
+
- Overall Precision: 0.7857
|
28 |
+
- Overall Recall: 0.8397
|
29 |
+
- Overall F1: 0.8118
|
30 |
+
- Overall Accuracy: 0.9801
|
31 |
+
|
32 |
+
## Model description
|
33 |
+
|
34 |
+
More information needed
|
35 |
+
|
36 |
+
## Intended uses & limitations
|
37 |
+
|
38 |
+
More information needed
|
39 |
+
|
40 |
+
## Training and evaluation data
|
41 |
+
|
42 |
+
More information needed
|
43 |
+
|
44 |
+
## Training procedure
|
45 |
+
|
46 |
+
### Training hyperparameters
|
47 |
+
|
48 |
+
The following hyperparameters were used during training:
|
49 |
+
- learning_rate: 3e-05
|
50 |
+
- train_batch_size: 16
|
51 |
+
- eval_batch_size: 8
|
52 |
+
- seed: 42
|
53 |
+
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
|
54 |
+
- lr_scheduler_type: linear
|
55 |
+
- num_epochs: 50
|
56 |
+
|
57 |
+
### Training results
|
58 |
+
|
59 |
+
| Training Loss | Epoch | Step | Validation Loss | Customer Address | Customer Name | Invoice Number | Tax Amount | Total Amount | Vendor Name | Overall Precision | Overall Recall | Overall F1 | Overall Accuracy |
|
60 |
+
|:-------------:|:-----:|:----:|:---------------:|:----------------------------------------------------------------------------------------------------------:|:--------------------------------------------------------------------------------------------------------:|:-------------------------------------------------------------------------------------------------------:|:---------------------------------------------------------:|:----------------------------------------------------------------------------------------:|:-------------------------------------------------------------------------------------------------------:|:-----------------:|:--------------:|:----------:|:----------------:|
|
61 |
+
| 0.8211 | 6.67 | 20 | 0.3797 | {'precision': 0.25316455696202533, 'recall': 0.24390243902439024, 'f1': 0.24844720496894412, 'number': 82} | {'precision': 0.0, 'recall': 0.0, 'f1': 0.0, 'number': 12} | {'precision': 0.0, 'recall': 0.0, 'f1': 0.0, 'number': 12} | {'precision': 0.0, 'recall': 0.0, 'f1': 0.0, 'number': 2} | {'precision': 0.0, 'recall': 0.0, 'f1': 0.0, 'number': 11} | {'precision': 0.0, 'recall': 0.0, 'f1': 0.0, 'number': 12} | 0.2532 | 0.1527 | 0.1905 | 0.9050 |
|
62 |
+
| 0.3036 | 13.33 | 40 | 0.1941 | {'precision': 0.6448598130841121, 'recall': 0.8414634146341463, 'f1': 0.73015873015873, 'number': 82} | {'precision': 0.0, 'recall': 0.0, 'f1': 0.0, 'number': 12} | {'precision': 0.0, 'recall': 0.0, 'f1': 0.0, 'number': 12} | {'precision': 0.0, 'recall': 0.0, 'f1': 0.0, 'number': 2} | {'precision': 0.0, 'recall': 0.0, 'f1': 0.0, 'number': 11} | {'precision': 0.75, 'recall': 0.75, 'f1': 0.75, 'number': 12} | 0.6555 | 0.5954 | 0.624 | 0.9493 |
|
63 |
+
| 0.1537 | 20.0 | 60 | 0.1153 | {'precision': 0.7157894736842105, 'recall': 0.8292682926829268, 'f1': 0.768361581920904, 'number': 82} | {'precision': 0.35714285714285715, 'recall': 0.4166666666666667, 'f1': 0.3846153846153846, 'number': 12} | {'precision': 0.8461538461538461, 'recall': 0.9166666666666666, 'f1': 0.8799999999999999, 'number': 12} | {'precision': 0.0, 'recall': 0.0, 'f1': 0.0, 'number': 2} | {'precision': 0.0, 'recall': 0.0, 'f1': 0.0, 'number': 11} | {'precision': 0.8461538461538461, 'recall': 0.9166666666666666, 'f1': 0.8799999999999999, 'number': 12} | 0.7037 | 0.7252 | 0.7143 | 0.9663 |
|
64 |
+
| 0.0862 | 26.67 | 80 | 0.0953 | {'precision': 0.8, 'recall': 0.8292682926829268, 'f1': 0.8143712574850299, 'number': 82} | {'precision': 0.6, 'recall': 0.75, 'f1': 0.6666666666666665, 'number': 12} | {'precision': 0.6666666666666666, 'recall': 1.0, 'f1': 0.8, 'number': 12} | {'precision': 0.0, 'recall': 0.0, 'f1': 0.0, 'number': 2} | {'precision': 0.0, 'recall': 0.0, 'f1': 0.0, 'number': 11} | {'precision': 0.9166666666666666, 'recall': 0.9166666666666666, 'f1': 0.9166666666666666, 'number': 12} | 0.7519 | 0.7634 | 0.7576 | 0.9757 |
|
65 |
+
| 0.0509 | 33.33 | 100 | 0.0846 | {'precision': 0.7857142857142857, 'recall': 0.8048780487804879, 'f1': 0.7951807228915663, 'number': 82} | {'precision': 0.7333333333333333, 'recall': 0.9166666666666666, 'f1': 0.8148148148148148, 'number': 12} | {'precision': 0.8571428571428571, 'recall': 1.0, 'f1': 0.923076923076923, 'number': 12} | {'precision': 0.0, 'recall': 0.0, 'f1': 0.0, 'number': 2} | {'precision': 1.0, 'recall': 0.5454545454545454, 'f1': 0.7058823529411764, 'number': 11} | {'precision': 0.8461538461538461, 'recall': 0.9166666666666666, 'f1': 0.8799999999999999, 'number': 12} | 0.8030 | 0.8092 | 0.8061 | 0.9775 |
|
66 |
+
| 0.0354 | 40.0 | 120 | 0.0852 | {'precision': 0.7710843373493976, 'recall': 0.7804878048780488, 'f1': 0.7757575757575758, 'number': 82} | {'precision': 0.6666666666666666, 'recall': 0.8333333333333334, 'f1': 0.7407407407407408, 'number': 12} | {'precision': 0.8, 'recall': 1.0, 'f1': 0.888888888888889, 'number': 12} | {'precision': 0.0, 'recall': 0.0, 'f1': 0.0, 'number': 2} | {'precision': 0.7142857142857143, 'recall': 0.9090909090909091, 'f1': 0.8, 'number': 11} | {'precision': 1.0, 'recall': 1.0, 'f1': 1.0, 'number': 12} | 0.7770 | 0.8244 | 0.8 | 0.9797 |
|
67 |
+
| 0.0297 | 46.67 | 140 | 0.0891 | {'precision': 0.7764705882352941, 'recall': 0.8048780487804879, 'f1': 0.7904191616766466, 'number': 82} | {'precision': 0.6666666666666666, 'recall': 0.8333333333333334, 'f1': 0.7407407407407408, 'number': 12} | {'precision': 0.8571428571428571, 'recall': 1.0, 'f1': 0.923076923076923, 'number': 12} | {'precision': 0.0, 'recall': 0.0, 'f1': 0.0, 'number': 2} | {'precision': 0.7142857142857143, 'recall': 0.9090909090909091, 'f1': 0.8, 'number': 11} | {'precision': 1.0, 'recall': 1.0, 'f1': 1.0, 'number': 12} | 0.7857 | 0.8397 | 0.8118 | 0.9801 |
|
68 |
+
|
69 |
+
|
70 |
+
### Framework versions
|
71 |
+
|
72 |
+
- Transformers 4.32.1
|
73 |
+
- Pytorch 2.2.0+cpu
|
74 |
+
- Datasets 2.12.0
|
75 |
+
- Tokenizers 0.13.2
|
config.json
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "microsoft/layoutlm-base-uncased",
|
3 |
+
"architectures": [
|
4 |
+
"LayoutLMForTokenClassification"
|
5 |
+
],
|
6 |
+
"attention_probs_dropout_prob": 0.1,
|
7 |
+
"hidden_act": "gelu",
|
8 |
+
"hidden_dropout_prob": 0.1,
|
9 |
+
"hidden_size": 768,
|
10 |
+
"id2label": {
|
11 |
+
"0": "O",
|
12 |
+
"1": "B-Invoice_Number",
|
13 |
+
"2": "I-Invoice_Number",
|
14 |
+
"3": "B-Vendor_Name",
|
15 |
+
"4": "I-Vendor_Name",
|
16 |
+
"5": "B-Customer_Name",
|
17 |
+
"6": "I-Customer_Name",
|
18 |
+
"7": "B-Customer_Address",
|
19 |
+
"8": "I-Customer_Address",
|
20 |
+
"9": "B-Total_Amount",
|
21 |
+
"10": "I-Total_Amount",
|
22 |
+
"11": "B-Tax_Amount",
|
23 |
+
"12": "I-Tax_Amount"
|
24 |
+
},
|
25 |
+
"initializer_range": 0.02,
|
26 |
+
"intermediate_size": 3072,
|
27 |
+
"label2id": {
|
28 |
+
"B-Customer_Address": 7,
|
29 |
+
"B-Customer_Name": 5,
|
30 |
+
"B-Invoice_Number": 1,
|
31 |
+
"B-Tax_Amount": 11,
|
32 |
+
"B-Total_Amount": 9,
|
33 |
+
"B-Vendor_Name": 3,
|
34 |
+
"I-Customer_Address": 8,
|
35 |
+
"I-Customer_Name": 6,
|
36 |
+
"I-Invoice_Number": 2,
|
37 |
+
"I-Tax_Amount": 12,
|
38 |
+
"I-Total_Amount": 10,
|
39 |
+
"I-Vendor_Name": 4,
|
40 |
+
"O": 0
|
41 |
+
},
|
42 |
+
"layer_norm_eps": 1e-12,
|
43 |
+
"max_2d_position_embeddings": 1024,
|
44 |
+
"max_position_embeddings": 512,
|
45 |
+
"model_type": "layoutlm",
|
46 |
+
"num_attention_heads": 12,
|
47 |
+
"num_hidden_layers": 12,
|
48 |
+
"output_past": true,
|
49 |
+
"pad_token_id": 0,
|
50 |
+
"position_embedding_type": "absolute",
|
51 |
+
"torch_dtype": "float32",
|
52 |
+
"transformers_version": "4.32.1",
|
53 |
+
"type_vocab_size": 2,
|
54 |
+
"use_cache": true,
|
55 |
+
"vocab_size": 30522
|
56 |
+
}
|
preprocessor_config.json
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"apply_ocr": false,
|
3 |
+
"do_resize": true,
|
4 |
+
"feature_extractor_type": "LayoutLMv2FeatureExtractor",
|
5 |
+
"image_processor_type": "LayoutLMv2ImageProcessor",
|
6 |
+
"ocr_lang": null,
|
7 |
+
"processor_class": "LayoutLMv2Processor",
|
8 |
+
"resample": 2,
|
9 |
+
"size": {
|
10 |
+
"height": 224,
|
11 |
+
"width": 224
|
12 |
+
},
|
13 |
+
"tesseract_config": ""
|
14 |
+
}
|
pytorch_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a72141fc31374c9366f582e17745ad232e89f498953e7305c54c994c59da88c4
|
3 |
+
size 450619966
|
special_tokens_map.json
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"cls_token": "[CLS]",
|
3 |
+
"mask_token": "[MASK]",
|
4 |
+
"pad_token": "[PAD]",
|
5 |
+
"sep_token": "[SEP]",
|
6 |
+
"unk_token": "[UNK]"
|
7 |
+
}
|
tokenizer.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
tokenizer_config.json
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"additional_special_tokens": null,
|
3 |
+
"apply_ocr": false,
|
4 |
+
"clean_up_tokenization_spaces": true,
|
5 |
+
"cls_token": "[CLS]",
|
6 |
+
"cls_token_box": [
|
7 |
+
0,
|
8 |
+
0,
|
9 |
+
0,
|
10 |
+
0
|
11 |
+
],
|
12 |
+
"do_basic_tokenize": true,
|
13 |
+
"do_lower_case": true,
|
14 |
+
"mask_token": "[MASK]",
|
15 |
+
"model_max_length": 512,
|
16 |
+
"never_split": null,
|
17 |
+
"only_label_first_subword": true,
|
18 |
+
"pad_token": "[PAD]",
|
19 |
+
"pad_token_box": [
|
20 |
+
0,
|
21 |
+
0,
|
22 |
+
0,
|
23 |
+
0
|
24 |
+
],
|
25 |
+
"pad_token_label": -100,
|
26 |
+
"processor_class": "LayoutLMv2Processor",
|
27 |
+
"sep_token": "[SEP]",
|
28 |
+
"sep_token_box": [
|
29 |
+
1000,
|
30 |
+
1000,
|
31 |
+
1000,
|
32 |
+
1000
|
33 |
+
],
|
34 |
+
"strip_accents": null,
|
35 |
+
"tokenize_chinese_chars": true,
|
36 |
+
"tokenizer_class": "LayoutLMv2Tokenizer",
|
37 |
+
"unk_token": "[UNK]"
|
38 |
+
}
|
training_args.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a8bfcbd38eb26be6a7aa888692d577c56eb758cfcee5c85e17b6cdd0c748ce13
|
3 |
+
size 4536
|
vocab.txt
ADDED
The diff for this file is too large to render.
See raw diff
|
|