lchiang commited on
Commit
f747130
2 Parent(s): e6b14f1 28e7679

Merge remote-tracking branch 'origin/main'

Browse files
README.md ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc-by-nc-sa-4.0
3
+ tags:
4
+ - generated_from_trainer
5
+ datasets:
6
+ - cord-layoutlmv3
7
+ metrics:
8
+ - precision
9
+ - recall
10
+ - f1
11
+ - accuracy
12
+ model-index:
13
+ - name: layoutlmv3-finetuned-cord_100
14
+ results:
15
+ - task:
16
+ name: Token Classification
17
+ type: token-classification
18
+ dataset:
19
+ name: cord-layoutlmv3
20
+ type: cord-layoutlmv3
21
+ config: cord
22
+ split: test
23
+ args: cord
24
+ metrics:
25
+ - name: Precision
26
+ type: precision
27
+ value: 0.9465478841870824
28
+ - name: Recall
29
+ type: recall
30
+ value: 0.9543413173652695
31
+ - name: F1
32
+ type: f1
33
+ value: 0.9504286246738725
34
+ - name: Accuracy
35
+ type: accuracy
36
+ value: 0.9584040747028862
37
+ ---
38
+
39
+ <!-- This model card has been generated automatically according to the information the Trainer had access to. You
40
+ should probably proofread and complete it, then remove this comment. -->
41
+
42
+ # layoutlmv3-finetuned-cord_100
43
+
44
+ This model is a fine-tuned version of [microsoft/layoutlmv3-base](https://huggingface.co/microsoft/layoutlmv3-base) on the cord-layoutlmv3 dataset.
45
+ It achieves the following results on the evaluation set:
46
+ - Loss: 0.2090
47
+ - Precision: 0.9465
48
+ - Recall: 0.9543
49
+ - F1: 0.9504
50
+ - Accuracy: 0.9584
51
+
52
+ ## Model description
53
+
54
+ More information needed
55
+
56
+ ## Intended uses & limitations
57
+
58
+ More information needed
59
+
60
+ ## Training and evaluation data
61
+
62
+ More information needed
63
+
64
+ ## Training procedure
65
+
66
+ ### Training hyperparameters
67
+
68
+ The following hyperparameters were used during training:
69
+ - learning_rate: 1e-05
70
+ - train_batch_size: 5
71
+ - eval_batch_size: 5
72
+ - seed: 42
73
+ - optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
74
+ - lr_scheduler_type: linear
75
+ - training_steps: 2500
76
+
77
+ ### Training results
78
+
79
+ | Training Loss | Epoch | Step | Validation Loss | Precision | Recall | F1 | Accuracy |
80
+ |:-------------:|:-----:|:----:|:---------------:|:---------:|:------:|:------:|:--------:|
81
+ | No log | 1.56 | 250 | 1.0347 | 0.6965 | 0.7695 | 0.7312 | 0.7861 |
82
+ | 1.4031 | 3.12 | 500 | 0.5641 | 0.8491 | 0.8720 | 0.8604 | 0.8744 |
83
+ | 1.4031 | 4.69 | 750 | 0.3899 | 0.8810 | 0.9087 | 0.8946 | 0.9138 |
84
+ | 0.4005 | 6.25 | 1000 | 0.3025 | 0.9202 | 0.9319 | 0.9260 | 0.9355 |
85
+ | 0.4005 | 7.81 | 1250 | 0.2641 | 0.9211 | 0.9349 | 0.9279 | 0.9402 |
86
+ | 0.2161 | 9.38 | 1500 | 0.2406 | 0.9277 | 0.9416 | 0.9346 | 0.9474 |
87
+ | 0.2161 | 10.94 | 1750 | 0.2250 | 0.9343 | 0.9469 | 0.9405 | 0.9516 |
88
+ | 0.1474 | 12.5 | 2000 | 0.2238 | 0.9415 | 0.9513 | 0.9464 | 0.9542 |
89
+ | 0.1474 | 14.06 | 2250 | 0.2128 | 0.9451 | 0.9536 | 0.9493 | 0.9571 |
90
+ | 0.1128 | 15.62 | 2500 | 0.2090 | 0.9465 | 0.9543 | 0.9504 | 0.9584 |
91
+
92
+
93
+ ### Framework versions
94
+
95
+ - Transformers 4.30.2
96
+ - Pytorch 2.0.1
97
+ - Datasets 2.13.1
98
+ - Tokenizers 0.13.3
config.json ADDED
@@ -0,0 +1,166 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "microsoft/layoutlmv3-base",
3
+ "architectures": [
4
+ "LayoutLMv3ForTokenClassification"
5
+ ],
6
+ "attention_probs_dropout_prob": 0.1,
7
+ "bos_token_id": 0,
8
+ "classifier_dropout": null,
9
+ "coordinate_size": 128,
10
+ "eos_token_id": 2,
11
+ "has_relative_attention_bias": true,
12
+ "has_spatial_attention_bias": true,
13
+ "hidden_act": "gelu",
14
+ "hidden_dropout_prob": 0.1,
15
+ "hidden_size": 768,
16
+ "id2label": {
17
+ "0": "O",
18
+ "1": "B-MENU.NM",
19
+ "2": "B-MENU.NUM",
20
+ "3": "B-MENU.UNITPRICE",
21
+ "4": "B-MENU.CNT",
22
+ "5": "B-MENU.DISCOUNTPRICE",
23
+ "6": "B-MENU.PRICE",
24
+ "7": "B-MENU.ITEMSUBTOTAL",
25
+ "8": "B-MENU.VATYN",
26
+ "9": "B-MENU.ETC",
27
+ "10": "B-MENU.SUB_NM",
28
+ "11": "B-MENU.SUB_UNITPRICE",
29
+ "12": "B-MENU.SUB_CNT",
30
+ "13": "B-MENU.SUB_PRICE",
31
+ "14": "B-MENU.SUB_ETC",
32
+ "15": "B-VOID_MENU.NM",
33
+ "16": "B-VOID_MENU.PRICE",
34
+ "17": "B-SUB_TOTAL.SUBTOTAL_PRICE",
35
+ "18": "B-SUB_TOTAL.DISCOUNT_PRICE",
36
+ "19": "B-SUB_TOTAL.SERVICE_PRICE",
37
+ "20": "B-SUB_TOTAL.OTHERSVC_PRICE",
38
+ "21": "B-SUB_TOTAL.TAX_PRICE",
39
+ "22": "B-SUB_TOTAL.ETC",
40
+ "23": "B-TOTAL.TOTAL_PRICE",
41
+ "24": "B-TOTAL.TOTAL_ETC",
42
+ "25": "B-TOTAL.CASHPRICE",
43
+ "26": "B-TOTAL.CHANGEPRICE",
44
+ "27": "B-TOTAL.CREDITCARDPRICE",
45
+ "28": "B-TOTAL.EMONEYPRICE",
46
+ "29": "B-TOTAL.MENUTYPE_CNT",
47
+ "30": "B-TOTAL.MENUQTY_CNT",
48
+ "31": "I-MENU.NM",
49
+ "32": "I-MENU.NUM",
50
+ "33": "I-MENU.UNITPRICE",
51
+ "34": "I-MENU.CNT",
52
+ "35": "I-MENU.DISCOUNTPRICE",
53
+ "36": "I-MENU.PRICE",
54
+ "37": "I-MENU.ITEMSUBTOTAL",
55
+ "38": "I-MENU.VATYN",
56
+ "39": "I-MENU.ETC",
57
+ "40": "I-MENU.SUB_NM",
58
+ "41": "I-MENU.SUB_UNITPRICE",
59
+ "42": "I-MENU.SUB_CNT",
60
+ "43": "I-MENU.SUB_PRICE",
61
+ "44": "I-MENU.SUB_ETC",
62
+ "45": "I-VOID_MENU.NM",
63
+ "46": "I-VOID_MENU.PRICE",
64
+ "47": "I-SUB_TOTAL.SUBTOTAL_PRICE",
65
+ "48": "I-SUB_TOTAL.DISCOUNT_PRICE",
66
+ "49": "I-SUB_TOTAL.SERVICE_PRICE",
67
+ "50": "I-SUB_TOTAL.OTHERSVC_PRICE",
68
+ "51": "I-SUB_TOTAL.TAX_PRICE",
69
+ "52": "I-SUB_TOTAL.ETC",
70
+ "53": "I-TOTAL.TOTAL_PRICE",
71
+ "54": "I-TOTAL.TOTAL_ETC",
72
+ "55": "I-TOTAL.CASHPRICE",
73
+ "56": "I-TOTAL.CHANGEPRICE",
74
+ "57": "I-TOTAL.CREDITCARDPRICE",
75
+ "58": "I-TOTAL.EMONEYPRICE",
76
+ "59": "I-TOTAL.MENUTYPE_CNT",
77
+ "60": "I-TOTAL.MENUQTY_CNT"
78
+ },
79
+ "initializer_range": 0.02,
80
+ "input_size": 224,
81
+ "intermediate_size": 3072,
82
+ "label2id": {
83
+ "B-MENU.CNT": 4,
84
+ "B-MENU.DISCOUNTPRICE": 5,
85
+ "B-MENU.ETC": 9,
86
+ "B-MENU.ITEMSUBTOTAL": 7,
87
+ "B-MENU.NM": 1,
88
+ "B-MENU.NUM": 2,
89
+ "B-MENU.PRICE": 6,
90
+ "B-MENU.SUB_CNT": 12,
91
+ "B-MENU.SUB_ETC": 14,
92
+ "B-MENU.SUB_NM": 10,
93
+ "B-MENU.SUB_PRICE": 13,
94
+ "B-MENU.SUB_UNITPRICE": 11,
95
+ "B-MENU.UNITPRICE": 3,
96
+ "B-MENU.VATYN": 8,
97
+ "B-SUB_TOTAL.DISCOUNT_PRICE": 18,
98
+ "B-SUB_TOTAL.ETC": 22,
99
+ "B-SUB_TOTAL.OTHERSVC_PRICE": 20,
100
+ "B-SUB_TOTAL.SERVICE_PRICE": 19,
101
+ "B-SUB_TOTAL.SUBTOTAL_PRICE": 17,
102
+ "B-SUB_TOTAL.TAX_PRICE": 21,
103
+ "B-TOTAL.CASHPRICE": 25,
104
+ "B-TOTAL.CHANGEPRICE": 26,
105
+ "B-TOTAL.CREDITCARDPRICE": 27,
106
+ "B-TOTAL.EMONEYPRICE": 28,
107
+ "B-TOTAL.MENUQTY_CNT": 30,
108
+ "B-TOTAL.MENUTYPE_CNT": 29,
109
+ "B-TOTAL.TOTAL_ETC": 24,
110
+ "B-TOTAL.TOTAL_PRICE": 23,
111
+ "B-VOID_MENU.NM": 15,
112
+ "B-VOID_MENU.PRICE": 16,
113
+ "I-MENU.CNT": 34,
114
+ "I-MENU.DISCOUNTPRICE": 35,
115
+ "I-MENU.ETC": 39,
116
+ "I-MENU.ITEMSUBTOTAL": 37,
117
+ "I-MENU.NM": 31,
118
+ "I-MENU.NUM": 32,
119
+ "I-MENU.PRICE": 36,
120
+ "I-MENU.SUB_CNT": 42,
121
+ "I-MENU.SUB_ETC": 44,
122
+ "I-MENU.SUB_NM": 40,
123
+ "I-MENU.SUB_PRICE": 43,
124
+ "I-MENU.SUB_UNITPRICE": 41,
125
+ "I-MENU.UNITPRICE": 33,
126
+ "I-MENU.VATYN": 38,
127
+ "I-SUB_TOTAL.DISCOUNT_PRICE": 48,
128
+ "I-SUB_TOTAL.ETC": 52,
129
+ "I-SUB_TOTAL.OTHERSVC_PRICE": 50,
130
+ "I-SUB_TOTAL.SERVICE_PRICE": 49,
131
+ "I-SUB_TOTAL.SUBTOTAL_PRICE": 47,
132
+ "I-SUB_TOTAL.TAX_PRICE": 51,
133
+ "I-TOTAL.CASHPRICE": 55,
134
+ "I-TOTAL.CHANGEPRICE": 56,
135
+ "I-TOTAL.CREDITCARDPRICE": 57,
136
+ "I-TOTAL.EMONEYPRICE": 58,
137
+ "I-TOTAL.MENUQTY_CNT": 60,
138
+ "I-TOTAL.MENUTYPE_CNT": 59,
139
+ "I-TOTAL.TOTAL_ETC": 54,
140
+ "I-TOTAL.TOTAL_PRICE": 53,
141
+ "I-VOID_MENU.NM": 45,
142
+ "I-VOID_MENU.PRICE": 46,
143
+ "O": 0
144
+ },
145
+ "layer_norm_eps": 1e-05,
146
+ "max_2d_position_embeddings": 1024,
147
+ "max_position_embeddings": 514,
148
+ "max_rel_2d_pos": 256,
149
+ "max_rel_pos": 128,
150
+ "model_type": "layoutlmv3",
151
+ "num_attention_heads": 12,
152
+ "num_channels": 3,
153
+ "num_hidden_layers": 12,
154
+ "pad_token_id": 1,
155
+ "patch_size": 16,
156
+ "rel_2d_pos_bins": 64,
157
+ "rel_pos_bins": 32,
158
+ "second_input_size": 112,
159
+ "shape_size": 128,
160
+ "text_embed": true,
161
+ "torch_dtype": "float32",
162
+ "transformers_version": "4.30.2",
163
+ "type_vocab_size": 1,
164
+ "visual_embed": true,
165
+ "vocab_size": 50265
166
+ }
merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
preprocessor_config.json ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "apply_ocr": false,
3
+ "do_normalize": true,
4
+ "do_rescale": true,
5
+ "do_resize": true,
6
+ "feature_extractor_type": "LayoutLMv3FeatureExtractor",
7
+ "image_mean": [
8
+ 0.5,
9
+ 0.5,
10
+ 0.5
11
+ ],
12
+ "image_processor_type": "LayoutLMv3ImageProcessor",
13
+ "image_std": [
14
+ 0.5,
15
+ 0.5,
16
+ 0.5
17
+ ],
18
+ "ocr_lang": null,
19
+ "processor_class": "LayoutLMv3Processor",
20
+ "resample": 2,
21
+ "rescale_factor": 0.00392156862745098,
22
+ "size": {
23
+ "height": 224,
24
+ "width": 224
25
+ },
26
+ "tesseract_config": ""
27
+ }
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:06ffea60b222e39378154d5f8f75cc66b3b18c3d25cf2f3614319bc9807041c1
3
+ size 503936881
special_tokens_map.json ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": {
3
+ "content": "<s>",
4
+ "lstrip": false,
5
+ "normalized": true,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "cls_token": {
10
+ "content": "<s>",
11
+ "lstrip": false,
12
+ "normalized": true,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "eos_token": {
17
+ "content": "</s>",
18
+ "lstrip": false,
19
+ "normalized": true,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ },
23
+ "mask_token": {
24
+ "content": "<mask>",
25
+ "lstrip": true,
26
+ "normalized": true,
27
+ "rstrip": false,
28
+ "single_word": false
29
+ },
30
+ "pad_token": {
31
+ "content": "<pad>",
32
+ "lstrip": false,
33
+ "normalized": true,
34
+ "rstrip": false,
35
+ "single_word": false
36
+ },
37
+ "sep_token": {
38
+ "content": "</s>",
39
+ "lstrip": false,
40
+ "normalized": true,
41
+ "rstrip": false,
42
+ "single_word": false
43
+ },
44
+ "unk_token": {
45
+ "content": "<unk>",
46
+ "lstrip": false,
47
+ "normalized": true,
48
+ "rstrip": false,
49
+ "single_word": false
50
+ }
51
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": true,
3
+ "apply_ocr": false,
4
+ "bos_token": {
5
+ "__type": "AddedToken",
6
+ "content": "<s>",
7
+ "lstrip": false,
8
+ "normalized": true,
9
+ "rstrip": false,
10
+ "single_word": false
11
+ },
12
+ "clean_up_tokenization_spaces": true,
13
+ "cls_token": {
14
+ "__type": "AddedToken",
15
+ "content": "<s>",
16
+ "lstrip": false,
17
+ "normalized": true,
18
+ "rstrip": false,
19
+ "single_word": false
20
+ },
21
+ "cls_token_box": [
22
+ 0,
23
+ 0,
24
+ 0,
25
+ 0
26
+ ],
27
+ "eos_token": {
28
+ "__type": "AddedToken",
29
+ "content": "</s>",
30
+ "lstrip": false,
31
+ "normalized": true,
32
+ "rstrip": false,
33
+ "single_word": false
34
+ },
35
+ "errors": "replace",
36
+ "mask_token": {
37
+ "__type": "AddedToken",
38
+ "content": "<mask>",
39
+ "lstrip": true,
40
+ "normalized": true,
41
+ "rstrip": false,
42
+ "single_word": false
43
+ },
44
+ "model_max_length": 512,
45
+ "only_label_first_subword": true,
46
+ "pad_token": {
47
+ "__type": "AddedToken",
48
+ "content": "<pad>",
49
+ "lstrip": false,
50
+ "normalized": true,
51
+ "rstrip": false,
52
+ "single_word": false
53
+ },
54
+ "pad_token_box": [
55
+ 0,
56
+ 0,
57
+ 0,
58
+ 0
59
+ ],
60
+ "pad_token_label": -100,
61
+ "processor_class": "LayoutLMv3Processor",
62
+ "sep_token": {
63
+ "__type": "AddedToken",
64
+ "content": "</s>",
65
+ "lstrip": false,
66
+ "normalized": true,
67
+ "rstrip": false,
68
+ "single_word": false
69
+ },
70
+ "sep_token_box": [
71
+ 0,
72
+ 0,
73
+ 0,
74
+ 0
75
+ ],
76
+ "tokenizer_class": "LayoutLMv3Tokenizer",
77
+ "trim_offsets": true,
78
+ "unk_token": {
79
+ "__type": "AddedToken",
80
+ "content": "<unk>",
81
+ "lstrip": false,
82
+ "normalized": true,
83
+ "rstrip": false,
84
+ "single_word": false
85
+ }
86
+ }
training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1ae526649b1fb9ca45ee1dd573a582baa0d7c36f7f2fec43d46847653fc3a409
3
+ size 3963
vocab.json ADDED
The diff for this file is too large to render. See raw diff