imvladikon commited on
Commit
44610e2
1 Parent(s): 09f2b8b

Upload model

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
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:** 512 tokens
27
+ - **Maximum Entity Length:** 150 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.10.12
97
+ - SpanMarker: 1.5.0
98
+ - Transformers: 4.35.2
99
+ - PyTorch: 2.1.0+cu121
100
+ - Datasets: 2.16.1
101
+ - Tokenizers: 0.15.1
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
+ -->
config.json ADDED
@@ -0,0 +1,289 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "/content/xlm-roberta-base-ar-mafat-ner",
3
+ "architectures": [
4
+ "SpanMarkerModel"
5
+ ],
6
+ "encoder": {
7
+ "_name_or_path": "xlm-roberta-base",
8
+ "add_cross_attention": false,
9
+ "architectures": [
10
+ "XLMRobertaForMaskedLM"
11
+ ],
12
+ "attention_probs_dropout_prob": 0.1,
13
+ "bad_words_ids": null,
14
+ "begin_suppress_tokens": null,
15
+ "bos_token_id": 0,
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
+ "encoder_no_repeat_ngram_size": 0,
24
+ "eos_token_id": 2,
25
+ "exponential_decay_length_penalty": null,
26
+ "finetuning_task": null,
27
+ "forced_bos_token_id": null,
28
+ "forced_eos_token_id": null,
29
+ "hidden_act": "gelu",
30
+ "hidden_dropout_prob": 0.1,
31
+ "hidden_size": 768,
32
+ "id2label": {
33
+ "0": "U-ANG",
34
+ "1": "L-ANG",
35
+ "2": "B-ANG",
36
+ "3": "I-ANG",
37
+ "4": "U-DUC",
38
+ "5": "I-DUC",
39
+ "6": "L-DUC",
40
+ "7": "B-DUC",
41
+ "8": "I-EVE",
42
+ "9": "L-EVE",
43
+ "10": "B-EVE",
44
+ "11": "U-EVE",
45
+ "12": "L-FAC",
46
+ "13": "U-FAC",
47
+ "14": "I-FAC",
48
+ "15": "B-FAC",
49
+ "16": "L-GPE",
50
+ "17": "B-GPE",
51
+ "18": "I-GPE",
52
+ "19": "U-GPE",
53
+ "20": "U-INFORMAL",
54
+ "21": "I-INFORMAL",
55
+ "22": "L-INFORMAL",
56
+ "23": "B-INFORMAL",
57
+ "24": "U-LOC",
58
+ "25": "I-LOC",
59
+ "26": "L-LOC",
60
+ "27": "B-LOC",
61
+ "28": "I-MISC",
62
+ "29": "U-MISC",
63
+ "30": "B-MISC",
64
+ "31": "L-MISC",
65
+ "32": "O",
66
+ "33": "I-ORG",
67
+ "34": "L-ORG",
68
+ "35": "U-ORG",
69
+ "36": "B-ORG",
70
+ "37": "L-PER",
71
+ "38": "B-PER",
72
+ "39": "I-PER",
73
+ "40": "U-PER",
74
+ "41": "I-TIMEX",
75
+ "42": "L-TIMEX",
76
+ "43": "U-TIMEX",
77
+ "44": "B-TIMEX",
78
+ "45": "U-TTL",
79
+ "46": "L-TTL",
80
+ "47": "B-TTL",
81
+ "48": "I-TTL",
82
+ "49": "B-WOA",
83
+ "50": "L-WOA",
84
+ "51": "U-WOA",
85
+ "52": "I-WOA"
86
+ },
87
+ "initializer_range": 0.02,
88
+ "intermediate_size": 3072,
89
+ "is_decoder": false,
90
+ "is_encoder_decoder": false,
91
+ "label2id": {
92
+ "B-ANG": 2,
93
+ "B-DUC": 7,
94
+ "B-EVE": 10,
95
+ "B-FAC": 15,
96
+ "B-GPE": 17,
97
+ "B-INFORMAL": 23,
98
+ "B-LOC": 27,
99
+ "B-MISC": 30,
100
+ "B-ORG": 36,
101
+ "B-PER": 38,
102
+ "B-TIMEX": 44,
103
+ "B-TTL": 47,
104
+ "B-WOA": 49,
105
+ "I-ANG": 3,
106
+ "I-DUC": 5,
107
+ "I-EVE": 8,
108
+ "I-FAC": 14,
109
+ "I-GPE": 18,
110
+ "I-INFORMAL": 21,
111
+ "I-LOC": 25,
112
+ "I-MISC": 28,
113
+ "I-ORG": 33,
114
+ "I-PER": 39,
115
+ "I-TIMEX": 41,
116
+ "I-TTL": 48,
117
+ "I-WOA": 52,
118
+ "L-ANG": 1,
119
+ "L-DUC": 6,
120
+ "L-EVE": 9,
121
+ "L-FAC": 12,
122
+ "L-GPE": 16,
123
+ "L-INFORMAL": 22,
124
+ "L-LOC": 26,
125
+ "L-MISC": 31,
126
+ "L-ORG": 34,
127
+ "L-PER": 37,
128
+ "L-TIMEX": 42,
129
+ "L-TTL": 46,
130
+ "L-WOA": 50,
131
+ "O": 32,
132
+ "U-ANG": 0,
133
+ "U-DUC": 4,
134
+ "U-EVE": 11,
135
+ "U-FAC": 13,
136
+ "U-GPE": 19,
137
+ "U-INFORMAL": 20,
138
+ "U-LOC": 24,
139
+ "U-MISC": 29,
140
+ "U-ORG": 35,
141
+ "U-PER": 40,
142
+ "U-TIMEX": 43,
143
+ "U-TTL": 45,
144
+ "U-WOA": 51
145
+ },
146
+ "layer_norm_eps": 1e-05,
147
+ "length_penalty": 1.0,
148
+ "max_length": 20,
149
+ "max_position_embeddings": 514,
150
+ "min_length": 0,
151
+ "model_type": "xlm-roberta",
152
+ "no_repeat_ngram_size": 0,
153
+ "num_attention_heads": 12,
154
+ "num_beam_groups": 1,
155
+ "num_beams": 1,
156
+ "num_hidden_layers": 12,
157
+ "num_return_sequences": 1,
158
+ "output_attentions": false,
159
+ "output_hidden_states": false,
160
+ "output_past": true,
161
+ "output_scores": false,
162
+ "pad_token_id": 1,
163
+ "position_embedding_type": "absolute",
164
+ "prefix": null,
165
+ "problem_type": null,
166
+ "pruned_heads": {},
167
+ "remove_invalid_values": false,
168
+ "repetition_penalty": 1.0,
169
+ "return_dict": true,
170
+ "return_dict_in_generate": false,
171
+ "sep_token_id": null,
172
+ "suppress_tokens": null,
173
+ "task_specific_params": null,
174
+ "temperature": 1.0,
175
+ "tf_legacy_loss": false,
176
+ "tie_encoder_decoder": false,
177
+ "tie_word_embeddings": true,
178
+ "tokenizer_class": null,
179
+ "top_k": 50,
180
+ "top_p": 1.0,
181
+ "torch_dtype": null,
182
+ "torchscript": false,
183
+ "transformers_version": "4.36.2",
184
+ "type_vocab_size": 1,
185
+ "typical_p": 1.0,
186
+ "use_bfloat16": false,
187
+ "use_cache": true,
188
+ "vocab_size": 250008
189
+ },
190
+ "entity_max_length": 150,
191
+ "id2label": {
192
+ "0": "O",
193
+ "1": "ANG",
194
+ "2": "DUC",
195
+ "3": "EVE",
196
+ "4": "FAC",
197
+ "5": "GPE",
198
+ "6": "INFORMAL",
199
+ "7": "LOC",
200
+ "8": "MISC",
201
+ "9": "ORG",
202
+ "10": "PER",
203
+ "11": "TIMEX",
204
+ "12": "TTL",
205
+ "13": "WOA"
206
+ },
207
+ "id2reduced_id": {
208
+ "0": 1,
209
+ "1": 1,
210
+ "2": 1,
211
+ "3": 1,
212
+ "4": 2,
213
+ "5": 2,
214
+ "6": 2,
215
+ "7": 2,
216
+ "8": 3,
217
+ "9": 3,
218
+ "10": 3,
219
+ "11": 3,
220
+ "12": 4,
221
+ "13": 4,
222
+ "14": 4,
223
+ "15": 4,
224
+ "16": 5,
225
+ "17": 5,
226
+ "18": 5,
227
+ "19": 5,
228
+ "20": 6,
229
+ "21": 6,
230
+ "22": 6,
231
+ "23": 6,
232
+ "24": 7,
233
+ "25": 7,
234
+ "26": 7,
235
+ "27": 7,
236
+ "28": 8,
237
+ "29": 8,
238
+ "30": 8,
239
+ "31": 8,
240
+ "32": 0,
241
+ "33": 9,
242
+ "34": 9,
243
+ "35": 9,
244
+ "36": 9,
245
+ "37": 10,
246
+ "38": 10,
247
+ "39": 10,
248
+ "40": 10,
249
+ "41": 11,
250
+ "42": 11,
251
+ "43": 11,
252
+ "44": 11,
253
+ "45": 12,
254
+ "46": 12,
255
+ "47": 12,
256
+ "48": 12,
257
+ "49": 13,
258
+ "50": 13,
259
+ "51": 13,
260
+ "52": 13
261
+ },
262
+ "label2id": {
263
+ "ANG": 1,
264
+ "DUC": 2,
265
+ "EVE": 3,
266
+ "FAC": 4,
267
+ "GPE": 5,
268
+ "INFORMAL": 6,
269
+ "LOC": 7,
270
+ "MISC": 8,
271
+ "O": 0,
272
+ "ORG": 9,
273
+ "PER": 10,
274
+ "TIMEX": 11,
275
+ "TTL": 12,
276
+ "WOA": 13
277
+ },
278
+ "marker_max_length": 128,
279
+ "max_next_context": null,
280
+ "max_prev_context": null,
281
+ "model_max_length": null,
282
+ "model_max_length_default": 512,
283
+ "model_type": "span-marker",
284
+ "span_marker_version": "1.5.0",
285
+ "torch_dtype": "float32",
286
+ "trained_with_document_context": false,
287
+ "transformers_version": "4.35.2",
288
+ "vocab_size": 250008
289
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9268b25b46635a447205bcab9c84c40d47b4695d96e91c801b32b427cd881f41
3
+ size 1112303344
special_tokens_map.json ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": "<s>",
3
+ "cls_token": "<s>",
4
+ "eos_token": "</s>",
5
+ "mask_token": {
6
+ "content": "<mask>",
7
+ "lstrip": true,
8
+ "normalized": false,
9
+ "rstrip": false,
10
+ "single_word": false
11
+ },
12
+ "pad_token": "<pad>",
13
+ "sep_token": "</s>",
14
+ "unk_token": "<unk>"
15
+ }
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4744345123bc9dbf0daa1471ddf0d6b25a367b938235dcdbab1114b274a07887
3
+ size 17083318
tokenizer_config.json ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": true,
3
+ "added_tokens_decoder": {
4
+ "0": {
5
+ "content": "<s>",
6
+ "lstrip": false,
7
+ "normalized": false,
8
+ "rstrip": false,
9
+ "single_word": false,
10
+ "special": true
11
+ },
12
+ "1": {
13
+ "content": "<pad>",
14
+ "lstrip": false,
15
+ "normalized": false,
16
+ "rstrip": false,
17
+ "single_word": false,
18
+ "special": true
19
+ },
20
+ "2": {
21
+ "content": "</s>",
22
+ "lstrip": false,
23
+ "normalized": false,
24
+ "rstrip": false,
25
+ "single_word": false,
26
+ "special": true
27
+ },
28
+ "3": {
29
+ "content": "<unk>",
30
+ "lstrip": false,
31
+ "normalized": false,
32
+ "rstrip": false,
33
+ "single_word": false,
34
+ "special": true
35
+ },
36
+ "250001": {
37
+ "content": "<mask>",
38
+ "lstrip": true,
39
+ "normalized": false,
40
+ "rstrip": false,
41
+ "single_word": false,
42
+ "special": true
43
+ },
44
+ "250002": {
45
+ "content": "<start>",
46
+ "lstrip": false,
47
+ "normalized": false,
48
+ "rstrip": false,
49
+ "single_word": false,
50
+ "special": true
51
+ },
52
+ "250003": {
53
+ "content": "<end>",
54
+ "lstrip": false,
55
+ "normalized": false,
56
+ "rstrip": false,
57
+ "single_word": false,
58
+ "special": true
59
+ }
60
+ },
61
+ "bos_token": "<s>",
62
+ "clean_up_tokenization_spaces": true,
63
+ "cls_token": "<s>",
64
+ "eos_token": "</s>",
65
+ "mask_token": "<mask>",
66
+ "model_max_length": 512,
67
+ "pad_token": "<pad>",
68
+ "sep_token": "</s>",
69
+ "tokenizer_class": "XLMRobertaTokenizer",
70
+ "unk_token": "<unk>"
71
+ }