readme: add initial version
Browse files
README.md
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- en
|
| 4 |
+
library_name: flair
|
| 5 |
+
pipeline_tag: token-classification
|
| 6 |
+
base_model: FacebookAI/xlm-roberta-large
|
| 7 |
+
widget:
|
| 8 |
+
- text: According to the BBC George Washington went to Washington.
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+
# Flair NER Model trained on CleanCoNLL Dataset
|
| 12 |
+
|
| 13 |
+
This (unofficial) Flair NER model was trained on the awesome [CleanCoNLL](https://aclanthology.org/2023.emnlp-main.533/) dataset.
|
| 14 |
+
|
| 15 |
+
The CleanCoNLL dataset was proposed by Susanna Rücker and Alan Akbik and introduces a corrected version of the classic CoNLL-03 dataset, with updated and more consistent NER labels.
|
| 16 |
+
|
| 17 |
+
## Fine-Tuning
|
| 18 |
+
|
| 19 |
+
We use XLM-RoBERTa Large as backbone language model and the following hyper-parameters for fine-tuning:
|
| 20 |
+
|
| 21 |
+
| Hyper-Parameter | Value |
|
| 22 |
+
|:--------------- |:-------|
|
| 23 |
+
| Batch Size | `4` |
|
| 24 |
+
| Learning Rate | `5-06` |
|
| 25 |
+
| Max. Epochs | `10` |
|
| 26 |
+
|
| 27 |
+
Additionally, the [FLERT](https://arxiv.org/abs/2011.06993) approach is used for fine-tuning the model. [Training logs](training.log) and [TensorBoard](../../tensorboard) are also available for each model.
|
| 28 |
+
|
| 29 |
+
## Results
|
| 30 |
+
|
| 31 |
+
We report micro F1-Score on development (in brackets) and test set for five runs with different seeds:
|
| 32 |
+
|
| 33 |
+
| [Seed 1][1] | [Seed 2][2] | [Seed 3][3] | [Seed 4][4] | [Seed 5][5] | Avg.
|
| 34 |
+
|:--------------- |:--------------- |:--------------- |:--------------- |:--------------- |:--------------- |
|
| 35 |
+
| (97.34) / 97.00 | (97.26) / 96.90 | (97.66) / 97.02 | (97.42) / 96.96 | (97.46) / 96.99 | (97.43) / 96.97 |
|
| 36 |
+
|
| 37 |
+
Rücker and Akbik report 96.98 on three different runs, so our results are very close to their reported performance!
|
| 38 |
+
|
| 39 |
+
[1]: https://huggingface.co/stefan-it/flair-clean-conll-1
|
| 40 |
+
[2]: https://huggingface.co/stefan-it/flair-clean-conll-2
|
| 41 |
+
[3]: https://huggingface.co/stefan-it/flair-clean-conll-3
|
| 42 |
+
[4]: https://huggingface.co/stefan-it/flair-clean-conll-4
|
| 43 |
+
[5]: https://huggingface.co/stefan-it/flair-clean-conll-5
|
| 44 |
+
|
| 45 |
+
# Flair Demo
|
| 46 |
+
|
| 47 |
+
The following snippet shows how to use the CleanCoNLL NER models with Flair:
|
| 48 |
+
|
| 49 |
+
```python
|
| 50 |
+
from flair.data import Sentence
|
| 51 |
+
from flair.models import SequenceTagger
|
| 52 |
+
|
| 53 |
+
# load tagger
|
| 54 |
+
tagger = SequenceTagger.load("stefan-it/flair-clean-conll-4")
|
| 55 |
+
|
| 56 |
+
# make example sentence
|
| 57 |
+
sentence = Sentence("According to the BBC George Washington went to Washington.")
|
| 58 |
+
|
| 59 |
+
# predict NER tags
|
| 60 |
+
tagger.predict(sentence)
|
| 61 |
+
|
| 62 |
+
# print sentence
|
| 63 |
+
print(sentence)
|
| 64 |
+
|
| 65 |
+
# print predicted NER spans
|
| 66 |
+
print('The following NER tags are found:')
|
| 67 |
+
# iterate over entities and print
|
| 68 |
+
for entity in sentence.get_spans('ner'):
|
| 69 |
+
print(entity)
|
| 70 |
+
```
|