jackboyla commited on
Commit
dffa2c1
1 Parent(s): 55cf81c

End of training

Browse files
README.md ADDED
@@ -0,0 +1,233 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ license: cc-by-sa-4.0
5
+ library_name: span-marker
6
+ tags:
7
+ - span-marker
8
+ - token-classification
9
+ - ner
10
+ - named-entity-recognition
11
+ - generated_from_span_marker_trainer
12
+ datasets:
13
+ - DFKI-SLT/few-nerd
14
+ metrics:
15
+ - precision
16
+ - recall
17
+ - f1
18
+ widget:
19
+ - text: The Hebrew Union College libraries in Cincinnati and Los Angeles, the Library
20
+ of Congress in Washington, D.C ., the Jewish Theological Seminary in New York
21
+ City, and the Harvard University Library (which received donations of Deinard's
22
+ texts from Lucius Nathan Littauer, housed in Widener and Houghton libraries) also
23
+ have large collections of Deinard works.
24
+ - text: Abu Abd Allah Muhammad al-Idrisi (1099–1165 or 1166), the Moroccan Muslim
25
+ geographer, cartographer, Egyptologist and traveller who lived in Sicily at the
26
+ court of King Roger II, mentioned this island, naming it جزيرة مليطمة ("jazīrat
27
+ Malīṭma", "the island of Malitma ") on page 583 of his book "Nuzhat al-mushtaq
28
+ fi ihtiraq ghal afaq", otherwise known as The Book of Roger, considered a geographic
29
+ encyclopaedia of the medieval world.
30
+ - text: The font is also used in the logo of the American rock band Greta Van Fleet,
31
+ in the logo for Netflix show "Stranger Things ", and in the album art for rapper
32
+ Logic's album "Supermarket ".
33
+ - text: Caretaker manager George Goss led them on a run in the FA Cup, defeating Liverpool
34
+ in round 4, to reach the semi-final at Stamford Bridge, where they were defeated
35
+ 2–0 by Sheffield United on 28 March 1925.
36
+ - text: In 1991, the National Science Foundation (NSF), which manages the U.S . Antarctic
37
+ Program (US AP), honoured his memory by dedicating a state-of-the-art laboratory
38
+ complex in his name, the Albert P. Crary Science and Engineering Center (CSEC)
39
+ located in McMurdo Station.
40
+ pipeline_tag: token-classification
41
+ base_model: bert-base-cased
42
+ model-index:
43
+ - name: SpanMarker with bert-base-cased on DFKI-SLT/few-nerd
44
+ results:
45
+ - task:
46
+ type: token-classification
47
+ name: Named Entity Recognition
48
+ dataset:
49
+ name: Unknown
50
+ type: DFKI-SLT/few-nerd
51
+ split: test
52
+ metrics:
53
+ - type: f1
54
+ value: 0.7712935275393074
55
+ name: F1
56
+ - type: precision
57
+ value: 0.7793372319688109
58
+ name: Precision
59
+ - type: recall
60
+ value: 0.7634141684170327
61
+ name: Recall
62
+ ---
63
+
64
+ # SpanMarker with bert-base-cased on DFKI-SLT/few-nerd
65
+
66
+ This is a [SpanMarker](https://github.com/tomaarsen/SpanMarkerNER) model trained on the [DFKI-SLT/few-nerd](https://huggingface.co/datasets/DFKI-SLT/few-nerd) dataset that can be used for Named Entity Recognition. This SpanMarker model uses [bert-base-cased](https://huggingface.co/bert-base-cased) as the underlying encoder.
67
+
68
+ ## Model Details
69
+
70
+ ### Model Description
71
+ - **Model Type:** SpanMarker
72
+ - **Encoder:** [bert-base-cased](https://huggingface.co/bert-base-cased)
73
+ - **Maximum Sequence Length:** 256 tokens
74
+ - **Maximum Entity Length:** 8 words
75
+ - **Training Dataset:** [DFKI-SLT/few-nerd](https://huggingface.co/datasets/DFKI-SLT/few-nerd)
76
+ - **Language:** en
77
+ - **License:** cc-by-sa-4.0
78
+
79
+ ### Model Sources
80
+
81
+ - **Repository:** [SpanMarker on GitHub](https://github.com/tomaarsen/SpanMarkerNER)
82
+ - **Thesis:** [SpanMarker For Named Entity Recognition](https://raw.githubusercontent.com/tomaarsen/SpanMarkerNER/main/thesis.pdf)
83
+
84
+ ### Model Labels
85
+ | Label | Examples |
86
+ |:-------------|:-------------------------------------------------------------------------------|
87
+ | art | "The Seven Year Itch", "Time", "Imelda de ' Lambertazzi" |
88
+ | building | "Boston Garden", "Henry Ford Museum", "Sheremetyevo International Airport" |
89
+ | event | "Russian Revolution", "Iranian Constitutional Revolution", "French Revolution" |
90
+ | location | "Croatian", "the Republic of Croatia", "Mediterranean Basin" |
91
+ | organization | "IAEA", "Church 's Chicken", "Texas Chicken" |
92
+ | other | "BAR", "Amphiphysin", "N-terminal lipid" |
93
+ | person | "Ellaline Terriss", "Edmund Payne", "Hicks" |
94
+ | product | "Phantom", "100EX", "Corvettes - GT1 C6R" |
95
+
96
+ ## Evaluation
97
+
98
+ ### Metrics
99
+ | Label | Precision | Recall | F1 |
100
+ |:-------------|:----------|:-------|:-------|
101
+ | **all** | 0.7793 | 0.7634 | 0.7713 |
102
+ | art | 0.7608 | 0.7395 | 0.75 |
103
+ | building | 0.6095 | 0.6816 | 0.6435 |
104
+ | event | 0.6094 | 0.5392 | 0.5721 |
105
+ | location | 0.8112 | 0.8599 | 0.8348 |
106
+ | organization | 0.7335 | 0.6827 | 0.7072 |
107
+ | other | 0.7715 | 0.5822 | 0.6636 |
108
+ | person | 0.8635 | 0.9044 | 0.8835 |
109
+ | product | 0.7172 | 0.5932 | 0.6494 |
110
+
111
+ ## Uses
112
+
113
+ ### Direct Use for Inference
114
+
115
+ ```python
116
+ from span_marker import SpanMarkerModel
117
+
118
+ # Download from the 🤗 Hub
119
+ model = SpanMarkerModel.from_pretrained("span_marker_model_id")
120
+ # Run inference
121
+ entities = model.predict("Caretaker manager George Goss led them on a run in the FA Cup, defeating Liverpool in round 4, to reach the semi-final at Stamford Bridge, where they were defeated 2–0 by Sheffield United on 28 March 1925.")
122
+ ```
123
+
124
+ ### Downstream Use
125
+ You can finetune this model on your own dataset.
126
+
127
+ <details><summary>Click to expand</summary>
128
+
129
+ ```python
130
+ from span_marker import SpanMarkerModel, Trainer
131
+
132
+ # Download from the 🤗 Hub
133
+ model = SpanMarkerModel.from_pretrained("span_marker_model_id")
134
+
135
+ # Specify a Dataset with "tokens" and "ner_tag" columns
136
+ dataset = load_dataset("conll2003") # For example CoNLL2003
137
+
138
+ # Initialize a Trainer using the pretrained model & dataset
139
+ trainer = Trainer(
140
+ model=model,
141
+ train_dataset=dataset["train"],
142
+ eval_dataset=dataset["validation"],
143
+ )
144
+ trainer.train()
145
+ trainer.save_model("span_marker_model_id-finetuned")
146
+ ```
147
+ </details>
148
+
149
+ <!--
150
+ ### Out-of-Scope Use
151
+
152
+ *List how the model may foreseeably be misused and address what users ought not to do with the model.*
153
+ -->
154
+
155
+ <!--
156
+ ## Bias, Risks and Limitations
157
+
158
+ *What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
159
+ -->
160
+
161
+ <!--
162
+ ### Recommendations
163
+
164
+ *What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
165
+ -->
166
+
167
+ ## Training Details
168
+
169
+ ### Training Set Metrics
170
+ | Training set | Min | Median | Max |
171
+ |:----------------------|:----|:--------|:----|
172
+ | Sentence length | 1 | 24.4956 | 163 |
173
+ | Entities per sentence | 0 | 2.5439 | 35 |
174
+
175
+ ### Training Hyperparameters
176
+ - learning_rate: 5e-05
177
+ - train_batch_size: 4
178
+ - eval_batch_size: 4
179
+ - seed: 42
180
+ - gradient_accumulation_steps: 2
181
+ - total_train_batch_size: 8
182
+ - optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
183
+ - lr_scheduler_type: linear
184
+ - lr_scheduler_warmup_ratio: 0.1
185
+ - num_epochs: 1
186
+
187
+ ### Training Results
188
+ | Epoch | Step | Validation Loss | Validation Precision | Validation Recall | Validation F1 | Validation Accuracy |
189
+ |:------:|:----:|:---------------:|:--------------------:|:-----------------:|:-------------:|:-------------------:|
190
+ | 0.1629 | 200 | 0.0339 | 0.7327 | 0.6104 | 0.6660 | 0.9052 |
191
+ | 0.3259 | 400 | 0.0234 | 0.7717 | 0.6954 | 0.7316 | 0.9212 |
192
+ | 0.4888 | 600 | 0.0223 | 0.7598 | 0.7447 | 0.7522 | 0.9337 |
193
+ | 0.6517 | 800 | 0.0207 | 0.7600 | 0.7625 | 0.7612 | 0.9362 |
194
+ | 0.8147 | 1000 | 0.0196 | 0.7847 | 0.7484 | 0.7661 | 0.9369 |
195
+ | 0.9776 | 1200 | 0.0192 | 0.7809 | 0.7584 | 0.7695 | 0.9376 |
196
+
197
+ ### Framework Versions
198
+ - Python: 3.10.12
199
+ - SpanMarker: 1.4.0
200
+ - Transformers: 4.34.0
201
+ - PyTorch: 2.0.1+cu118
202
+ - Datasets: 2.14.5
203
+ - Tokenizers: 0.14.1
204
+
205
+ ## Citation
206
+
207
+ ### BibTeX
208
+ ```
209
+ @software{Aarsen_SpanMarker,
210
+ author = {Aarsen, Tom},
211
+ license = {Apache-2.0},
212
+ title = {{SpanMarker for Named Entity Recognition}},
213
+ url = {https://github.com/tomaarsen/SpanMarkerNER}
214
+ }
215
+ ```
216
+
217
+ <!--
218
+ ## Glossary
219
+
220
+ *Clearly define terms in order to be accessible across audiences.*
221
+ -->
222
+
223
+ <!--
224
+ ## Model Card Authors
225
+
226
+ *Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
227
+ -->
228
+
229
+ <!--
230
+ ## Model Card Contact
231
+
232
+ *Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
233
+ -->
added_tokens.json ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "<end>": 28997,
3
+ "<start>": 28996,
4
+ "[CLS]": 101,
5
+ "[MASK]": 103,
6
+ "[PAD]": 0,
7
+ "[SEP]": 102,
8
+ "[UNK]": 100
9
+ }
config.json ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "SpanMarkerModel"
4
+ ],
5
+ "encoder": {
6
+ "_name_or_path": "bert-base-cased",
7
+ "add_cross_attention": false,
8
+ "architectures": [
9
+ "BertForMaskedLM"
10
+ ],
11
+ "attention_probs_dropout_prob": 0.1,
12
+ "bad_words_ids": null,
13
+ "begin_suppress_tokens": null,
14
+ "bos_token_id": null,
15
+ "chunk_size_feed_forward": 0,
16
+ "classifier_dropout": null,
17
+ "cross_attention_hidden_size": null,
18
+ "decoder_start_token_id": null,
19
+ "diversity_penalty": 0.0,
20
+ "do_sample": false,
21
+ "early_stopping": false,
22
+ "encoder_no_repeat_ngram_size": 0,
23
+ "eos_token_id": null,
24
+ "exponential_decay_length_penalty": null,
25
+ "finetuning_task": null,
26
+ "forced_bos_token_id": null,
27
+ "forced_eos_token_id": null,
28
+ "gradient_checkpointing": false,
29
+ "hidden_act": "gelu",
30
+ "hidden_dropout_prob": 0.1,
31
+ "hidden_size": 768,
32
+ "id2label": {
33
+ "0": "O",
34
+ "1": "art",
35
+ "2": "building",
36
+ "3": "event",
37
+ "4": "location",
38
+ "5": "organization",
39
+ "6": "other",
40
+ "7": "person",
41
+ "8": "product"
42
+ },
43
+ "initializer_range": 0.02,
44
+ "intermediate_size": 3072,
45
+ "is_decoder": false,
46
+ "is_encoder_decoder": false,
47
+ "label2id": {
48
+ "O": 0,
49
+ "art": 1,
50
+ "building": 2,
51
+ "event": 3,
52
+ "location": 4,
53
+ "organization": 5,
54
+ "other": 6,
55
+ "person": 7,
56
+ "product": 8
57
+ },
58
+ "layer_norm_eps": 1e-12,
59
+ "length_penalty": 1.0,
60
+ "max_length": 20,
61
+ "max_position_embeddings": 512,
62
+ "min_length": 0,
63
+ "model_type": "bert",
64
+ "no_repeat_ngram_size": 0,
65
+ "num_attention_heads": 12,
66
+ "num_beam_groups": 1,
67
+ "num_beams": 1,
68
+ "num_hidden_layers": 12,
69
+ "num_return_sequences": 1,
70
+ "output_attentions": false,
71
+ "output_hidden_states": false,
72
+ "output_scores": false,
73
+ "pad_token_id": 0,
74
+ "position_embedding_type": "absolute",
75
+ "prefix": null,
76
+ "problem_type": null,
77
+ "pruned_heads": {},
78
+ "remove_invalid_values": false,
79
+ "repetition_penalty": 1.0,
80
+ "return_dict": true,
81
+ "return_dict_in_generate": false,
82
+ "sep_token_id": null,
83
+ "suppress_tokens": null,
84
+ "task_specific_params": null,
85
+ "temperature": 1.0,
86
+ "tf_legacy_loss": false,
87
+ "tie_encoder_decoder": false,
88
+ "tie_word_embeddings": true,
89
+ "tokenizer_class": null,
90
+ "top_k": 50,
91
+ "top_p": 1.0,
92
+ "torch_dtype": null,
93
+ "torchscript": false,
94
+ "transformers_version": "4.34.0",
95
+ "type_vocab_size": 2,
96
+ "typical_p": 1.0,
97
+ "use_bfloat16": false,
98
+ "use_cache": true,
99
+ "vocab_size": 29000
100
+ },
101
+ "entity_max_length": 8,
102
+ "marker_max_length": 128,
103
+ "max_next_context": null,
104
+ "max_prev_context": null,
105
+ "model_max_length": 256,
106
+ "model_max_length_default": 512,
107
+ "model_type": "span-marker",
108
+ "span_marker_version": "1.4.0",
109
+ "torch_dtype": "float32",
110
+ "trained_with_document_context": false,
111
+ "transformers_version": "4.34.0",
112
+ "vocab_size": 29000
113
+ }
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4355ee012cf32aa1dedfa8dfdfecce817dd75c6efd2c852aad3653c53fc390ea
3
+ size 433377649
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,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ "100": {
13
+ "content": "[UNK]",
14
+ "lstrip": false,
15
+ "normalized": false,
16
+ "rstrip": false,
17
+ "single_word": false,
18
+ "special": true
19
+ },
20
+ "101": {
21
+ "content": "[CLS]",
22
+ "lstrip": false,
23
+ "normalized": false,
24
+ "rstrip": false,
25
+ "single_word": false,
26
+ "special": true
27
+ },
28
+ "102": {
29
+ "content": "[SEP]",
30
+ "lstrip": false,
31
+ "normalized": false,
32
+ "rstrip": false,
33
+ "single_word": false,
34
+ "special": true
35
+ },
36
+ "103": {
37
+ "content": "[MASK]",
38
+ "lstrip": false,
39
+ "normalized": false,
40
+ "rstrip": false,
41
+ "single_word": false,
42
+ "special": true
43
+ },
44
+ "28996": {
45
+ "content": "<start>",
46
+ "lstrip": false,
47
+ "normalized": false,
48
+ "rstrip": false,
49
+ "single_word": false,
50
+ "special": true
51
+ },
52
+ "28997": {
53
+ "content": "<end>",
54
+ "lstrip": false,
55
+ "normalized": false,
56
+ "rstrip": false,
57
+ "single_word": false,
58
+ "special": true
59
+ }
60
+ },
61
+ "additional_special_tokens": [],
62
+ "clean_up_tokenization_spaces": true,
63
+ "cls_token": "[CLS]",
64
+ "do_lower_case": false,
65
+ "entity_max_length": 8,
66
+ "mask_token": "[MASK]",
67
+ "model_max_length": 256,
68
+ "pad_token": "[PAD]",
69
+ "sep_token": "[SEP]",
70
+ "strip_accents": null,
71
+ "tokenize_chinese_chars": true,
72
+ "tokenizer_class": "BertTokenizer",
73
+ "unk_token": "[UNK]"
74
+ }
training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8253aa713c1193425c176a5e21bf431487cbfe4952d8e9cd20e4e31796273e3d
3
+ size 4091
vocab.txt ADDED
The diff for this file is too large to render. See raw diff