team-data-ktzh commited on
Commit
4be246d
1 Parent(s): d75a46e

Upload model

Browse files
README.md ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: span-marker
3
+ tags:
4
+ - span-marker
5
+ - token-classification
6
+ - ner
7
+ - named-entity-recognition
8
+ - generated_from_span_marker_trainer
9
+ metrics:
10
+ - precision
11
+ - recall
12
+ - f1
13
+ widget: []
14
+ pipeline_tag: token-classification
15
+ ---
16
+
17
+ # SpanMarker
18
+
19
+ This is a [SpanMarker](https://github.com/tomaarsen/SpanMarkerNER) model that can be used for Named Entity Recognition.
20
+
21
+ ## Model Details
22
+
23
+ ### Model Description
24
+ - **Model Type:** SpanMarker
25
+ <!-- - **Encoder:** [Unknown](https://huggingface.co/unknown) -->
26
+ - **Maximum Sequence Length:** 256 tokens
27
+ - **Maximum Entity Length:** 8 words
28
+ <!-- - **Training Dataset:** [Unknown](https://huggingface.co/datasets/unknown) -->
29
+ <!-- - **Language:** Unknown -->
30
+ <!-- - **License:** Unknown -->
31
+
32
+ ### Model Sources
33
+
34
+ - **Repository:** [SpanMarker on GitHub](https://github.com/tomaarsen/SpanMarkerNER)
35
+ - **Thesis:** [SpanMarker For Named Entity Recognition](https://raw.githubusercontent.com/tomaarsen/SpanMarkerNER/main/thesis.pdf)
36
+
37
+ ## Uses
38
+
39
+ ### Direct Use for Inference
40
+
41
+ ```python
42
+ from span_marker import SpanMarkerModel
43
+
44
+ # Download from the 🤗 Hub
45
+ model = SpanMarkerModel.from_pretrained("span_marker_model_id")
46
+ # Run inference
47
+ entities = model.predict("None")
48
+ ```
49
+
50
+ ### Downstream Use
51
+ You can finetune this model on your own dataset.
52
+
53
+ <details><summary>Click to expand</summary>
54
+
55
+ ```python
56
+ from span_marker import SpanMarkerModel, Trainer
57
+
58
+ # Download from the 🤗 Hub
59
+ model = SpanMarkerModel.from_pretrained("span_marker_model_id")
60
+
61
+ # Specify a Dataset with "tokens" and "ner_tag" columns
62
+ dataset = load_dataset("conll2003") # For example CoNLL2003
63
+
64
+ # Initialize a Trainer using the pretrained model & dataset
65
+ trainer = Trainer(
66
+ model=model,
67
+ train_dataset=dataset["train"],
68
+ eval_dataset=dataset["validation"],
69
+ )
70
+ trainer.train()
71
+ trainer.save_model("span_marker_model_id-finetuned")
72
+ ```
73
+ </details>
74
+
75
+ <!--
76
+ ### Out-of-Scope Use
77
+
78
+ *List how the model may foreseeably be misused and address what users ought not to do with the model.*
79
+ -->
80
+
81
+ <!--
82
+ ## Bias, Risks and Limitations
83
+
84
+ *What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
85
+ -->
86
+
87
+ <!--
88
+ ### Recommendations
89
+
90
+ *What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
91
+ -->
92
+
93
+ ## Training Details
94
+
95
+ ### Framework Versions
96
+ - Python: 3.11.7
97
+ - SpanMarker: 1.5.0
98
+ - Transformers: 4.36.2
99
+ - PyTorch: 2.2.1
100
+ - Datasets: 2.16.1
101
+ - Tokenizers: 0.15.0
102
+
103
+ ## Citation
104
+
105
+ ### BibTeX
106
+ ```
107
+ @software{Aarsen_SpanMarker,
108
+ author = {Aarsen, Tom},
109
+ license = {Apache-2.0},
110
+ title = {{SpanMarker for Named Entity Recognition}},
111
+ url = {https://github.com/tomaarsen/SpanMarkerNER}
112
+ }
113
+ ```
114
+
115
+ <!--
116
+ ## Glossary
117
+
118
+ *Clearly define terms in order to be accessible across audiences.*
119
+ -->
120
+
121
+ <!--
122
+ ## Model Card Authors
123
+
124
+ *Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
125
+ -->
126
+
127
+ <!--
128
+ ## Model Card Contact
129
+
130
+ *Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
131
+ -->
added_tokens.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "<end>": 31103,
3
+ "<start>": 31102
4
+ }
config.json ADDED
@@ -0,0 +1,207 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "models/span-marker-ktzh-stazh/span-marker-ktzh-stazh/",
3
+ "architectures": [
4
+ "SpanMarkerModel"
5
+ ],
6
+ "encoder": {
7
+ "_name_or_path": "deepset/gelectra-large",
8
+ "add_cross_attention": false,
9
+ "architectures": [
10
+ "ElectraForPreTraining"
11
+ ],
12
+ "attention_probs_dropout_prob": 0.1,
13
+ "bad_words_ids": null,
14
+ "begin_suppress_tokens": null,
15
+ "bos_token_id": null,
16
+ "chunk_size_feed_forward": 0,
17
+ "classifier_dropout": null,
18
+ "cross_attention_hidden_size": null,
19
+ "decoder_start_token_id": null,
20
+ "diversity_penalty": 0.0,
21
+ "do_sample": false,
22
+ "early_stopping": false,
23
+ "embedding_size": 1024,
24
+ "encoder_no_repeat_ngram_size": 0,
25
+ "eos_token_id": null,
26
+ "exponential_decay_length_penalty": null,
27
+ "finetuning_task": null,
28
+ "forced_bos_token_id": null,
29
+ "forced_eos_token_id": null,
30
+ "hidden_act": "gelu",
31
+ "hidden_dropout_prob": 0.1,
32
+ "hidden_size": 1024,
33
+ "id2label": {
34
+ "0": "O",
35
+ "1": "B-LOC",
36
+ "2": "I-LOC",
37
+ "3": "B-LOCderiv",
38
+ "4": "I-LOCderiv",
39
+ "5": "B-LOCpart",
40
+ "6": "I-LOCpart",
41
+ "7": "B-ORG",
42
+ "8": "I-ORG",
43
+ "9": "B-ORGderiv",
44
+ "10": "I-ORGderiv",
45
+ "11": "B-ORGpart",
46
+ "12": "I-ORGpart",
47
+ "13": "B-OTH",
48
+ "14": "I-OTH",
49
+ "15": "B-OTHderiv",
50
+ "16": "I-OTHderiv",
51
+ "17": "B-OTHpart",
52
+ "18": "I-OTHpart",
53
+ "19": "B-PER",
54
+ "20": "I-PER",
55
+ "21": "B-PERderiv",
56
+ "22": "I-PERderiv",
57
+ "23": "B-PERpart",
58
+ "24": "I-PERpart"
59
+ },
60
+ "initializer_range": 0.02,
61
+ "intermediate_size": 4096,
62
+ "is_decoder": false,
63
+ "is_encoder_decoder": false,
64
+ "label2id": {
65
+ "B-LOC": 1,
66
+ "B-LOCderiv": 3,
67
+ "B-LOCpart": 5,
68
+ "B-ORG": 7,
69
+ "B-ORGderiv": 9,
70
+ "B-ORGpart": 11,
71
+ "B-OTH": 13,
72
+ "B-OTHderiv": 15,
73
+ "B-OTHpart": 17,
74
+ "B-PER": 19,
75
+ "B-PERderiv": 21,
76
+ "B-PERpart": 23,
77
+ "I-LOC": 2,
78
+ "I-LOCderiv": 4,
79
+ "I-LOCpart": 6,
80
+ "I-ORG": 8,
81
+ "I-ORGderiv": 10,
82
+ "I-ORGpart": 12,
83
+ "I-OTH": 14,
84
+ "I-OTHderiv": 16,
85
+ "I-OTHpart": 18,
86
+ "I-PER": 20,
87
+ "I-PERderiv": 22,
88
+ "I-PERpart": 24,
89
+ "O": 0
90
+ },
91
+ "layer_norm_eps": 1e-12,
92
+ "length_penalty": 1.0,
93
+ "max_length": 20,
94
+ "max_position_embeddings": 512,
95
+ "min_length": 0,
96
+ "model_type": "electra",
97
+ "no_repeat_ngram_size": 0,
98
+ "num_attention_heads": 16,
99
+ "num_beam_groups": 1,
100
+ "num_beams": 1,
101
+ "num_hidden_layers": 24,
102
+ "num_return_sequences": 1,
103
+ "output_attentions": false,
104
+ "output_hidden_states": false,
105
+ "output_scores": false,
106
+ "pad_token_id": 0,
107
+ "position_embedding_type": "absolute",
108
+ "prefix": null,
109
+ "problem_type": null,
110
+ "pruned_heads": {},
111
+ "remove_invalid_values": false,
112
+ "repetition_penalty": 1.0,
113
+ "return_dict": true,
114
+ "return_dict_in_generate": false,
115
+ "sep_token_id": null,
116
+ "summary_activation": "gelu",
117
+ "summary_last_dropout": 0.1,
118
+ "summary_type": "first",
119
+ "summary_use_proj": true,
120
+ "suppress_tokens": null,
121
+ "task_specific_params": null,
122
+ "temperature": 1.0,
123
+ "tf_legacy_loss": false,
124
+ "tie_encoder_decoder": false,
125
+ "tie_word_embeddings": true,
126
+ "tokenizer_class": null,
127
+ "top_k": 50,
128
+ "top_p": 1.0,
129
+ "torch_dtype": null,
130
+ "torchscript": false,
131
+ "transformers_version": "4.31.0",
132
+ "type_vocab_size": 2,
133
+ "typical_p": 1.0,
134
+ "use_bfloat16": false,
135
+ "use_cache": true,
136
+ "vocab_size": 31104
137
+ },
138
+ "entity_max_length": 8,
139
+ "id2label": {
140
+ "0": "O",
141
+ "1": "LOC",
142
+ "2": "LOCderiv",
143
+ "3": "LOCpart",
144
+ "4": "ORG",
145
+ "5": "ORGderiv",
146
+ "6": "ORGpart",
147
+ "7": "OTH",
148
+ "8": "OTHderiv",
149
+ "9": "OTHpart",
150
+ "10": "PER",
151
+ "11": "PERderiv",
152
+ "12": "PERpart"
153
+ },
154
+ "id2reduced_id": {
155
+ "0": 0,
156
+ "1": 1,
157
+ "2": 1,
158
+ "3": 2,
159
+ "4": 2,
160
+ "5": 3,
161
+ "6": 3,
162
+ "7": 4,
163
+ "8": 4,
164
+ "9": 5,
165
+ "10": 5,
166
+ "11": 6,
167
+ "12": 6,
168
+ "13": 7,
169
+ "14": 7,
170
+ "15": 8,
171
+ "16": 8,
172
+ "17": 9,
173
+ "18": 9,
174
+ "19": 10,
175
+ "20": 10,
176
+ "21": 11,
177
+ "22": 11,
178
+ "23": 12,
179
+ "24": 12
180
+ },
181
+ "label2id": {
182
+ "LOC": 1,
183
+ "LOCderiv": 2,
184
+ "LOCpart": 3,
185
+ "O": 0,
186
+ "ORG": 4,
187
+ "ORGderiv": 5,
188
+ "ORGpart": 6,
189
+ "OTH": 7,
190
+ "OTHderiv": 8,
191
+ "OTHpart": 9,
192
+ "PER": 10,
193
+ "PERderiv": 11,
194
+ "PERpart": 12
195
+ },
196
+ "marker_max_length": 128,
197
+ "max_next_context": null,
198
+ "max_prev_context": null,
199
+ "model_max_length": 256,
200
+ "model_max_length_default": 512,
201
+ "model_type": "span-marker",
202
+ "span_marker_version": "1.2.4",
203
+ "torch_dtype": "float32",
204
+ "trained_with_document_context": false,
205
+ "transformers_version": "4.36.2",
206
+ "vocab_size": 31104
207
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:74f09d5a4bd2384587bf0dbef1daa3310de68b9cba7130571cbf28f84b9c5f74
3
+ size 1338907540
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,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": true,
3
+ "added_tokens_decoder": {
4
+ "0": {
5
+ "content": "[PAD]",
6
+ "lstrip": false,
7
+ "normalized": false,
8
+ "rstrip": false,
9
+ "single_word": false,
10
+ "special": true
11
+ },
12
+ "101": {
13
+ "content": "[UNK]",
14
+ "lstrip": false,
15
+ "normalized": false,
16
+ "rstrip": false,
17
+ "single_word": false,
18
+ "special": true
19
+ },
20
+ "102": {
21
+ "content": "[CLS]",
22
+ "lstrip": false,
23
+ "normalized": false,
24
+ "rstrip": false,
25
+ "single_word": false,
26
+ "special": true
27
+ },
28
+ "103": {
29
+ "content": "[SEP]",
30
+ "lstrip": false,
31
+ "normalized": false,
32
+ "rstrip": false,
33
+ "single_word": false,
34
+ "special": true
35
+ },
36
+ "104": {
37
+ "content": "[MASK]",
38
+ "lstrip": false,
39
+ "normalized": false,
40
+ "rstrip": false,
41
+ "single_word": false,
42
+ "special": true
43
+ },
44
+ "31102": {
45
+ "content": "<start>",
46
+ "lstrip": false,
47
+ "normalized": false,
48
+ "rstrip": false,
49
+ "single_word": false,
50
+ "special": true
51
+ },
52
+ "31103": {
53
+ "content": "<end>",
54
+ "lstrip": false,
55
+ "normalized": false,
56
+ "rstrip": false,
57
+ "single_word": false,
58
+ "special": true
59
+ }
60
+ },
61
+ "clean_up_tokenization_spaces": true,
62
+ "cls_token": "[CLS]",
63
+ "do_basic_tokenize": true,
64
+ "do_lower_case": false,
65
+ "entity_max_length": 8,
66
+ "mask_token": "[MASK]",
67
+ "max_len": 512,
68
+ "model_max_length": 256,
69
+ "never_split": null,
70
+ "pad_token": "[PAD]",
71
+ "sep_token": "[SEP]",
72
+ "strip_accents": false,
73
+ "tokenize_chinese_chars": true,
74
+ "tokenizer_class": "ElectraTokenizer",
75
+ "unk_token": "[UNK]"
76
+ }
vocab.txt ADDED
The diff for this file is too large to render. See raw diff