lambdavi commited on
Commit
8e87a4d
1 Parent(s): fbcbe87

span-marker-luke-base-conll2003/checkpoint-4415

Browse files
README.md ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ datasets:
10
+ - conll2003
11
+ metrics:
12
+ - precision
13
+ - recall
14
+ - f1
15
+ widget:
16
+ - text: Atlanta Games silver medal winner Edwards has called on other leading athletes
17
+ to take part in the Sarajevo meeting--a goodwill gesture towards Bosnia as it
18
+ recovers from the war in the Balkans--two days after the grand prix final in Milan.
19
+ - text: Portsmouth:Middlesex 199 and 426 (J. Pooley 111,M. Ramprakash 108,M. Gatting
20
+ 83), Hampshire 232 and 109-5.
21
+ - text: Poland's Foreign Minister Dariusz Rosati will visit Yugoslavia on September
22
+ 3 and 4 to revive a dialogue between the two governments which was effectively
23
+ frozen in 1992,PAP news agency reported on Friday.
24
+ - text: The authorities are apparently extremely afraid of any political and social
25
+ discontent," said Xiao,in Manila to attend an Amnesty International conference
26
+ on human rights in China.
27
+ - text: American Nate Miller successfully defended his WBA cruiserweight title when
28
+ he knocked out compatriot James Heath in the seventh round of their bout on Saturday.
29
+ pipeline_tag: token-classification
30
+ model-index:
31
+ - name: SpanMarker
32
+ results:
33
+ - task:
34
+ type: token-classification
35
+ name: Named Entity Recognition
36
+ dataset:
37
+ name: Unknown
38
+ type: conll2003
39
+ split: eval
40
+ metrics:
41
+ - type: f1
42
+ value: 0.9550004205568171
43
+ name: F1
44
+ - type: precision
45
+ value: 0.9542780299209951
46
+ name: Precision
47
+ - type: recall
48
+ value: 0.9557239057239058
49
+ name: Recall
50
+ ---
51
+
52
+ # SpanMarker
53
+
54
+ This is a [SpanMarker](https://github.com/tomaarsen/SpanMarkerNER) model trained on the [conll2003](https://huggingface.co/datasets/conll2003) dataset that can be used for Named Entity Recognition.
55
+
56
+ ## Model Details
57
+
58
+ ### Model Description
59
+ - **Model Type:** SpanMarker
60
+ <!-- - **Encoder:** [Unknown](https://huggingface.co/unknown) -->
61
+ - **Maximum Sequence Length:** 512 tokens
62
+ - **Maximum Entity Length:** 8 words
63
+ - **Training Dataset:** [conll2003](https://huggingface.co/datasets/conll2003)
64
+ <!-- - **Language:** Unknown -->
65
+ <!-- - **License:** Unknown -->
66
+
67
+ ### Model Sources
68
+
69
+ - **Repository:** [SpanMarker on GitHub](https://github.com/tomaarsen/SpanMarkerNER)
70
+ - **Thesis:** [SpanMarker For Named Entity Recognition](https://raw.githubusercontent.com/tomaarsen/SpanMarkerNER/main/thesis.pdf)
71
+
72
+ ### Model Labels
73
+ | Label | Examples |
74
+ |:------|:--------------------------------------------------------------|
75
+ | LOC | "Germany", "BRUSSELS", "Britain" |
76
+ | MISC | "German", "British", "EU-wide" |
77
+ | ORG | "European Commission", "EU", "European Union" |
78
+ | PER | "Werner Zwingmann", "Nikolaus van der Pas", "Peter Blackburn" |
79
+
80
+ ## Uses
81
+
82
+ ### Direct Use for Inference
83
+
84
+ ```python
85
+ from span_marker import SpanMarkerModel
86
+
87
+ # Download from the 🤗 Hub
88
+ model = SpanMarkerModel.from_pretrained("span_marker_model_id")
89
+ # Run inference
90
+ entities = model.predict("Portsmouth:Middlesex 199 and 426 (J. Pooley 111,M. Ramprakash 108,M. Gatting 83), Hampshire 232 and 109-5.")
91
+ ```
92
+
93
+ ### Downstream Use
94
+ You can finetune this model on your own dataset.
95
+
96
+ <details><summary>Click to expand</summary>
97
+
98
+ ```python
99
+ from span_marker import SpanMarkerModel, Trainer
100
+
101
+ # Download from the 🤗 Hub
102
+ model = SpanMarkerModel.from_pretrained("span_marker_model_id")
103
+
104
+ # Specify a Dataset with "tokens" and "ner_tag" columns
105
+ dataset = load_dataset("conll2003") # For example CoNLL2003
106
+
107
+ # Initialize a Trainer using the pretrained model & dataset
108
+ trainer = Trainer(
109
+ model=model,
110
+ train_dataset=dataset["train"],
111
+ eval_dataset=dataset["validation"],
112
+ )
113
+ trainer.train()
114
+ trainer.save_model("span_marker_model_id-finetuned")
115
+ ```
116
+ </details>
117
+
118
+ <!--
119
+ ### Out-of-Scope Use
120
+
121
+ *List how the model may foreseeably be misused and address what users ought not to do with the model.*
122
+ -->
123
+
124
+ <!--
125
+ ## Bias, Risks and Limitations
126
+
127
+ *What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
128
+ -->
129
+
130
+ <!--
131
+ ### Recommendations
132
+
133
+ *What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
134
+ -->
135
+
136
+ ## Training Details
137
+
138
+ ### Training Set Metrics
139
+ | Training set | Min | Median | Max |
140
+ |:----------------------|:----|:--------|:----|
141
+ | Sentence length | 1 | 14.5019 | 113 |
142
+ | Entities per sentence | 0 | 1.6736 | 20 |
143
+
144
+ ### Training Hyperparameters
145
+ - learning_rate: 1e-05
146
+ - train_batch_size: 8
147
+ - eval_batch_size: 8
148
+ - seed: 42
149
+ - gradient_accumulation_steps: 2
150
+ - total_train_batch_size: 16
151
+ - optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
152
+ - lr_scheduler_type: linear
153
+ - lr_scheduler_warmup_ratio: 0.1
154
+ - num_epochs: 5
155
+
156
+ ### Training Results
157
+ | Epoch | Step | Validation Loss | Validation Precision | Validation Recall | Validation F1 | Validation Accuracy |
158
+ |:-----:|:----:|:---------------:|:--------------------:|:-----------------:|:-------------:|:-------------------:|
159
+ | 1.0 | 883 | 0.0123 | 0.9293 | 0.9274 | 0.9284 | 0.9848 |
160
+ | 2.0 | 1766 | 0.0089 | 0.9412 | 0.9456 | 0.9434 | 0.9882 |
161
+ | 3.0 | 2649 | 0.0077 | 0.9499 | 0.9505 | 0.9502 | 0.9893 |
162
+ | 4.0 | 3532 | 0.0070 | 0.9527 | 0.9537 | 0.9532 | 0.9900 |
163
+ | 5.0 | 4415 | 0.0068 | 0.9543 | 0.9557 | 0.9550 | 0.9902 |
164
+
165
+ ### Framework Versions
166
+ - Python: 3.10.12
167
+ - SpanMarker: 1.5.0
168
+ - Transformers: 4.36.0
169
+ - PyTorch: 2.0.0
170
+ - Datasets: 2.16.1
171
+ - Tokenizers: 0.15.0
172
+
173
+ ## Citation
174
+
175
+ ### BibTeX
176
+ ```
177
+ @software{Aarsen_SpanMarker,
178
+ author = {Aarsen, Tom},
179
+ license = {Apache-2.0},
180
+ title = {{SpanMarker for Named Entity Recognition}},
181
+ url = {https://github.com/tomaarsen/SpanMarkerNER}
182
+ }
183
+ ```
184
+
185
+ <!--
186
+ ## Glossary
187
+
188
+ *Clearly define terms in order to be accessible across audiences.*
189
+ -->
190
+
191
+ <!--
192
+ ## Model Card Authors
193
+
194
+ *Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
195
+ -->
196
+
197
+ <!--
198
+ ## Model Card Contact
199
+
200
+ *Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
201
+ -->
added_tokens.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "<end>": 50266,
3
+ "<start>": 50265
4
+ }
config.json ADDED
@@ -0,0 +1,143 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "SpanMarkerModel"
4
+ ],
5
+ "encoder": {
6
+ "_name_or_path": "studio-ousia/luke-base",
7
+ "add_cross_attention": false,
8
+ "architectures": [
9
+ "LukeForMaskedLM"
10
+ ],
11
+ "attention_probs_dropout_prob": 0.1,
12
+ "bad_words_ids": null,
13
+ "begin_suppress_tokens": null,
14
+ "bert_model_name": "roberta-base",
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
+ "entity_emb_size": 256,
25
+ "entity_vocab_size": 500000,
26
+ "eos_token_id": 2,
27
+ "exponential_decay_length_penalty": null,
28
+ "finetuning_task": null,
29
+ "forced_bos_token_id": null,
30
+ "forced_eos_token_id": null,
31
+ "gradient_checkpointing": false,
32
+ "hidden_act": "gelu",
33
+ "hidden_dropout_prob": 0.1,
34
+ "hidden_size": 768,
35
+ "id2label": {
36
+ "0": "O",
37
+ "1": "B-PER",
38
+ "2": "I-PER",
39
+ "3": "B-ORG",
40
+ "4": "I-ORG",
41
+ "5": "B-LOC",
42
+ "6": "I-LOC",
43
+ "7": "B-MISC",
44
+ "8": "I-MISC"
45
+ },
46
+ "initializer_range": 0.02,
47
+ "intermediate_size": 3072,
48
+ "is_decoder": false,
49
+ "is_encoder_decoder": false,
50
+ "label2id": {
51
+ "B-LOC": 5,
52
+ "B-MISC": 7,
53
+ "B-ORG": 3,
54
+ "B-PER": 1,
55
+ "I-LOC": 6,
56
+ "I-MISC": 8,
57
+ "I-ORG": 4,
58
+ "I-PER": 2,
59
+ "O": 0
60
+ },
61
+ "layer_norm_eps": 1e-05,
62
+ "length_penalty": 1.0,
63
+ "max_length": 20,
64
+ "max_position_embeddings": 514,
65
+ "min_length": 0,
66
+ "model_type": "luke",
67
+ "no_repeat_ngram_size": 0,
68
+ "num_attention_heads": 12,
69
+ "num_beam_groups": 1,
70
+ "num_beams": 1,
71
+ "num_hidden_layers": 12,
72
+ "num_return_sequences": 1,
73
+ "output_attentions": false,
74
+ "output_hidden_states": false,
75
+ "output_past": true,
76
+ "output_scores": false,
77
+ "pad_token_id": 1,
78
+ "position_embedding_type": "absolute",
79
+ "prefix": null,
80
+ "problem_type": null,
81
+ "pruned_heads": {},
82
+ "remove_invalid_values": false,
83
+ "repetition_penalty": 1.0,
84
+ "return_dict": true,
85
+ "return_dict_in_generate": false,
86
+ "sep_token_id": null,
87
+ "suppress_tokens": null,
88
+ "task_specific_params": null,
89
+ "temperature": 1.0,
90
+ "tf_legacy_loss": false,
91
+ "tie_encoder_decoder": false,
92
+ "tie_word_embeddings": true,
93
+ "tokenizer_class": null,
94
+ "top_k": 50,
95
+ "top_p": 1.0,
96
+ "torch_dtype": "float32",
97
+ "torchscript": false,
98
+ "transformers_version": "4.36.0",
99
+ "type_vocab_size": 1,
100
+ "typical_p": 1.0,
101
+ "use_bfloat16": false,
102
+ "use_cache": true,
103
+ "use_entity_aware_attention": true,
104
+ "vocab_size": 50272
105
+ },
106
+ "entity_max_length": 8,
107
+ "id2label": {
108
+ "0": "O",
109
+ "1": "LOC",
110
+ "2": "MISC",
111
+ "3": "ORG",
112
+ "4": "PER"
113
+ },
114
+ "id2reduced_id": {
115
+ "0": 0,
116
+ "1": 4,
117
+ "2": 4,
118
+ "3": 3,
119
+ "4": 3,
120
+ "5": 1,
121
+ "6": 1,
122
+ "7": 2,
123
+ "8": 2
124
+ },
125
+ "label2id": {
126
+ "LOC": 1,
127
+ "MISC": 2,
128
+ "O": 0,
129
+ "ORG": 3,
130
+ "PER": 4
131
+ },
132
+ "marker_max_length": 128,
133
+ "max_next_context": null,
134
+ "max_prev_context": null,
135
+ "model_max_length": null,
136
+ "model_max_length_default": 512,
137
+ "model_type": "span-marker",
138
+ "span_marker_version": "1.5.0",
139
+ "torch_dtype": "float32",
140
+ "trained_with_document_context": false,
141
+ "transformers_version": "4.36.0",
142
+ "vocab_size": 50272
143
+ }
merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e69b72c2eee8b5c5546f89bd4d3a2a4009616598d54e8598e1c4d72fc3351b18
3
+ size 1098088628
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
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": "<s>",
6
+ "lstrip": false,
7
+ "normalized": true,
8
+ "rstrip": false,
9
+ "single_word": false,
10
+ "special": true
11
+ },
12
+ "1": {
13
+ "content": "<pad>",
14
+ "lstrip": false,
15
+ "normalized": true,
16
+ "rstrip": false,
17
+ "single_word": false,
18
+ "special": true
19
+ },
20
+ "2": {
21
+ "content": "</s>",
22
+ "lstrip": false,
23
+ "normalized": true,
24
+ "rstrip": false,
25
+ "single_word": false,
26
+ "special": true
27
+ },
28
+ "3": {
29
+ "content": "<unk>",
30
+ "lstrip": false,
31
+ "normalized": true,
32
+ "rstrip": false,
33
+ "single_word": false,
34
+ "special": true
35
+ },
36
+ "50264": {
37
+ "content": "<mask>",
38
+ "lstrip": true,
39
+ "normalized": false,
40
+ "rstrip": false,
41
+ "single_word": false,
42
+ "special": true
43
+ },
44
+ "50265": {
45
+ "content": "<start>",
46
+ "lstrip": false,
47
+ "normalized": false,
48
+ "rstrip": false,
49
+ "single_word": false,
50
+ "special": true
51
+ },
52
+ "50266": {
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
+ "errors": "replace",
66
+ "mask_token": "<mask>",
67
+ "model_max_length": 512,
68
+ "pad_token": "<pad>",
69
+ "sep_token": "</s>",
70
+ "tokenizer_class": "RobertaTokenizer",
71
+ "trim_offsets": true,
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:880b557718521dd2e59974eec80a476fd41a555554523e3eca2d853e55057d79
3
+ size 4283
vocab.json ADDED
The diff for this file is too large to render. See raw diff