nbroad HF staff commited on
Commit
073d715
1 Parent(s): ded4140

Upload model

Browse files
README.md ADDED
@@ -0,0 +1,229 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ - tomaarsen/ner-orgs
14
+ metrics:
15
+ - precision
16
+ - recall
17
+ - f1
18
+ widget:
19
+ - text: The Fellowship of British Baptists and BMS World Mission brings together in
20
+ ministry the churches that are members of the Baptist Union of Scotland, Wales,
21
+ the Irish Baptist Networks, and the Baptist Union of Great Britain.
22
+ - text: The program is classified in the National Collegiate Athletic Association
23
+ (NCAA) Division I Bowl Subdivision (FBS), and the team competes in the Big 12
24
+ Conference.
25
+ - text: The Human Rights Foundation, condemned the assault, with HRF president Thor
26
+ Halvorssen Mendoza claiming that "the PSUV approved of the attacks against opposition
27
+ deputies at the National Assembly ".
28
+ - text: But senior Conservatives, such as Commons Health Committee chairperson Sarah
29
+ Wollaston and education minister Anne Milton, backed calls for a free vote on
30
+ the issue, while Labour MP Stella Creasy said she would table an amendment on
31
+ the matter to the Domestic Violence Bill and said that over 150 parliamentarians
32
+ had expressed support for the change, and Labour's shadow Attorney General Shami
33
+ Chakrabarti called the issue a test fo r May's feminism.
34
+ - text: From 1991 to 1992, the Social Democratic Party and Social Democrats of Croatia
35
+ were a part of the National Union government which was created by Franjo Tuđman
36
+ during the first stages of the war.
37
+ pipeline_tag: token-classification
38
+ base_model: roberta-large
39
+ model-index:
40
+ - name: SpanMarker with roberta-large on FewNERD, CoNLL2003, and OntoNotes v5
41
+ results:
42
+ - task:
43
+ type: token-classification
44
+ name: Named Entity Recognition
45
+ dataset:
46
+ name: FewNERD, CoNLL2003, and OntoNotes v5
47
+ type: tomaarsen/ner-orgs
48
+ split: test
49
+ metrics:
50
+ - type: f1
51
+ value: 0.8050627240143369
52
+ name: F1
53
+ - type: precision
54
+ value: 0.8089771294795606
55
+ name: Precision
56
+ - type: recall
57
+ value: 0.8011860174781523
58
+ name: Recall
59
+ ---
60
+
61
+ # SpanMarker with roberta-large on FewNERD, CoNLL2003, and OntoNotes v5
62
+
63
+ This is a [SpanMarker](https://github.com/tomaarsen/SpanMarkerNER) model trained on the [FewNERD, CoNLL2003, and OntoNotes v5](https://huggingface.co/datasets/tomaarsen/ner-orgs) dataset that can be used for Named Entity Recognition. This SpanMarker model uses [roberta-large](https://huggingface.co/roberta-large) as the underlying encoder.
64
+
65
+ ## Model Details
66
+
67
+ ### Model Description
68
+ - **Model Type:** SpanMarker
69
+ - **Encoder:** [roberta-large](https://huggingface.co/roberta-large)
70
+ - **Maximum Sequence Length:** 256 tokens
71
+ - **Maximum Entity Length:** 8 words
72
+ - **Training Dataset:** [FewNERD, CoNLL2003, and OntoNotes v5](https://huggingface.co/datasets/tomaarsen/ner-orgs)
73
+ - **Language:** en
74
+ - **License:** cc-by-sa-4.0
75
+
76
+ ### Model Sources
77
+
78
+ - **Repository:** [SpanMarker on GitHub](https://github.com/tomaarsen/SpanMarkerNER)
79
+ - **Thesis:** [SpanMarker For Named Entity Recognition](https://raw.githubusercontent.com/tomaarsen/SpanMarkerNER/main/thesis.pdf)
80
+
81
+ ### Model Labels
82
+ | Label | Examples |
83
+ |:------|:---------------------------------------------|
84
+ | ORG | "IAEA", "Church 's Chicken", "Texas Chicken" |
85
+
86
+ ## Evaluation
87
+
88
+ ### Metrics
89
+ | Label | Precision | Recall | F1 |
90
+ |:--------|:----------|:-------|:-------|
91
+ | **all** | 0.8090 | 0.8012 | 0.8051 |
92
+ | ORG | 0.8090 | 0.8012 | 0.8051 |
93
+
94
+ ## Uses
95
+
96
+ ### Direct Use for Inference
97
+
98
+ ```python
99
+ from span_marker import SpanMarkerModel
100
+
101
+ # Download from the 🤗 Hub
102
+ model = SpanMarkerModel.from_pretrained("nbroad/span-marker-roberta-large-orgs-v1")
103
+ # Run inference
104
+ entities = model.predict("The program is classified in the National Collegiate Athletic Association (NCAA) Division I Bowl Subdivision (FBS), and the team competes in the Big 12 Conference.")
105
+ ```
106
+
107
+ ### Downstream Use
108
+ You can finetune this model on your own dataset.
109
+
110
+ <details><summary>Click to expand</summary>
111
+
112
+ ```python
113
+ from span_marker import SpanMarkerModel, Trainer
114
+
115
+ # Download from the 🤗 Hub
116
+ model = SpanMarkerModel.from_pretrained("nbroad/span-marker-roberta-large-orgs-v1")
117
+
118
+ # Specify a Dataset with "tokens" and "ner_tag" columns
119
+ dataset = load_dataset("conll2003") # For example CoNLL2003
120
+
121
+ # Initialize a Trainer using the pretrained model & dataset
122
+ trainer = Trainer(
123
+ model=model,
124
+ train_dataset=dataset["train"],
125
+ eval_dataset=dataset["validation"],
126
+ )
127
+ trainer.train()
128
+ trainer.save_model("nbroad/span-marker-roberta-large-orgs-v1-finetuned")
129
+ ```
130
+ </details>
131
+
132
+ <!--
133
+ ### Out-of-Scope Use
134
+
135
+ *List how the model may foreseeably be misused and address what users ought not to do with the model.*
136
+ -->
137
+
138
+ <!--
139
+ ## Bias, Risks and Limitations
140
+
141
+ *What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
142
+ -->
143
+
144
+ <!--
145
+ ### Recommendations
146
+
147
+ *What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
148
+ -->
149
+
150
+ ## Training Details
151
+
152
+ ### Training Set Metrics
153
+ | Training set | Min | Median | Max |
154
+ |:----------------------|:----|:--------|:----|
155
+ | Sentence length | 1 | 23.5706 | 263 |
156
+ | Entities per sentence | 0 | 0.7865 | 39 |
157
+
158
+ ### Training Hyperparameters
159
+ - learning_rate: 3e-05
160
+ - train_batch_size: 32
161
+ - eval_batch_size: 32
162
+ - seed: 42
163
+ - optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
164
+ - lr_scheduler_type: linear
165
+ - lr_scheduler_warmup_ratio: 0.05
166
+ - num_epochs: 3
167
+ - mixed_precision_training: Native AMP
168
+
169
+ ### Training Results
170
+ | Epoch | Step | Validation Loss | Validation Precision | Validation Recall | Validation F1 | Validation Accuracy |
171
+ |:------:|:-----:|:---------------:|:--------------------:|:-----------------:|:-------------:|:-------------------:|
172
+ | 0.1430 | 600 | 0.0085 | 0.7425 | 0.7383 | 0.7404 | 0.9726 |
173
+ | 0.2860 | 1200 | 0.0078 | 0.7503 | 0.7516 | 0.7510 | 0.9741 |
174
+ | 0.4290 | 1800 | 0.0077 | 0.6962 | 0.8107 | 0.7491 | 0.9718 |
175
+ | 0.5720 | 2400 | 0.0060 | 0.8074 | 0.7486 | 0.7769 | 0.9753 |
176
+ | 0.7150 | 3000 | 0.0057 | 0.8135 | 0.7717 | 0.7921 | 0.9770 |
177
+ | 0.8580 | 3600 | 0.0059 | 0.7997 | 0.7764 | 0.7879 | 0.9763 |
178
+ | 1.0010 | 4200 | 0.0057 | 0.7860 | 0.8051 | 0.7954 | 0.9771 |
179
+ | 1.1439 | 4800 | 0.0058 | 0.7907 | 0.7717 | 0.7811 | 0.9763 |
180
+ | 1.2869 | 5400 | 0.0058 | 0.8116 | 0.7803 | 0.7956 | 0.9774 |
181
+ | 1.4299 | 6000 | 0.0056 | 0.7918 | 0.7850 | 0.7884 | 0.9770 |
182
+ | 1.5729 | 6600 | 0.0056 | 0.8097 | 0.7837 | 0.7965 | 0.9769 |
183
+ | 1.7159 | 7200 | 0.0055 | 0.8113 | 0.7790 | 0.7948 | 0.9765 |
184
+ | 1.8589 | 7800 | 0.0052 | 0.8095 | 0.7970 | 0.8032 | 0.9782 |
185
+ | 2.0019 | 8400 | 0.0054 | 0.8244 | 0.7782 | 0.8006 | 0.9774 |
186
+ | 2.1449 | 9000 | 0.0053 | 0.8238 | 0.7970 | 0.8102 | 0.9782 |
187
+ | 2.2879 | 9600 | 0.0053 | 0.82 | 0.7901 | 0.8048 | 0.9773 |
188
+ | 2.4309 | 10200 | 0.0053 | 0.8243 | 0.7936 | 0.8086 | 0.9785 |
189
+ | 2.5739 | 10800 | 0.0053 | 0.8159 | 0.7953 | 0.8055 | 0.9781 |
190
+ | 2.7169 | 11400 | 0.0053 | 0.8072 | 0.8034 | 0.8053 | 0.9784 |
191
+ | 2.8599 | 12000 | 0.0052 | 0.8111 | 0.8017 | 0.8064 | 0.9782 |
192
+
193
+ ### Framework Versions
194
+ - Python: 3.10.12
195
+ - SpanMarker: 1.5.0
196
+ - Transformers: 4.35.2
197
+ - PyTorch: 2.1.0a0+32f93b1
198
+ - Datasets: 2.15.0
199
+ - Tokenizers: 0.15.0
200
+
201
+ ## Citation
202
+
203
+ ### BibTeX
204
+ ```
205
+ @software{Aarsen_SpanMarker,
206
+ author = {Aarsen, Tom},
207
+ license = {Apache-2.0},
208
+ title = {{SpanMarker for Named Entity Recognition}},
209
+ url = {https://github.com/tomaarsen/SpanMarkerNER}
210
+ }
211
+ ```
212
+
213
+ <!--
214
+ ## Glossary
215
+
216
+ *Clearly define terms in order to be accessible across audiences.*
217
+ -->
218
+
219
+ <!--
220
+ ## Model Card Authors
221
+
222
+ *Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
223
+ -->
224
+
225
+ <!--
226
+ ## Model Card Contact
227
+
228
+ *Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
229
+ -->
added_tokens.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "<end>": 50266,
3
+ "<start>": 50265
4
+ }
config.json ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "SpanMarkerModel"
4
+ ],
5
+ "encoder": {
6
+ "_name_or_path": "roberta-large",
7
+ "add_cross_attention": false,
8
+ "architectures": [
9
+ "RobertaForMaskedLM"
10
+ ],
11
+ "attention_probs_dropout_prob": 0.1,
12
+ "bad_words_ids": null,
13
+ "begin_suppress_tokens": null,
14
+ "bos_token_id": 0,
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": 2,
24
+ "exponential_decay_length_penalty": null,
25
+ "finetuning_task": null,
26
+ "forced_bos_token_id": null,
27
+ "forced_eos_token_id": null,
28
+ "hidden_act": "gelu",
29
+ "hidden_dropout_prob": 0.1,
30
+ "hidden_size": 1024,
31
+ "id2label": {
32
+ "0": "O",
33
+ "1": "B-ORG",
34
+ "2": "I-ORG"
35
+ },
36
+ "initializer_range": 0.02,
37
+ "intermediate_size": 4096,
38
+ "is_decoder": false,
39
+ "is_encoder_decoder": false,
40
+ "label2id": {
41
+ "B-ORG": 1,
42
+ "I-ORG": 2,
43
+ "O": 0
44
+ },
45
+ "layer_norm_eps": 1e-05,
46
+ "length_penalty": 1.0,
47
+ "max_length": 20,
48
+ "max_position_embeddings": 514,
49
+ "min_length": 0,
50
+ "model_type": "roberta",
51
+ "no_repeat_ngram_size": 0,
52
+ "num_attention_heads": 16,
53
+ "num_beam_groups": 1,
54
+ "num_beams": 1,
55
+ "num_hidden_layers": 24,
56
+ "num_return_sequences": 1,
57
+ "output_attentions": false,
58
+ "output_hidden_states": false,
59
+ "output_scores": false,
60
+ "pad_token_id": 1,
61
+ "position_embedding_type": "absolute",
62
+ "prefix": null,
63
+ "problem_type": null,
64
+ "pruned_heads": {},
65
+ "remove_invalid_values": false,
66
+ "repetition_penalty": 1.0,
67
+ "return_dict": true,
68
+ "return_dict_in_generate": false,
69
+ "sep_token_id": null,
70
+ "suppress_tokens": null,
71
+ "task_specific_params": null,
72
+ "temperature": 1.0,
73
+ "tf_legacy_loss": false,
74
+ "tie_encoder_decoder": false,
75
+ "tie_word_embeddings": true,
76
+ "tokenizer_class": null,
77
+ "top_k": 50,
78
+ "top_p": 1.0,
79
+ "torch_dtype": null,
80
+ "torchscript": false,
81
+ "transformers_version": "4.35.2",
82
+ "type_vocab_size": 1,
83
+ "typical_p": 1.0,
84
+ "use_bfloat16": false,
85
+ "use_cache": true,
86
+ "vocab_size": 50272
87
+ },
88
+ "entity_max_length": 8,
89
+ "id2label": {
90
+ "0": "O",
91
+ "1": "ORG"
92
+ },
93
+ "id2reduced_id": {
94
+ "0": 0,
95
+ "1": 1,
96
+ "2": 1
97
+ },
98
+ "label2id": {
99
+ "O": 0,
100
+ "ORG": 1
101
+ },
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": 50272
113
+ }
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:bfe655f4ab8839518363a8a93f738564a8e815995da6d29030c421b061c0d888
3
+ size 1421532256
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,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ "entity_max_length": 8,
65
+ "eos_token": "</s>",
66
+ "errors": "replace",
67
+ "marker_max_length": 128,
68
+ "mask_token": "<mask>",
69
+ "model_max_length": 256,
70
+ "pad_token": "<pad>",
71
+ "sep_token": "</s>",
72
+ "tokenizer_class": "RobertaTokenizer",
73
+ "trim_offsets": true,
74
+ "unk_token": "<unk>"
75
+ }
vocab.json ADDED
The diff for this file is too large to render. See raw diff