MinhMinh09 commited on
Commit
5096007
1 Parent(s): bafa6bc

End of training

Browse files
README.md ADDED
@@ -0,0 +1,234 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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.767937326836725
55
+ name: F1
56
+ - type: precision
57
+ value: 0.7684512428298279
58
+ name: Precision
59
+ - type: recall
60
+ value: 0.7674240977658965
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 | "Time", "The Seven Year Itch", "Imelda de ' Lambertazzi" |
88
+ | building | "Henry Ford Museum", "Boston Garden", "Sheremetyevo International Airport" |
89
+ | event | "French Revolution", "Iranian Constitutional Revolution", "Russian Revolution" |
90
+ | location | "Croatian", "the Republic of Croatia", "Mediterranean Basin" |
91
+ | organization | "Church 's Chicken", "IAEA", "Texas Chicken" |
92
+ | other | "Amphiphysin", "BAR", "N-terminal lipid" |
93
+ | person | "Hicks", "Ellaline Terriss", "Edmund Payne" |
94
+ | product | "Phantom", "Corvettes - GT1 C6R", "100EX" |
95
+
96
+ ## Evaluation
97
+
98
+ ### Metrics
99
+ | Label | Precision | Recall | F1 |
100
+ |:-------------|:----------|:-------|:-------|
101
+ | **all** | 0.7685 | 0.7674 | 0.7679 |
102
+ | art | 0.7749 | 0.6884 | 0.7291 |
103
+ | building | 0.6045 | 0.6612 | 0.6316 |
104
+ | event | 0.6437 | 0.5161 | 0.5729 |
105
+ | location | 0.8066 | 0.8425 | 0.8241 |
106
+ | organization | 0.7127 | 0.6836 | 0.6978 |
107
+ | other | 0.6802 | 0.6775 | 0.6789 |
108
+ | person | 0.8900 | 0.9135 | 0.9016 |
109
+ | product | 0.6596 | 0.6305 | 0.6447 |
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
+ - mixed_precision_training: Native AMP
187
+
188
+ ### Training Results
189
+ | Epoch | Step | Validation Loss | Validation Precision | Validation Recall | Validation F1 | Validation Accuracy |
190
+ |:------:|:----:|:---------------:|:--------------------:|:-----------------:|:-------------:|:-------------------:|
191
+ | 0.1629 | 200 | 0.0323 | 0.7242 | 0.5919 | 0.6514 | 0.8980 |
192
+ | 0.3259 | 400 | 0.0232 | 0.7537 | 0.7149 | 0.7337 | 0.9252 |
193
+ | 0.4888 | 600 | 0.0212 | 0.7767 | 0.7301 | 0.7527 | 0.9301 |
194
+ | 0.6517 | 800 | 0.0209 | 0.7605 | 0.7615 | 0.7610 | 0.9353 |
195
+ | 0.8147 | 1000 | 0.0194 | 0.7815 | 0.7604 | 0.7708 | 0.9383 |
196
+ | 0.9776 | 1200 | 0.0195 | 0.7681 | 0.7833 | 0.7756 | 0.9403 |
197
+
198
+ ### Framework Versions
199
+ - Python: 3.10.12
200
+ - SpanMarker: 1.5.0
201
+ - Transformers: 4.35.2
202
+ - PyTorch: 2.1.0+cu121
203
+ - Datasets: 2.16.0
204
+ - Tokenizers: 0.15.0
205
+
206
+ ## Citation
207
+
208
+ ### BibTeX
209
+ ```
210
+ @software{Aarsen_SpanMarker,
211
+ author = {Aarsen, Tom},
212
+ license = {Apache-2.0},
213
+ title = {{SpanMarker for Named Entity Recognition}},
214
+ url = {https://github.com/tomaarsen/SpanMarkerNER}
215
+ }
216
+ ```
217
+
218
+ <!--
219
+ ## Glossary
220
+
221
+ *Clearly define terms in order to be accessible across audiences.*
222
+ -->
223
+
224
+ <!--
225
+ ## Model Card Authors
226
+
227
+ *Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
228
+ -->
229
+
230
+ <!--
231
+ ## Model Card Contact
232
+
233
+ *Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
234
+ -->
added_tokens.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "<end>": 28997,
3
+ "<start>": 28996
4
+ }
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.35.2",
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.5.0",
109
+ "torch_dtype": "float32",
110
+ "trained_with_document_context": false,
111
+ "transformers_version": "4.35.2",
112
+ "vocab_size": 29000
113
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9613bd1397d658115a1d9a9acb82a42e3fdeef26cba88b572067b0f55765ccd8
3
+ size 433332812
runs/Dec30_03-21-57_313fccc50b95/events.out.tfevents.1703906537.313fccc50b95.604.0 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1d6a52f1e91618a3031fae618831bad23f4f5ec13a72b54b8448aecb786f5f65
3
+ size 13674
runs/Dec30_03-21-57_313fccc50b95/events.out.tfevents.1703907231.313fccc50b95.604.1 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:36e67453e87cf2617042127c72595491cfb5759060f39c53912c4857d4e951f8
3
+ size 1096
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,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ "clean_up_tokenization_spaces": true,
62
+ "cls_token": "[CLS]",
63
+ "do_lower_case": false,
64
+ "entity_max_length": 8,
65
+ "mask_token": "[MASK]",
66
+ "model_max_length": 256,
67
+ "pad_token": "[PAD]",
68
+ "sep_token": "[SEP]",
69
+ "strip_accents": null,
70
+ "tokenize_chinese_chars": true,
71
+ "tokenizer_class": "BertTokenizer",
72
+ "unk_token": "[UNK]"
73
+ }
training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e10e1ba4dc4d2c348c22f316a984bce43d4b1db198fd145f7b93ac085fda1df6
3
+ size 4600
vocab.txt ADDED
The diff for this file is too large to render. See raw diff