Instructions to use tner/twitter-roberta-base-dec2021-tweetner7-all with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use tner/twitter-roberta-base-dec2021-tweetner7-all with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("token-classification", model="tner/twitter-roberta-base-dec2021-tweetner7-all")# Load model directly from transformers import AutoTokenizer, AutoModelForTokenClassification tokenizer = AutoTokenizer.from_pretrained("tner/twitter-roberta-base-dec2021-tweetner7-all") model = AutoModelForTokenClassification.from_pretrained("tner/twitter-roberta-base-dec2021-tweetner7-all") - Notebooks
- Google Colab
- Kaggle
model update
Browse files- README.md +176 -0
- eval/metric.test_2020.json +1 -0
- eval/{metric.json → metric.test_2021.json} +1 -1
- eval/metric_span.test_2020.json +1 -0
- eval/metric_span.test_2021.json +1 -0
- eval/prediction.2020.dev.json +0 -0
- eval/prediction.2020.test.json +0 -0
- eval/prediction.2021.dev.json +0 -0
- eval/prediction.2021.test.json +0 -0
- trainer_config.json +1 -1
README.md
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
datasets:
|
| 3 |
+
- tner/tweetner7
|
| 4 |
+
metrics:
|
| 5 |
+
- f1
|
| 6 |
+
- precision
|
| 7 |
+
- recall
|
| 8 |
+
model-index:
|
| 9 |
+
- name: tner/twitter-roberta-base-dec2021-tweetner7-2020-2021-concat
|
| 10 |
+
results:
|
| 11 |
+
- task:
|
| 12 |
+
name: Token Classification
|
| 13 |
+
type: token-classification
|
| 14 |
+
dataset:
|
| 15 |
+
name: tner/tweetner7/test_2021
|
| 16 |
+
type: tner/tweetner7/test_2021
|
| 17 |
+
args: tner/tweetner7/test_2021
|
| 18 |
+
metrics:
|
| 19 |
+
- name: F1
|
| 20 |
+
type: f1
|
| 21 |
+
value: 0.6447001005249637
|
| 22 |
+
- name: Precision
|
| 23 |
+
type: precision
|
| 24 |
+
value: 0.6234607906675308
|
| 25 |
+
- name: Recall
|
| 26 |
+
type: recall
|
| 27 |
+
value: 0.6674375578168362
|
| 28 |
+
- name: F1 (macro)
|
| 29 |
+
type: f1_macro
|
| 30 |
+
value: 0.5982200308213212
|
| 31 |
+
- name: Precision (macro)
|
| 32 |
+
type: precision_macro
|
| 33 |
+
value: 0.576608821080324
|
| 34 |
+
- name: Recall (macro)
|
| 35 |
+
type: recall_macro
|
| 36 |
+
value: 0.622268182336741
|
| 37 |
+
- name: F1 (entity span)
|
| 38 |
+
type: f1_entity_span
|
| 39 |
+
value: 0.7793353811784417
|
| 40 |
+
- name: Precision (entity span)
|
| 41 |
+
type: precision_entity_span
|
| 42 |
+
value: 0.7536184921149276
|
| 43 |
+
- name: Recall (entity span)
|
| 44 |
+
type: recall_entity_span
|
| 45 |
+
value: 0.8068694344859488
|
| 46 |
+
- task:
|
| 47 |
+
name: Token Classification
|
| 48 |
+
type: token-classification
|
| 49 |
+
dataset:
|
| 50 |
+
name: tner/tweetner7/test_2020
|
| 51 |
+
type: tner/tweetner7/test_2020
|
| 52 |
+
args: tner/tweetner7/test_2020
|
| 53 |
+
metrics:
|
| 54 |
+
- name: F1
|
| 55 |
+
type: f1
|
| 56 |
+
value: 0.6582010582010582
|
| 57 |
+
- name: Precision
|
| 58 |
+
type: precision
|
| 59 |
+
value: 0.671343766864544
|
| 60 |
+
- name: Recall
|
| 61 |
+
type: recall
|
| 62 |
+
value: 0.6455630513751947
|
| 63 |
+
- name: F1 (macro)
|
| 64 |
+
type: f1_macro
|
| 65 |
+
value: 0.619090119256277
|
| 66 |
+
- name: Precision (macro)
|
| 67 |
+
type: precision_macro
|
| 68 |
+
value: 0.6309214005692869
|
| 69 |
+
- name: Recall (macro)
|
| 70 |
+
type: recall_macro
|
| 71 |
+
value: 0.6088158080350003
|
| 72 |
+
- name: F1 (entity span)
|
| 73 |
+
type: f1_entity_span
|
| 74 |
+
value: 0.7647525800476317
|
| 75 |
+
- name: Precision (entity span)
|
| 76 |
+
type: precision_entity_span
|
| 77 |
+
value: 0.7802375809935205
|
| 78 |
+
- name: Recall (entity span)
|
| 79 |
+
type: recall_entity_span
|
| 80 |
+
value: 0.7498702646600934
|
| 81 |
+
|
| 82 |
+
pipeline_tag: token-classification
|
| 83 |
+
widget:
|
| 84 |
+
- text: "Get the all-analog Classic Vinyl Edition of `Takin' Off` Album from {{@Herbie Hancock@}} via {{USERNAME}} link below: {{URL}}"
|
| 85 |
+
example_title: "NER Example 1"
|
| 86 |
+
---
|
| 87 |
+
# tner/twitter-roberta-base-dec2021-tweetner7-2020-2021-concat
|
| 88 |
+
|
| 89 |
+
This model is a fine-tuned version of [cardiffnlp/twitter-roberta-base-dec2021](https://huggingface.co/cardiffnlp/twitter-roberta-base-dec2021) on the
|
| 90 |
+
[tner/tweetner7](https://huggingface.co/datasets/tner/tweetner7) dataset (`train_all` split).
|
| 91 |
+
Model fine-tuning is done via [T-NER](https://github.com/asahi417/tner)'s hyper-parameter search (see the repository
|
| 92 |
+
for more detail). It achieves the following results on the test set of 2021:
|
| 93 |
+
- F1 (micro): 0.6447001005249637
|
| 94 |
+
- Precision (micro): 0.6234607906675308
|
| 95 |
+
- Recall (micro): 0.6674375578168362
|
| 96 |
+
- F1 (macro): 0.5982200308213212
|
| 97 |
+
- Precision (macro): 0.576608821080324
|
| 98 |
+
- Recall (macro): 0.622268182336741
|
| 99 |
+
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
The per-entity breakdown of the F1 score on the test set are below:
|
| 103 |
+
- corporation: 0.5048128342245989
|
| 104 |
+
- creative_work: 0.45297029702970293
|
| 105 |
+
- event: 0.46761313220940554
|
| 106 |
+
- group: 0.6009661835748793
|
| 107 |
+
- location: 0.6592252133946159
|
| 108 |
+
- person: 0.8302430243024302
|
| 109 |
+
- product: 0.6717095310136157
|
| 110 |
+
|
| 111 |
+
For F1 scores, the confidence interval is obtained by bootstrap as below:
|
| 112 |
+
- F1 (micro):
|
| 113 |
+
- 90%: [0.6358921767926183, 0.6542958612061787]
|
| 114 |
+
- 95%: [0.6341987223616053, 0.6560992650244356]
|
| 115 |
+
- F1 (macro):
|
| 116 |
+
- 90%: [0.6358921767926183, 0.6542958612061787]
|
| 117 |
+
- 95%: [0.6341987223616053, 0.6560992650244356]
|
| 118 |
+
|
| 119 |
+
Full evaluation can be found at [metric file of NER](https://huggingface.co/tner/twitter-roberta-base-dec2021-tweetner7-2020-2021-concat/raw/main/eval/metric.json)
|
| 120 |
+
and [metric file of entity span](https://huggingface.co/tner/twitter-roberta-base-dec2021-tweetner7-2020-2021-concat/raw/main/eval/metric_span.json).
|
| 121 |
+
|
| 122 |
+
### Usage
|
| 123 |
+
This model can be used through the [tner library](https://github.com/asahi417/tner). Install the library via pip
|
| 124 |
+
```shell
|
| 125 |
+
pip install tner
|
| 126 |
+
```
|
| 127 |
+
and activate model as below.
|
| 128 |
+
```python
|
| 129 |
+
from tner import TransformersNER
|
| 130 |
+
model = TransformersNER("tner/twitter-roberta-base-dec2021-tweetner7-2020-2021-concat")
|
| 131 |
+
model.predict(["Jacob Collier is a Grammy awarded English artist from London"])
|
| 132 |
+
```
|
| 133 |
+
It can be used via transformers library but it is not recommended as CRF layer is not supported at the moment.
|
| 134 |
+
|
| 135 |
+
### Training hyperparameters
|
| 136 |
+
|
| 137 |
+
The following hyperparameters were used during training:
|
| 138 |
+
- dataset: ['tner/tweetner7']
|
| 139 |
+
- dataset_split: train_all
|
| 140 |
+
- dataset_name: None
|
| 141 |
+
- local_dataset: None
|
| 142 |
+
- model: cardiffnlp/twitter-roberta-base-dec2021
|
| 143 |
+
- crf: True
|
| 144 |
+
- max_length: 128
|
| 145 |
+
- epoch: 30
|
| 146 |
+
- batch_size: 32
|
| 147 |
+
- lr: 1e-05
|
| 148 |
+
- random_seed: 0
|
| 149 |
+
- gradient_accumulation_steps: 1
|
| 150 |
+
- weight_decay: 1e-07
|
| 151 |
+
- lr_warmup_step_ratio: 0.3
|
| 152 |
+
- max_grad_norm: 1
|
| 153 |
+
|
| 154 |
+
The full configuration can be found at [fine-tuning parameter file](https://huggingface.co/tner/twitter-roberta-base-dec2021-tweetner7-2020-2021-concat/raw/main/trainer_config.json).
|
| 155 |
+
|
| 156 |
+
### Reference
|
| 157 |
+
If you use any resource from T-NER, please consider to cite our [paper](https://aclanthology.org/2021.eacl-demos.7/).
|
| 158 |
+
|
| 159 |
+
```
|
| 160 |
+
|
| 161 |
+
@inproceedings{ushio-camacho-collados-2021-ner,
|
| 162 |
+
title = "{T}-{NER}: An All-Round Python Library for Transformer-based Named Entity Recognition",
|
| 163 |
+
author = "Ushio, Asahi and
|
| 164 |
+
Camacho-Collados, Jose",
|
| 165 |
+
booktitle = "Proceedings of the 16th Conference of the European Chapter of the Association for Computational Linguistics: System Demonstrations",
|
| 166 |
+
month = apr,
|
| 167 |
+
year = "2021",
|
| 168 |
+
address = "Online",
|
| 169 |
+
publisher = "Association for Computational Linguistics",
|
| 170 |
+
url = "https://aclanthology.org/2021.eacl-demos.7",
|
| 171 |
+
doi = "10.18653/v1/2021.eacl-demos.7",
|
| 172 |
+
pages = "53--62",
|
| 173 |
+
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.",
|
| 174 |
+
}
|
| 175 |
+
|
| 176 |
+
```
|
eval/metric.test_2020.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"micro/f1": 0.6582010582010582, "micro/f1_ci": {"90": [0.6379167890637253, 0.6767511315048438], "95": [0.6339207548025675, 0.6807947362204927]}, "micro/recall": 0.6455630513751947, "micro/precision": 0.671343766864544, "macro/f1": 0.619090119256277, "macro/f1_ci": {"90": [0.5972479198841049, 0.6386559386417274], "95": [0.5937401018540227, 0.6428463929597004]}, "macro/recall": 0.6088158080350003, "macro/precision": 0.6309214005692869, "per_entity_metric": {"corporation": {"f1": 0.5796344647519582, "f1_ci": {"90": [0.5234079697610352, 0.6277959240647681], "95": [0.5141152231379257, 0.6394375]}, "precision": 0.578125, "recall": 0.581151832460733}, "creative_work": {"f1": 0.553072625698324, "f1_ci": {"90": [0.49853196304809205, 0.6028253100693715], "95": [0.4876406133927624, 0.6114264896373057]}, "precision": 0.553072625698324, "recall": 0.553072625698324}, "event": {"f1": 0.444022770398482, "f1_ci": {"90": [0.3922253196193406, 0.4971993370807634], "95": [0.38228807543114435, 0.5075202210070632]}, "precision": 0.44656488549618323, "recall": 0.44150943396226416}, "group": {"f1": 0.5749128919860629, "f1_ci": {"90": [0.5205170817406994, 0.625659134872618], "95": [0.5104305259005177, 0.6358512874408828]}, "precision": 0.6273764258555133, "recall": 0.5305466237942122}, "location": {"f1": 0.6646706586826348, "f1_ci": {"90": [0.5974730765917118, 0.7278115556520639], "95": [0.5810510954741723, 0.7381043956043957]}, "precision": 0.6568047337278107, "recall": 0.6727272727272727}, "person": {"f1": 0.844331641285956, "f1_ci": {"90": [0.8183284457478005, 0.8676071424722781], "95": [0.8145682012390513, 0.8709331756339546]}, "precision": 0.8515358361774744, "recall": 0.837248322147651}, "product": {"f1": 0.6729857819905214, "f1_ci": {"90": [0.6212986836419078, 0.7170731707317073], "95": [0.6111074847693646, 0.725641560972215]}, "precision": 0.7029702970297029, "recall": 0.6454545454545455}}}
|
eval/{metric.json → metric.test_2021.json}
RENAMED
|
@@ -1 +1 @@
|
|
| 1 |
-
{"
|
|
|
|
| 1 |
+
{"micro/f1": 0.6447001005249637, "micro/f1_ci": {"90": [0.6358921767926183, 0.6542958612061787], "95": [0.6341987223616053, 0.6560992650244356]}, "micro/recall": 0.6674375578168362, "micro/precision": 0.6234607906675308, "macro/f1": 0.5982200308213212, "macro/f1_ci": {"90": [0.5881550153814866, 0.6085554142266025], "95": [0.5868087805464741, 0.6101643811579637]}, "macro/recall": 0.622268182336741, "macro/precision": 0.576608821080324, "per_entity_metric": {"corporation": {"f1": 0.5048128342245989, "f1_ci": {"90": [0.479765110450545, 0.5306144595657036], "95": [0.47517387506462216, 0.5351675634581814]}, "precision": 0.4865979381443299, "recall": 0.5244444444444445}, "creative_work": {"f1": 0.45297029702970293, "f1_ci": {"90": [0.42319336176888755, 0.48488758755117906], "95": [0.4162047502047502, 0.4893898449722657]}, "precision": 0.4135593220338983, "recall": 0.5006839945280438}, "event": {"f1": 0.46761313220940554, "f1_ci": {"90": [0.44575807806932577, 0.4903905189360568], "95": [0.4422550278552021, 0.49587724619000695]}, "precision": 0.4562770562770563, "recall": 0.47952684258416745}, "group": {"f1": 0.6009661835748793, "f1_ci": {"90": [0.5801815329496189, 0.621933633730728], "95": [0.5775182443071706, 0.6251598548687218]}, "precision": 0.5879017013232514, "recall": 0.6146245059288538}, "location": {"f1": 0.6592252133946159, "f1_ci": {"90": [0.6323286497785727, 0.6864389614941666], "95": [0.6275471764048085, 0.6917652468518968]}, "precision": 0.6220570012391574, "recall": 0.7011173184357542}, "person": {"f1": 0.8302430243024302, "f1_ci": {"90": [0.8199438783116751, 0.841483594116568], "95": [0.8177798298118928, 0.8435008852333449]}, "precision": 0.8111150193457615, "recall": 0.8502949852507374}, "product": {"f1": 0.6717095310136157, "f1_ci": {"90": [0.6498440287017558, 0.6930412862784509], "95": [0.6467581027914819, 0.6969171035150417]}, "precision": 0.658753709198813, "recall": 0.6851851851851852}}}
|
eval/metric_span.test_2020.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"micro/f1": 0.7647525800476317, "micro/f1_ci": {}, "micro/recall": 0.7498702646600934, "micro/precision": 0.7802375809935205, "macro/f1": 0.7647525800476317, "macro/f1_ci": {}, "macro/recall": 0.7498702646600934, "macro/precision": 0.7802375809935205}
|
eval/metric_span.test_2021.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"micro/f1": 0.7793353811784417, "micro/f1_ci": {}, "micro/recall": 0.8068694344859488, "micro/precision": 0.7536184921149276, "macro/f1": 0.7793353811784417, "macro/f1_ci": {}, "macro/recall": 0.8068694344859488, "macro/precision": 0.7536184921149276}
|
eval/prediction.2020.dev.json
DELETED
|
The diff for this file is too large to render.
See raw diff
|
|
|
eval/prediction.2020.test.json
DELETED
|
The diff for this file is too large to render.
See raw diff
|
|
|
eval/prediction.2021.dev.json
DELETED
|
The diff for this file is too large to render.
See raw diff
|
|
|
eval/prediction.2021.test.json
DELETED
|
The diff for this file is too large to render.
See raw diff
|
|
|
trainer_config.json
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
{"
|
|
|
|
| 1 |
+
{"dataset": ["tner/tweetner7"], "dataset_split": "train_all", "dataset_name": null, "local_dataset": null, "model": "cardiffnlp/twitter-roberta-base-dec2021", "crf": true, "max_length": 128, "epoch": 30, "batch_size": 32, "lr": 1e-05, "random_seed": 0, "gradient_accumulation_steps": 1, "weight_decay": 1e-07, "lr_warmup_step_ratio": 0.3, "max_grad_norm": 1}
|