Felladrin commited on
Commit
d60e010
·
verified ·
1 Parent(s): c39ff01

Upload folder using huggingface_hub

Browse files
README.md ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: transformers.js
3
+ license: cc-by-nc-sa-4.0
4
+ base_model:
5
+ - mp-02/layoutlmv3-base-cord
6
+ tags:
7
+ - generated_from_trainer
8
+ datasets:
9
+ - mp-02/cord
10
+ metrics:
11
+ - precision
12
+ - recall
13
+ - f1
14
+ - accuracy
15
+ model-index:
16
+ - name: layoutlmv3-base-cord
17
+ results:
18
+ - task:
19
+ name: Token Classification
20
+ type: token-classification
21
+ dataset:
22
+ name: mp-02/cord
23
+ type: mp-02/cord
24
+ metrics:
25
+ - name: Precision
26
+ type: precision
27
+ value: 0.9752270850536746
28
+ - name: Recall
29
+ type: recall
30
+ value: 0.9784589892294946
31
+ - name: F1
32
+ type: f1
33
+ value: 0.976840363937138
34
+ - name: Accuracy
35
+ type: accuracy
36
+ value: 0.973924977127173
37
+ pipeline_tag: token-classification
38
+ ---
39
+
40
+
41
+
42
+ # layoutlmv3-base-cord (ONNX)
43
+
44
+
45
+ This is an ONNX version of [mp-02/layoutlmv3-base-cord](https://huggingface.co/mp-02/layoutlmv3-base-cord). It was automatically converted and uploaded using [this Hugging Face Space](https://huggingface.co/spaces/onnx-community/convert-to-onnx).
46
+
47
+
48
+ ## Usage with Transformers.js
49
+
50
+
51
+ See the pipeline documentation for `token-classification`: https://huggingface.co/docs/transformers.js/api/pipelines#module_pipelines.TokenClassificationPipeline
52
+
53
+
54
+ ---
55
+
56
+
57
+ <!-- This model card has been generated automatically according to the information the Trainer had access to. You
58
+ should probably proofread and complete it, then remove this comment. -->
59
+
60
+ # layoutlmv3-base-cord
61
+
62
+ This model is a fine-tuned version of [microsoft/layoutlmv3-base](https://huggingface.co/microsoft/layoutlmv3-base) on the mp-02/cord dataset.
63
+ It achieves the following results on the evaluation set:
64
+ - Loss: 0.1517
65
+ - Precision: 0.9752
66
+ - Recall: 0.9785
67
+ - F1: 0.9768
68
+ - Accuracy: 0.9739
69
+
70
+ ## Model description
71
+
72
+ More information needed
73
+
74
+ ## Intended uses & limitations
75
+
76
+ More information needed
77
+
78
+ ## Training and evaluation data
79
+
80
+ More information needed
81
+
82
+ ## Training procedure
83
+
84
+ ### Training hyperparameters
85
+
86
+ The following hyperparameters were used during training:
87
+ - learning_rate: 2e-05
88
+ - train_batch_size: 16
89
+ - eval_batch_size: 16
90
+ - seed: 42
91
+ - optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
92
+ - lr_scheduler_type: linear
93
+ - training_steps: 3000
94
+
95
+ ### Training results
96
+
97
+ | Training Loss | Epoch | Step | Validation Loss | Precision | Recall | F1 | Accuracy |
98
+ |:-------------:|:-----:|:----:|:---------------:|:---------:|:------:|:------:|:--------:|
99
+ | No log | 2.0 | 100 | 0.8667 | 0.7592 | 0.8202 | 0.7885 | 0.8097 |
100
+ | No log | 4.0 | 200 | 0.3443 | 0.9122 | 0.9387 | 0.9253 | 0.9222 |
101
+ | No log | 6.0 | 300 | 0.2128 | 0.9345 | 0.9569 | 0.9456 | 0.9579 |
102
+ | No log | 8.0 | 400 | 0.1745 | 0.9440 | 0.9635 | 0.9537 | 0.9629 |
103
+ | 0.6362 | 10.0 | 500 | 0.1594 | 0.9559 | 0.9702 | 0.9630 | 0.9684 |
104
+ | 0.6362 | 12.0 | 600 | 0.1720 | 0.9630 | 0.9693 | 0.9661 | 0.9629 |
105
+ | 0.6362 | 14.0 | 700 | 0.1528 | 0.9607 | 0.9710 | 0.9658 | 0.9675 |
106
+ | 0.6362 | 16.0 | 800 | 0.1460 | 0.9638 | 0.9718 | 0.9678 | 0.9680 |
107
+ | 0.6362 | 18.0 | 900 | 0.1609 | 0.9614 | 0.9702 | 0.9658 | 0.9648 |
108
+ | 0.0536 | 20.0 | 1000 | 0.1517 | 0.9752 | 0.9785 | 0.9768 | 0.9739 |
109
+ | 0.0536 | 22.0 | 1100 | 0.1901 | 0.9614 | 0.9693 | 0.9653 | 0.9657 |
110
+ | 0.0536 | 24.0 | 1200 | 0.1867 | 0.9638 | 0.9718 | 0.9678 | 0.9666 |
111
+
112
+
113
+ ### Framework versions
114
+
115
+ - Transformers 4.44.2
116
+ - Pytorch 2.4.0+cu118
117
+ - Datasets 2.21.0
118
+ - Tokenizers 0.19.1
config.json ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_attn_implementation_autoset": true,
3
+ "_name_or_path": "mp-02/layoutlmv3-base-cord",
4
+ "architectures": [
5
+ "LayoutLMv3ForTokenClassification"
6
+ ],
7
+ "attention_probs_dropout_prob": 0.1,
8
+ "bos_token_id": 0,
9
+ "classifier_dropout": null,
10
+ "coordinate_size": 128,
11
+ "eos_token_id": 2,
12
+ "has_relative_attention_bias": true,
13
+ "has_spatial_attention_bias": true,
14
+ "hidden_act": "gelu",
15
+ "hidden_dropout_prob": 0.1,
16
+ "hidden_size": 768,
17
+ "id2label": {
18
+ "0": "O",
19
+ "1": "B-MENU.CNT",
20
+ "2": "B-MENU.DISCOUNTPRICE",
21
+ "3": "B-MENU.NM",
22
+ "4": "B-MENU.NUM",
23
+ "5": "B-MENU.PRICE",
24
+ "6": "B-MENU.SUB.CNT",
25
+ "7": "B-MENU.SUB.NM",
26
+ "8": "B-MENU.SUB.PRICE",
27
+ "9": "B-MENU.UNITPRICE",
28
+ "10": "B-SUB_TOTAL.DISCOUNT_PRICE",
29
+ "11": "B-SUB_TOTAL.ETC",
30
+ "12": "B-SUB_TOTAL.SERVICE_PRICE",
31
+ "13": "B-SUB_TOTAL.SUBTOTAL_PRICE",
32
+ "14": "B-SUB_TOTAL.TAX_PRICE",
33
+ "15": "B-TOTAL.CASHPRICE",
34
+ "16": "B-TOTAL.CHANGEPRICE",
35
+ "17": "B-TOTAL.CREDITCARDPRICE",
36
+ "18": "B-TOTAL.MENUQTY_CNT",
37
+ "19": "B-TOTAL.TOTAL_PRICE",
38
+ "20": "I-MENU.CNT",
39
+ "21": "I-MENU.DISCOUNTPRICE",
40
+ "22": "I-MENU.NM",
41
+ "23": "I-MENU.NUM",
42
+ "24": "I-MENU.PRICE",
43
+ "25": "I-MENU.SUB.CNT",
44
+ "26": "I-MENU.SUB.NM",
45
+ "27": "I-MENU.SUB.PRICE",
46
+ "28": "I-MENU.UNITPRICE",
47
+ "29": "I-SUB_TOTAL.DISCOUNT_PRICE",
48
+ "30": "I-SUB_TOTAL.ETC",
49
+ "31": "I-SUB_TOTAL.SERVICE_PRICE",
50
+ "32": "I-SUB_TOTAL.SUBTOTAL_PRICE",
51
+ "33": "I-SUB_TOTAL.TAX_PRICE",
52
+ "34": "I-TOTAL.CASHPRICE",
53
+ "35": "I-TOTAL.CHANGEPRICE",
54
+ "36": "I-TOTAL.CREDITCARDPRICE",
55
+ "37": "I-TOTAL.MENUQTY_CNT",
56
+ "38": "I-TOTAL.TOTAL_PRICE"
57
+ },
58
+ "initializer_range": 0.02,
59
+ "input_size": 224,
60
+ "intermediate_size": 3072,
61
+ "label2id": {
62
+ "B-MENU.CNT": 1,
63
+ "B-MENU.DISCOUNTPRICE": 2,
64
+ "B-MENU.NM": 3,
65
+ "B-MENU.NUM": 4,
66
+ "B-MENU.PRICE": 5,
67
+ "B-MENU.SUB.CNT": 6,
68
+ "B-MENU.SUB.NM": 7,
69
+ "B-MENU.SUB.PRICE": 8,
70
+ "B-MENU.UNITPRICE": 9,
71
+ "B-SUB_TOTAL.DISCOUNT_PRICE": 10,
72
+ "B-SUB_TOTAL.ETC": 11,
73
+ "B-SUB_TOTAL.SERVICE_PRICE": 12,
74
+ "B-SUB_TOTAL.SUBTOTAL_PRICE": 13,
75
+ "B-SUB_TOTAL.TAX_PRICE": 14,
76
+ "B-TOTAL.CASHPRICE": 15,
77
+ "B-TOTAL.CHANGEPRICE": 16,
78
+ "B-TOTAL.CREDITCARDPRICE": 17,
79
+ "B-TOTAL.MENUQTY_CNT": 18,
80
+ "B-TOTAL.TOTAL_PRICE": 19,
81
+ "I-MENU.CNT": 20,
82
+ "I-MENU.DISCOUNTPRICE": 21,
83
+ "I-MENU.NM": 22,
84
+ "I-MENU.NUM": 23,
85
+ "I-MENU.PRICE": 24,
86
+ "I-MENU.SUB.CNT": 25,
87
+ "I-MENU.SUB.NM": 26,
88
+ "I-MENU.SUB.PRICE": 27,
89
+ "I-MENU.UNITPRICE": 28,
90
+ "I-SUB_TOTAL.DISCOUNT_PRICE": 29,
91
+ "I-SUB_TOTAL.ETC": 30,
92
+ "I-SUB_TOTAL.SERVICE_PRICE": 31,
93
+ "I-SUB_TOTAL.SUBTOTAL_PRICE": 32,
94
+ "I-SUB_TOTAL.TAX_PRICE": 33,
95
+ "I-TOTAL.CASHPRICE": 34,
96
+ "I-TOTAL.CHANGEPRICE": 35,
97
+ "I-TOTAL.CREDITCARDPRICE": 36,
98
+ "I-TOTAL.MENUQTY_CNT": 37,
99
+ "I-TOTAL.TOTAL_PRICE": 38,
100
+ "O": 0
101
+ },
102
+ "layer_norm_eps": 1e-05,
103
+ "max_2d_position_embeddings": 1024,
104
+ "max_position_embeddings": 514,
105
+ "max_rel_2d_pos": 256,
106
+ "max_rel_pos": 128,
107
+ "model_type": "layoutlmv3",
108
+ "num_attention_heads": 12,
109
+ "num_channels": 3,
110
+ "num_hidden_layers": 12,
111
+ "pad_token_id": 1,
112
+ "patch_size": 16,
113
+ "rel_2d_pos_bins": 64,
114
+ "rel_pos_bins": 32,
115
+ "second_input_size": 112,
116
+ "shape_size": 128,
117
+ "text_embed": true,
118
+ "torch_dtype": "float32",
119
+ "transformers_version": "4.49.0",
120
+ "type_vocab_size": 1,
121
+ "visual_embed": true,
122
+ "vocab_size": 50265
123
+ }
merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
onnx/model.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d72c080016e37a515a7b6c9af49328dff2560e72712c6c9094638226ff7ecb35
3
+ size 504186327
onnx/model_bnb4.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:202ce9d338fa0dc08558e1cafe4d2760ba6d9c11dd2e9bf43fcb673b8db7d7d4
3
+ size 210104478
onnx/model_fp16.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:45a37aed5317e3b1c05403b16dabd3c10943b6b32c903210a6b805f719dec1ad
3
+ size 252293007
onnx/model_int8.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fdbbfdf0d1da80ee1ad383c60b003a4ed44b118e682ba8d519e35207fb9bcda1
3
+ size 127703830
onnx/model_q4.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:347c348886ec00525dbf8f936e721340e7afda8aead805f49aead67bc1a00ca0
3
+ size 215451087
onnx/model_q4f16.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fb330f44a5c0c0c389e17c944b2cc7ea016dedbcd825d01509a1718e3debdba4
3
+ size 129319578
onnx/model_quantized.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:85cc9aa6ae5b1290c504cda7e86baed214b046ea6281ea9a1a20c7c27a6697bb
3
+ size 127703830
onnx/model_uint8.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:85cc9aa6ae5b1290c504cda7e86baed214b046ea6281ea9a1a20c7c27a6697bb
3
+ size 127703830
preprocessor_config.json ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "apply_ocr": false,
3
+ "do_normalize": true,
4
+ "do_rescale": true,
5
+ "do_resize": true,
6
+ "image_mean": [
7
+ 0.5,
8
+ 0.5,
9
+ 0.5
10
+ ],
11
+ "image_processor_type": "LayoutLMv3FeatureExtractor",
12
+ "image_std": [
13
+ 0.5,
14
+ 0.5,
15
+ 0.5
16
+ ],
17
+ "ocr_lang": null,
18
+ "processor_class": "LayoutLMv3Processor",
19
+ "resample": 2,
20
+ "rescale_factor": 0.00392156862745098,
21
+ "size": {
22
+ "height": 224,
23
+ "width": 224
24
+ },
25
+ "tesseract_config": ""
26
+ }
quantize_config.json ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "modes": [
3
+ "fp16",
4
+ "q8",
5
+ "int8",
6
+ "uint8",
7
+ "q4",
8
+ "q4f16",
9
+ "bnb4"
10
+ ],
11
+ "per_channel": true,
12
+ "reduce_range": true,
13
+ "block_size": null,
14
+ "is_symmetric": true,
15
+ "accuracy_level": null,
16
+ "quant_type": 1,
17
+ "op_block_list": null
18
+ }
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,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": true,
3
+ "added_tokens_decoder": {
4
+ "0": {
5
+ "content": "<s>",
6
+ "lstrip": false,
7
+ "normalized": true,
8
+ "rstrip": false,
9
+ "single_word": false,
10
+ "special": true
11
+ },
12
+ "1": {
13
+ "content": "<pad>",
14
+ "lstrip": false,
15
+ "normalized": true,
16
+ "rstrip": false,
17
+ "single_word": false,
18
+ "special": true
19
+ },
20
+ "2": {
21
+ "content": "</s>",
22
+ "lstrip": false,
23
+ "normalized": true,
24
+ "rstrip": false,
25
+ "single_word": false,
26
+ "special": true
27
+ },
28
+ "3": {
29
+ "content": "<unk>",
30
+ "lstrip": false,
31
+ "normalized": true,
32
+ "rstrip": false,
33
+ "single_word": false,
34
+ "special": true
35
+ },
36
+ "50264": {
37
+ "content": "<mask>",
38
+ "lstrip": true,
39
+ "normalized": true,
40
+ "rstrip": false,
41
+ "single_word": false,
42
+ "special": true
43
+ }
44
+ },
45
+ "apply_ocr": false,
46
+ "bos_token": "<s>",
47
+ "clean_up_tokenization_spaces": true,
48
+ "cls_token": "<s>",
49
+ "cls_token_box": [
50
+ 0,
51
+ 0,
52
+ 0,
53
+ 0
54
+ ],
55
+ "eos_token": "</s>",
56
+ "errors": "replace",
57
+ "extra_special_tokens": {},
58
+ "mask_token": "<mask>",
59
+ "model_max_length": 512,
60
+ "only_label_first_subword": true,
61
+ "pad_token": "<pad>",
62
+ "pad_token_box": [
63
+ 0,
64
+ 0,
65
+ 0,
66
+ 0
67
+ ],
68
+ "pad_token_label": -100,
69
+ "processor_class": "LayoutLMv3Processor",
70
+ "sep_token": "</s>",
71
+ "sep_token_box": [
72
+ 0,
73
+ 0,
74
+ 0,
75
+ 0
76
+ ],
77
+ "tokenizer_class": "LayoutLMv3Tokenizer",
78
+ "trim_offsets": true,
79
+ "unk_token": "<unk>",
80
+ "use_fast": true
81
+ }
vocab.json ADDED
The diff for this file is too large to render. See raw diff