Instructions to use tner/roberta-base-tweetner7-2021 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use tner/roberta-base-tweetner7-2021 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("token-classification", model="tner/roberta-base-tweetner7-2021")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForTokenClassification tokenizer = AutoTokenizer.from_pretrained("tner/roberta-base-tweetner7-2021") model = AutoModelForTokenClassification.from_pretrained("tner/roberta-base-tweetner7-2021", device_map="auto") - 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/roberta-base-tweetner7-2021
|
| 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.6175553918513061
|
| 22 |
+
- name: Precision
|
| 23 |
+
type: precision
|
| 24 |
+
value: 0.6055117235248361
|
| 25 |
+
- name: Recall
|
| 26 |
+
type: recall
|
| 27 |
+
value: 0.6300878815911193
|
| 28 |
+
- name: F1 (macro)
|
| 29 |
+
type: f1_macro
|
| 30 |
+
value: 0.5699978267978356
|
| 31 |
+
- name: Precision (macro)
|
| 32 |
+
type: precision_macro
|
| 33 |
+
value: 0.5590687883112516
|
| 34 |
+
- name: Recall (macro)
|
| 35 |
+
type: recall_macro
|
| 36 |
+
value: 0.5841701622550579
|
| 37 |
+
- name: F1 (entity span)
|
| 38 |
+
type: f1_entity_span
|
| 39 |
+
value: 0.7692483045534848
|
| 40 |
+
- name: Precision (entity span)
|
| 41 |
+
type: precision_entity_span
|
| 42 |
+
value: 0.758314606741573
|
| 43 |
+
- name: Recall (entity span)
|
| 44 |
+
type: recall_entity_span
|
| 45 |
+
value: 0.7805019081762461
|
| 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.604995882514411
|
| 57 |
+
- name: Precision
|
| 58 |
+
type: precision
|
| 59 |
+
value: 0.6421911421911422
|
| 60 |
+
- name: Recall
|
| 61 |
+
type: recall
|
| 62 |
+
value: 0.5718733783082511
|
| 63 |
+
- name: F1 (macro)
|
| 64 |
+
type: f1_macro
|
| 65 |
+
value: 0.5612313427645093
|
| 66 |
+
- name: Precision (macro)
|
| 67 |
+
type: precision_macro
|
| 68 |
+
value: 0.5945742705318462
|
| 69 |
+
- name: Recall (macro)
|
| 70 |
+
type: recall_macro
|
| 71 |
+
value: 0.5335324219465825
|
| 72 |
+
- name: F1 (entity span)
|
| 73 |
+
type: f1_entity_span
|
| 74 |
+
value: 0.7375103505382279
|
| 75 |
+
- name: Precision (entity span)
|
| 76 |
+
type: precision_entity_span
|
| 77 |
+
value: 0.7877358490566038
|
| 78 |
+
- name: Recall (entity span)
|
| 79 |
+
type: recall_entity_span
|
| 80 |
+
value: 0.6933056564608199
|
| 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/roberta-base-tweetner7-2021
|
| 88 |
+
|
| 89 |
+
This model is a fine-tuned version of [roberta-base](https://huggingface.co/roberta-base) on the
|
| 90 |
+
[tner/tweetner7](https://huggingface.co/datasets/tner/tweetner7) dataset (`train_2021` 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.6175553918513061
|
| 94 |
+
- Precision (micro): 0.6055117235248361
|
| 95 |
+
- Recall (micro): 0.6300878815911193
|
| 96 |
+
- F1 (macro): 0.5699978267978356
|
| 97 |
+
- Precision (macro): 0.5590687883112516
|
| 98 |
+
- Recall (macro): 0.5841701622550579
|
| 99 |
+
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
The per-entity breakdown of the F1 score on the test set are below:
|
| 103 |
+
- corporation: 0.4889844169801182
|
| 104 |
+
- creative_work: 0.3800116211504939
|
| 105 |
+
- event: 0.4550669216061186
|
| 106 |
+
- group: 0.5702400000000001
|
| 107 |
+
- location: 0.6506189821182944
|
| 108 |
+
- person: 0.8133776792313377
|
| 109 |
+
- product: 0.6316851664984864
|
| 110 |
+
|
| 111 |
+
For F1 scores, the confidence interval is obtained by bootstrap as below:
|
| 112 |
+
- F1 (micro):
|
| 113 |
+
- 90%: [0.6085886303107021, 0.6270245504530414]
|
| 114 |
+
- 95%: [0.6071586866067074, 0.6287436113239784]
|
| 115 |
+
- F1 (macro):
|
| 116 |
+
- 90%: [0.6085886303107021, 0.6270245504530414]
|
| 117 |
+
- 95%: [0.6071586866067074, 0.6287436113239784]
|
| 118 |
+
|
| 119 |
+
Full evaluation can be found at [metric file of NER](https://huggingface.co/tner/roberta-base-tweetner7-2021/raw/main/eval/metric.json)
|
| 120 |
+
and [metric file of entity span](https://huggingface.co/tner/roberta-base-tweetner7-2021/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/roberta-base-tweetner7-2021")
|
| 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_2021
|
| 140 |
+
- dataset_name: None
|
| 141 |
+
- local_dataset: None
|
| 142 |
+
- model: roberta-base
|
| 143 |
+
- crf: False
|
| 144 |
+
- max_length: 128
|
| 145 |
+
- epoch: 30
|
| 146 |
+
- batch_size: 32
|
| 147 |
+
- lr: 0.0001
|
| 148 |
+
- random_seed: 0
|
| 149 |
+
- gradient_accumulation_steps: 1
|
| 150 |
+
- weight_decay: 1e-07
|
| 151 |
+
- lr_warmup_step_ratio: 0.15
|
| 152 |
+
- max_grad_norm: 1
|
| 153 |
+
|
| 154 |
+
The full configuration can be found at [fine-tuning parameter file](https://huggingface.co/tner/roberta-base-tweetner7-2021/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.604995882514411, "micro/f1_ci": {"90": [0.5840748362685845, 0.6255164199352362], "95": [0.5803974312612263, 0.629783727608571]}, "micro/recall": 0.5718733783082511, "micro/precision": 0.6421911421911422, "macro/f1": 0.5612313427645093, "macro/f1_ci": {"90": [0.5392933879031333, 0.5843882413380433], "95": [0.5339723783579367, 0.5886659409585682]}, "macro/recall": 0.5335324219465825, "macro/precision": 0.5945742705318462, "per_entity_metric": {"corporation": {"f1": 0.498567335243553, "f1_ci": {"90": [0.4432367697038356, 0.5527248563561412], "95": [0.430937450036418, 0.5627151060479765]}, "precision": 0.5506329113924051, "recall": 0.45549738219895286}, "creative_work": {"f1": 0.45333333333333337, "f1_ci": {"90": [0.39745898298944954, 0.5064813035214726], "95": [0.3861220200232313, 0.5190568654646326]}, "precision": 0.4336734693877551, "recall": 0.4748603351955307}, "event": {"f1": 0.39828693790149894, "f1_ci": {"90": [0.3415730337078652, 0.456629460510739], "95": [0.3301304866742681, 0.4646474034020503]}, "precision": 0.4603960396039604, "recall": 0.35094339622641507}, "group": {"f1": 0.5281090289608178, "f1_ci": {"90": [0.48241536800880896, 0.577548236739413], "95": [0.4707699919291534, 0.5884499238915168]}, "precision": 0.5615942028985508, "recall": 0.4983922829581994}, "location": {"f1": 0.6095238095238096, "f1_ci": {"90": [0.5387194963046357, 0.6712802768166091], "95": [0.5269345238095238, 0.6860918021485609]}, "precision": 0.64, "recall": 0.5818181818181818}, "person": {"f1": 0.7992895204262878, "f1_ci": {"90": [0.7700797991571775, 0.8255599326386835], "95": [0.7649718398835049, 0.8306304806824568]}, "precision": 0.8490566037735849, "recall": 0.7550335570469798}, "product": {"f1": 0.6415094339622642, "f1_ci": {"90": [0.5941294695876195, 0.6870398266786277], "95": [0.5813202020202021, 0.6948054459658081]}, "precision": 0.6666666666666666, "recall": 0.6181818181818182}}}
|
eval/{metric.json → metric.test_2021.json}
RENAMED
|
@@ -1 +1 @@
|
|
| 1 |
-
{"
|
|
|
|
| 1 |
+
{"micro/f1": 0.6175553918513061, "micro/f1_ci": {"90": [0.6085886303107021, 0.6270245504530414], "95": [0.6071586866067074, 0.6287436113239784]}, "micro/recall": 0.6300878815911193, "micro/precision": 0.6055117235248361, "macro/f1": 0.5699978267978356, "macro/f1_ci": {"90": [0.5605132986273212, 0.5797067599839523], "95": [0.5588124392557708, 0.5811940101640996]}, "macro/recall": 0.5841701622550579, "macro/precision": 0.5590687883112516, "per_entity_metric": {"corporation": {"f1": 0.4889844169801182, "f1_ci": {"90": [0.4640154790729851, 0.515102305102305], "95": [0.458960569692277, 0.5184799847126035]}, "precision": 0.47346514047866806, "recall": 0.5055555555555555}, "creative_work": {"f1": 0.3800116211504939, "f1_ci": {"90": [0.35191852653953354, 0.40933711169196746], "95": [0.34682573875113965, 0.41311093888923844]}, "precision": 0.3303030303030303, "recall": 0.4473324213406293}, "event": {"f1": 0.4550669216061186, "f1_ci": {"90": [0.4322288263190161, 0.4776987543942918], "95": [0.4279424228309153, 0.4810260222978927]}, "precision": 0.47935548841893255, "recall": 0.43312101910828027}, "group": {"f1": 0.5702400000000001, "f1_ci": {"90": [0.5503755696583996, 0.591894081025951], "95": [0.5461277611277611, 0.5958909853906346]}, "precision": 0.5544492843808339, "recall": 0.5869565217391305}, "location": {"f1": 0.6506189821182944, "f1_ci": {"90": [0.6223673974540311, 0.678031547405726], "95": [0.6154868663693391, 0.6833961095707151]}, "precision": 0.6409214092140921, "recall": 0.6606145251396648}, "person": {"f1": 0.8133776792313377, "f1_ci": {"90": [0.802455084121242, 0.8241577387325482], "95": [0.8002960866175137, 0.8264256405395821]}, "precision": 0.8151851851851852, "recall": 0.8115781710914455}, "product": {"f1": 0.6316851664984864, "f1_ci": {"90": [0.6088324911643448, 0.6536741705155935], "95": [0.6046596973132213, 0.6580478190391984]}, "precision": 0.6198019801980198, "recall": 0.6440329218106996}}}
|
eval/metric_span.test_2020.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"micro/f1": 0.7375103505382279, "micro/f1_ci": {}, "micro/recall": 0.6933056564608199, "micro/precision": 0.7877358490566038, "macro/f1": 0.7375103505382279, "macro/f1_ci": {}, "macro/recall": 0.6933056564608199, "macro/precision": 0.7877358490566038}
|
eval/metric_span.test_2021.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"micro/f1": 0.7692483045534848, "micro/f1_ci": {}, "micro/recall": 0.7805019081762461, "micro/precision": 0.758314606741573, "macro/f1": 0.7692483045534848, "macro/f1_ci": {}, "macro/recall": 0.7805019081762461, "macro/precision": 0.758314606741573}
|
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_2021", "dataset_name": null, "local_dataset": null, "model": "roberta-base", "crf": false, "max_length": 128, "epoch": 30, "batch_size": 32, "lr": 0.0001, "random_seed": 0, "gradient_accumulation_steps": 1, "weight_decay": 1e-07, "lr_warmup_step_ratio": 0.15, "max_grad_norm": 1}
|