guishe commited on
Commit
108bd5c
1 Parent(s): d45e199

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.10.8
97
+ - SpanMarker: 1.5.0
98
+ - Transformers: 4.28.0
99
+ - PyTorch: 1.13.1+cu117
100
+ - Datasets: 2.14.4
101
+ - Tokenizers: 0.13.3
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>": 50266,
3
+ "<start>": 50265
4
+ }
config.json ADDED
@@ -0,0 +1,229 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "/root/controversies-ops/models/span_marker_generic-ner-v1_fewnerd_fine_super/checkpoint-final",
3
+ "architectures": [
4
+ "SpanMarkerModel"
5
+ ],
6
+ "encoder": {
7
+ "_name_or_path": "numind/generic-entity_recognition-v1",
8
+ "add_cross_attention": false,
9
+ "architectures": [
10
+ "RobertaModel"
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": "O",
34
+ "1": "art-broadcastprogram",
35
+ "2": "art-film",
36
+ "3": "art-music",
37
+ "4": "art-other",
38
+ "5": "art-painting",
39
+ "6": "art-writtenart",
40
+ "7": "building-airport",
41
+ "8": "building-hospital",
42
+ "9": "building-hotel",
43
+ "10": "building-library",
44
+ "11": "building-other",
45
+ "12": "building-restaurant",
46
+ "13": "building-sportsfacility",
47
+ "14": "building-theater",
48
+ "15": "event-attack/battle/war/militaryconflict",
49
+ "16": "event-disaster",
50
+ "17": "event-election",
51
+ "18": "event-other",
52
+ "19": "event-protest",
53
+ "20": "event-sportsevent",
54
+ "21": "location-GPE",
55
+ "22": "location-bodiesofwater",
56
+ "23": "location-island",
57
+ "24": "location-mountain",
58
+ "25": "location-other",
59
+ "26": "location-park",
60
+ "27": "location-road/railway/highway/transit",
61
+ "28": "organization-company",
62
+ "29": "organization-education",
63
+ "30": "organization-government/governmentagency",
64
+ "31": "organization-media/newspaper",
65
+ "32": "organization-other",
66
+ "33": "organization-politicalparty",
67
+ "34": "organization-religion",
68
+ "35": "organization-showorganization",
69
+ "36": "organization-sportsleague",
70
+ "37": "organization-sportsteam",
71
+ "38": "other-astronomything",
72
+ "39": "other-award",
73
+ "40": "other-biologything",
74
+ "41": "other-chemicalthing",
75
+ "42": "other-currency",
76
+ "43": "other-disease",
77
+ "44": "other-educationaldegree",
78
+ "45": "other-god",
79
+ "46": "other-language",
80
+ "47": "other-law",
81
+ "48": "other-livingthing",
82
+ "49": "other-medical",
83
+ "50": "person-actor",
84
+ "51": "person-artist/author",
85
+ "52": "person-athlete",
86
+ "53": "person-director",
87
+ "54": "person-other",
88
+ "55": "person-politician",
89
+ "56": "person-scholar",
90
+ "57": "person-soldier",
91
+ "58": "product-airplane",
92
+ "59": "product-car",
93
+ "60": "product-food",
94
+ "61": "product-game",
95
+ "62": "product-other",
96
+ "63": "product-ship",
97
+ "64": "product-software",
98
+ "65": "product-train",
99
+ "66": "product-weapon"
100
+ },
101
+ "initializer_range": 0.02,
102
+ "intermediate_size": 3072,
103
+ "is_decoder": false,
104
+ "is_encoder_decoder": false,
105
+ "label2id": {
106
+ "O": 0,
107
+ "art-broadcastprogram": 1,
108
+ "art-film": 2,
109
+ "art-music": 3,
110
+ "art-other": 4,
111
+ "art-painting": 5,
112
+ "art-writtenart": 6,
113
+ "building-airport": 7,
114
+ "building-hospital": 8,
115
+ "building-hotel": 9,
116
+ "building-library": 10,
117
+ "building-other": 11,
118
+ "building-restaurant": 12,
119
+ "building-sportsfacility": 13,
120
+ "building-theater": 14,
121
+ "event-attack/battle/war/militaryconflict": 15,
122
+ "event-disaster": 16,
123
+ "event-election": 17,
124
+ "event-other": 18,
125
+ "event-protest": 19,
126
+ "event-sportsevent": 20,
127
+ "location-GPE": 21,
128
+ "location-bodiesofwater": 22,
129
+ "location-island": 23,
130
+ "location-mountain": 24,
131
+ "location-other": 25,
132
+ "location-park": 26,
133
+ "location-road/railway/highway/transit": 27,
134
+ "organization-company": 28,
135
+ "organization-education": 29,
136
+ "organization-government/governmentagency": 30,
137
+ "organization-media/newspaper": 31,
138
+ "organization-other": 32,
139
+ "organization-politicalparty": 33,
140
+ "organization-religion": 34,
141
+ "organization-showorganization": 35,
142
+ "organization-sportsleague": 36,
143
+ "organization-sportsteam": 37,
144
+ "other-astronomything": 38,
145
+ "other-award": 39,
146
+ "other-biologything": 40,
147
+ "other-chemicalthing": 41,
148
+ "other-currency": 42,
149
+ "other-disease": 43,
150
+ "other-educationaldegree": 44,
151
+ "other-god": 45,
152
+ "other-language": 46,
153
+ "other-law": 47,
154
+ "other-livingthing": 48,
155
+ "other-medical": 49,
156
+ "person-actor": 50,
157
+ "person-artist/author": 51,
158
+ "person-athlete": 52,
159
+ "person-director": 53,
160
+ "person-other": 54,
161
+ "person-politician": 55,
162
+ "person-scholar": 56,
163
+ "person-soldier": 57,
164
+ "product-airplane": 58,
165
+ "product-car": 59,
166
+ "product-food": 60,
167
+ "product-game": 61,
168
+ "product-other": 62,
169
+ "product-ship": 63,
170
+ "product-software": 64,
171
+ "product-train": 65,
172
+ "product-weapon": 66
173
+ },
174
+ "layer_norm_eps": 1e-05,
175
+ "length_penalty": 1.0,
176
+ "max_length": 20,
177
+ "max_position_embeddings": 514,
178
+ "min_length": 0,
179
+ "model_type": "roberta",
180
+ "no_repeat_ngram_size": 0,
181
+ "num_attention_heads": 12,
182
+ "num_beam_groups": 1,
183
+ "num_beams": 1,
184
+ "num_hidden_layers": 12,
185
+ "num_return_sequences": 1,
186
+ "output_attentions": false,
187
+ "output_hidden_states": false,
188
+ "output_scores": false,
189
+ "pad_token_id": 1,
190
+ "position_embedding_type": "absolute",
191
+ "prefix": null,
192
+ "problem_type": null,
193
+ "pruned_heads": {},
194
+ "remove_invalid_values": false,
195
+ "repetition_penalty": 1.0,
196
+ "return_dict": true,
197
+ "return_dict_in_generate": false,
198
+ "sep_token_id": null,
199
+ "suppress_tokens": null,
200
+ "task_specific_params": null,
201
+ "temperature": 1.0,
202
+ "tf_legacy_loss": false,
203
+ "tie_encoder_decoder": false,
204
+ "tie_word_embeddings": true,
205
+ "tokenizer_class": null,
206
+ "top_k": 50,
207
+ "top_p": 1.0,
208
+ "torch_dtype": "float32",
209
+ "torchscript": false,
210
+ "transformers_version": "4.28.0",
211
+ "type_vocab_size": 1,
212
+ "typical_p": 1.0,
213
+ "use_bfloat16": false,
214
+ "use_cache": true,
215
+ "vocab_size": 50267
216
+ },
217
+ "entity_max_length": 8,
218
+ "marker_max_length": 128,
219
+ "max_next_context": null,
220
+ "max_prev_context": null,
221
+ "model_max_length": 256,
222
+ "model_max_length_default": 512,
223
+ "model_type": "span-marker",
224
+ "span_marker_version": "1.5.0",
225
+ "torch_dtype": "float32",
226
+ "trained_with_document_context": false,
227
+ "transformers_version": "4.28.0",
228
+ "vocab_size": 50267
229
+ }
merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d884bbeb474f472d0c729cb07c27b97e7ac948ae75e6014eda04003fa37d95db
3
+ size 499071157
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,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": true,
3
+ "bos_token": {
4
+ "__type": "AddedToken",
5
+ "content": "<s>",
6
+ "lstrip": false,
7
+ "normalized": true,
8
+ "rstrip": false,
9
+ "single_word": false
10
+ },
11
+ "clean_up_tokenization_spaces": true,
12
+ "cls_token": {
13
+ "__type": "AddedToken",
14
+ "content": "<s>",
15
+ "lstrip": false,
16
+ "normalized": true,
17
+ "rstrip": false,
18
+ "single_word": false
19
+ },
20
+ "eos_token": {
21
+ "__type": "AddedToken",
22
+ "content": "</s>",
23
+ "lstrip": false,
24
+ "normalized": true,
25
+ "rstrip": false,
26
+ "single_word": false
27
+ },
28
+ "errors": "replace",
29
+ "mask_token": {
30
+ "__type": "AddedToken",
31
+ "content": "<mask>",
32
+ "lstrip": true,
33
+ "normalized": true,
34
+ "rstrip": false,
35
+ "single_word": false
36
+ },
37
+ "model_max_length": 512,
38
+ "pad_token": {
39
+ "__type": "AddedToken",
40
+ "content": "<pad>",
41
+ "lstrip": false,
42
+ "normalized": true,
43
+ "rstrip": false,
44
+ "single_word": false
45
+ },
46
+ "sep_token": {
47
+ "__type": "AddedToken",
48
+ "content": "</s>",
49
+ "lstrip": false,
50
+ "normalized": true,
51
+ "rstrip": false,
52
+ "single_word": false
53
+ },
54
+ "tokenizer_class": "RobertaTokenizer",
55
+ "trim_offsets": true,
56
+ "unk_token": {
57
+ "__type": "AddedToken",
58
+ "content": "<unk>",
59
+ "lstrip": false,
60
+ "normalized": true,
61
+ "rstrip": false,
62
+ "single_word": false
63
+ }
64
+ }
vocab.json ADDED
The diff for this file is too large to render. See raw diff