guishe commited on
Commit
63e4092
1 Parent(s): 4e6a904

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