model update
Browse files- README.md +142 -0
- config.json +1 -1
- eval/metric.json +1 -0
- eval/metric_span.json +1 -0
- eval/prediction.validation.json +0 -0
- pytorch_model.bin +2 -2
- tokenizer_config.json +1 -1
- trainer_config.json +1 -0
README.md
ADDED
@@ -0,0 +1,142 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
datasets:
|
3 |
+
- tweebank_ner
|
4 |
+
metrics:
|
5 |
+
- f1
|
6 |
+
- precision
|
7 |
+
- recall
|
8 |
+
model-index:
|
9 |
+
- name: tner/roberta-large-tweebank-ner
|
10 |
+
results:
|
11 |
+
- task:
|
12 |
+
name: Token Classification
|
13 |
+
type: token-classification
|
14 |
+
dataset:
|
15 |
+
name: tweebank_ner
|
16 |
+
type: tweebank_ner
|
17 |
+
args: tweebank_ner
|
18 |
+
metrics:
|
19 |
+
- name: F1
|
20 |
+
type: f1
|
21 |
+
value: 0.7439490445859872
|
22 |
+
- name: Precision
|
23 |
+
type: precision
|
24 |
+
value: 0.7121951219512195
|
25 |
+
- name: Recall
|
26 |
+
type: recall
|
27 |
+
value: 0.7786666666666666
|
28 |
+
- name: F1 (macro)
|
29 |
+
type: f1_macro
|
30 |
+
value: 0.7354319457314183
|
31 |
+
- name: Precision (macro)
|
32 |
+
type: precision_macro
|
33 |
+
value: 0.712928566565599
|
34 |
+
- name: Recall (macro)
|
35 |
+
type: recall_macro
|
36 |
+
value: 0.7620465365030582
|
37 |
+
- name: F1 (entity span)
|
38 |
+
type: f1_entity_span
|
39 |
+
value: 0.8178343949044585
|
40 |
+
- name: Precision (entity span)
|
41 |
+
type: precision_entity_span
|
42 |
+
value: 0.7829268292682927
|
43 |
+
- name: Recall (entity span)
|
44 |
+
type: recall_entity_span
|
45 |
+
value: 0.856
|
46 |
+
|
47 |
+
pipeline_tag: token-classification
|
48 |
+
widget:
|
49 |
+
- text: "Jacob Collier is a Grammy awarded artist from England."
|
50 |
+
example_title: "NER Example 1"
|
51 |
+
---
|
52 |
+
# tner/roberta-large-tweebank-ner
|
53 |
+
|
54 |
+
This model is a fine-tuned version of [roberta-large](https://huggingface.co/roberta-large) on the
|
55 |
+
[tner/tweebank_ner](https://huggingface.co/datasets/tner/tweebank_ner) dataset.
|
56 |
+
Model fine-tuning is done via [T-NER](https://github.com/asahi417/tner)'s hyper-parameter search (see the repository
|
57 |
+
for more detail). It achieves the following results on the test set:
|
58 |
+
- F1 (micro): 0.7439490445859872
|
59 |
+
- Precision (micro): 0.7121951219512195
|
60 |
+
- Recall (micro): 0.7786666666666666
|
61 |
+
- F1 (macro): 0.7354319457314183
|
62 |
+
- Precision (macro): 0.712928566565599
|
63 |
+
- Recall (macro): 0.7620465365030582
|
64 |
+
|
65 |
+
The per-entity breakdown of the F1 score on the test set are below:
|
66 |
+
- location: 0.7782805429864253
|
67 |
+
- organization: 0.7377049180327869
|
68 |
+
- other: 0.5520581113801453
|
69 |
+
- person: 0.8736842105263157
|
70 |
+
|
71 |
+
For F1 scores, the confidence interval is obtained by bootstrap as below:
|
72 |
+
- F1 (micro):
|
73 |
+
- 90%: [0.7156413818791614, 0.771698046498159]
|
74 |
+
- 95%: [0.7063867669973017, 0.7763088810979543]
|
75 |
+
- F1 (macro):
|
76 |
+
- 90%: [0.7156413818791614, 0.771698046498159]
|
77 |
+
- 95%: [0.7063867669973017, 0.7763088810979543]
|
78 |
+
|
79 |
+
Full evaluation can be found at [metric file of NER](https://huggingface.co/tner/roberta-large-tweebank-ner/raw/main/eval/metric.json)
|
80 |
+
and [metric file of entity span](https://huggingface.co/tner/roberta-large-tweebank-ner/raw/main/eval/metric_span.json).
|
81 |
+
|
82 |
+
### Usage
|
83 |
+
This model can be used through the transformers library by
|
84 |
+
```python
|
85 |
+
from transformers import AutoTokenizer, AutoModelForTokenClassification
|
86 |
+
tokenizer = AutoTokenizer.from_pretrained("tner/roberta-large-tweebank-ner")
|
87 |
+
model = AutoModelForTokenClassification.from_pretrained("tner/roberta-large-tweebank-ner")
|
88 |
+
```
|
89 |
+
but, since transformers do not support CRF layer, it is recommended to use the model via `T-NER` library.
|
90 |
+
Install the library via pip
|
91 |
+
```shell
|
92 |
+
pip install tner
|
93 |
+
```
|
94 |
+
and activate model as below.
|
95 |
+
```python
|
96 |
+
from tner import TransformersNER
|
97 |
+
model = TransformersNER("tner/roberta-large-tweebank-ner")
|
98 |
+
model.predict("Jacob Collier is a Grammy awarded English artist from London".split(" "))
|
99 |
+
```
|
100 |
+
|
101 |
+
### Training hyperparameters
|
102 |
+
|
103 |
+
The following hyperparameters were used during training:
|
104 |
+
- dataset: ['tner/tweebank_ner']
|
105 |
+
- dataset_split: train
|
106 |
+
- dataset_name: None
|
107 |
+
- local_dataset: None
|
108 |
+
- model: roberta-large
|
109 |
+
- crf: True
|
110 |
+
- max_length: 128
|
111 |
+
- epoch: 15
|
112 |
+
- batch_size: 64
|
113 |
+
- lr: 1e-05
|
114 |
+
- random_seed: 42
|
115 |
+
- gradient_accumulation_steps: 1
|
116 |
+
- weight_decay: None
|
117 |
+
- lr_warmup_step_ratio: 0.1
|
118 |
+
- max_grad_norm: 10.0
|
119 |
+
|
120 |
+
The full configuration can be found at [fine-tuning parameter file](https://huggingface.co/tner/roberta-large-tweebank-ner/raw/main/trainer_config.json).
|
121 |
+
|
122 |
+
### Reference
|
123 |
+
If you use any resource from T-NER, please consider to cite our [paper](https://aclanthology.org/2021.eacl-demos.7/).
|
124 |
+
|
125 |
+
```
|
126 |
+
|
127 |
+
@inproceedings{ushio-camacho-collados-2021-ner,
|
128 |
+
title = "{T}-{NER}: An All-Round Python Library for Transformer-based Named Entity Recognition",
|
129 |
+
author = "Ushio, Asahi and
|
130 |
+
Camacho-Collados, Jose",
|
131 |
+
booktitle = "Proceedings of the 16th Conference of the European Chapter of the Association for Computational Linguistics: System Demonstrations",
|
132 |
+
month = apr,
|
133 |
+
year = "2021",
|
134 |
+
address = "Online",
|
135 |
+
publisher = "Association for Computational Linguistics",
|
136 |
+
url = "https://aclanthology.org/2021.eacl-demos.7",
|
137 |
+
doi = "10.18653/v1/2021.eacl-demos.7",
|
138 |
+
pages = "53--62",
|
139 |
+
abstract = "Language model (LM) pretraining has led to consistent improvements in many NLP downstream tasks, including named entity recognition (NER). In this paper, we present T-NER (Transformer-based Named Entity Recognition), a Python library for NER LM finetuning. In addition to its practical utility, T-NER facilitates the study and investigation of the cross-domain and cross-lingual generalization ability of LMs finetuned on NER. Our library also provides a web app where users can get model predictions interactively for arbitrary text, which facilitates qualitative model evaluation for non-expert programmers. We show the potential of the library by compiling nine public NER datasets into a unified format and evaluating the cross-domain and cross- lingual performance across the datasets. The results from our initial experiments show that in-domain performance is generally competitive across datasets. However, cross-domain generalization is challenging even with a large pretrained LM, which has nevertheless capacity to learn domain-specific features if fine- tuned on a combined dataset. To facilitate future research, we also release all our LM checkpoints via the Hugging Face model hub.",
|
140 |
+
}
|
141 |
+
|
142 |
+
```
|
config.json
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
{
|
2 |
-
"_name_or_path": "tner_ckpt/tweebank_ner_roberta_large/
|
3 |
"architectures": [
|
4 |
"RobertaForTokenClassification"
|
5 |
],
|
|
|
1 |
{
|
2 |
+
"_name_or_path": "tner_ckpt/tweebank_ner_roberta_large/model_rcsnba/epoch_5",
|
3 |
"architectures": [
|
4 |
"RobertaForTokenClassification"
|
5 |
],
|
eval/metric.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"micro/f1": 0.7439490445859872, "micro/f1_ci": {"90": [0.7156413818791614, 0.771698046498159], "95": [0.7063867669973017, 0.7763088810979543]}, "micro/recall": 0.7786666666666666, "micro/precision": 0.7121951219512195, "macro/f1": 0.7354319457314183, "macro/f1_ci": {"90": [0.7059930933412133, 0.7627860392219387], "95": [0.6997186311074856, 0.7688112367513721]}, "macro/recall": 0.7620465365030582, "macro/precision": 0.712928566565599, "per_entity_metric": {"location": {"f1": 0.7782805429864253, "f1_ci": {"90": [0.7150234036694952, 0.8333333333333335], "95": [0.702970297029703, 0.8436386089046127]}, "precision": 0.7818181818181819, "recall": 0.7747747747747747}, "organization": {"f1": 0.7377049180327869, "f1_ci": {"90": [0.6842019543973942, 0.7849562191608911], "95": [0.6730100480559196, 0.7921452904613915]}, "precision": 0.7336956521739131, "recall": 0.7417582417582418}, "other": {"f1": 0.5520581113801453, "f1_ci": {"90": [0.4944454536946816, 0.609313399778516], "95": [0.4841075794621027, 0.6183398114521798]}, "precision": 0.4978165938864629, "recall": 0.6195652173913043}, "person": {"f1": 0.8736842105263157, "f1_ci": {"90": [0.8447106204595834, 0.9021852173913043], "95": [0.8363620187641541, 0.9090909090909091]}, "precision": 0.8383838383838383, "recall": 0.9120879120879121}}}
|
eval/metric_span.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"micro/f1": 0.8178343949044585, "micro/f1_ci": {"90": [0.7946512020674701, 0.8391476596836752], "95": [0.790463656866032, 0.8430815891456205]}, "micro/recall": 0.856, "micro/precision": 0.7829268292682927, "macro/f1": 0.8178343949044585, "macro/f1_ci": {"90": [0.7946512020674701, 0.8391476596836752], "95": [0.790463656866032, 0.8430815891456205]}, "macro/recall": 0.856, "macro/precision": 0.7829268292682927}
|
eval/prediction.validation.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
pytorch_model.bin
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c54f83b090b2d698514726367f99730837c704da4e67f1d652ebd72e2f1b315e
|
3 |
+
size 1417414001
|
tokenizer_config.json
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
"errors": "replace",
|
7 |
"mask_token": "<mask>",
|
8 |
"model_max_length": 512,
|
9 |
-
"name_or_path": "tner_ckpt/tweebank_ner_roberta_large/
|
10 |
"pad_token": "<pad>",
|
11 |
"sep_token": "</s>",
|
12 |
"special_tokens_map_file": "tner_ckpt/tweebank_ner_roberta_large/model_rcsnba/epoch_5/special_tokens_map.json",
|
|
|
6 |
"errors": "replace",
|
7 |
"mask_token": "<mask>",
|
8 |
"model_max_length": 512,
|
9 |
+
"name_or_path": "tner_ckpt/tweebank_ner_roberta_large/model_rcsnba/epoch_5",
|
10 |
"pad_token": "<pad>",
|
11 |
"sep_token": "</s>",
|
12 |
"special_tokens_map_file": "tner_ckpt/tweebank_ner_roberta_large/model_rcsnba/epoch_5/special_tokens_map.json",
|
trainer_config.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"dataset": ["tner/tweebank_ner"], "dataset_split": "train", "dataset_name": null, "local_dataset": null, "model": "roberta-large", "crf": true, "max_length": 128, "epoch": 15, "batch_size": 64, "lr": 1e-05, "random_seed": 42, "gradient_accumulation_steps": 1, "weight_decay": null, "lr_warmup_step_ratio": 0.1, "max_grad_norm": 10.0}
|