readme: add initial version
Browse files
README.md
CHANGED
@@ -1,3 +1,83 @@
|
|
1 |
-
---
|
2 |
-
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language:
|
3 |
+
- bar
|
4 |
+
library_name: flair
|
5 |
+
pipeline_tag: token-classification
|
6 |
+
base_model: deepset/gbert-large
|
7 |
+
widget:
|
8 |
+
- text: "Dochau ( amtli : Dochau ) is a Grouße Kroasstod in Obabayern nordwestli vo Minga und liagt im gleichnoming Landkroas ."
|
9 |
+
tags:
|
10 |
+
- flair
|
11 |
+
- token-classification
|
12 |
+
- sequence-tagger-model
|
13 |
+
---
|
14 |
+
|
15 |
+
# Flair NER Model for Recognizing Named Entities in Bavarian Dialectal Data (Wikipedia)
|
16 |
+
|
17 |
+
This (unofficial) Flair NER model was trained on annotated Bavarian Wikipedia articles from the BarNER dataset that was proposed in the ["Sebastian, Basti, Wastl?! Recognizing Named Entities in Bavarian Dialectal Data"](https://aclanthology.org/2024.lrec-main.1262/) LREC-COLING 2024 paper by Siyao Peng, Zihang Sun, Huangyan Shan, Marie Kolm, Verena Blaschke, Ekaterina Artemova and Barbara Plank.
|
18 |
+
|
19 |
+
The released dataset is used in the *coarse* setting that is shown in Table 3 in the paper. The following Named Entities are available:
|
20 |
+
|
21 |
+
* `PER`
|
22 |
+
* `LOC`
|
23 |
+
* `ORG`
|
24 |
+
* `MISC`
|
25 |
+
|
26 |
+
## Fine-Tuning
|
27 |
+
|
28 |
+
We perform a hyper-parameter search over the following parameters:
|
29 |
+
|
30 |
+
* Batch Sizes: `[32, 16]`
|
31 |
+
* Learning Rates: `[7e-06, 8e-06, 9e-06, 1e-05]
|
32 |
+
* Epochs: `[20]`
|
33 |
+
* Subword Pooling: `[first]`
|
34 |
+
|
35 |
+
As base model we use [GBERT Large](https://huggingface.co/deepset/gbert-large). We use three different seeds to report the averaged F1-Score on the development set:
|
36 |
+
|
37 |
+
| Configuration | Run 1 | Run 2 | Run 3 | Avg. |
|
38 |
+
|:-------------------|:--------|:--------|:--------|:-------------|
|
39 |
+
| `bs32-e20-lr1e-05` | 76.96 | 77 | **77.71** | 77.22 ± 0.34 |
|
40 |
+
| `bs32-e20-lr8e-06` | 76.75 | 76.21 | 77.38 | 76.78 ± 0.48 |
|
41 |
+
| `bs16-e20-lr1e-05` | 76.81 | 76.29 | 76.02 | 76.37 ± 0.33 |
|
42 |
+
| `bs32-e20-lr7e-06` | 75.44 | 76.71 | 75.9 | 76.02 ± 0.52 |
|
43 |
+
| `bs32-e20-lr9e-06` | 75.69 | 75.99 | 76.2 | 75.96 ± 0.21 |
|
44 |
+
| `bs16-e20-lr8e-06` | 74.82 | 76.83 | 76.14 | 75.93 ± 0.83 |
|
45 |
+
| `bs16-e20-lr7e-06` | 76.77 | 74.82 | 76.04 | 75.88 ± 0.8 |
|
46 |
+
| `bs16-e20-lr9e-06` | 76.55 | 74.25 | 76.54 | 75.78 ± 1.08 |
|
47 |
+
|
48 |
+
The hyper-parameter configuration `bs32-e20-lr1e-05` yields to best results on the development set and we use this configuration to report the averaged F1-Score on the test set:
|
49 |
+
|
50 |
+
| Configuration | Run 1 | Run 2 | Run 3 | Avg. |
|
51 |
+
|:-------------------|:--------|:--------|:--------|:-------------|
|
52 |
+
| `bs32-e20-lr1e-05` | 72.1 | 74.33 | **72.97** | 73.13 ± 0.92 |
|
53 |
+
|
54 |
+
Our averaged result on test set is higher than the reported 72.17 in the original paper (see Table 5, in-domain training results).
|
55 |
+
|
56 |
+
For upload we used the best performing model on the development set, which is marked in bold. It achieves 72.97 on final test set.
|
57 |
+
|
58 |
+
# Flair Demo
|
59 |
+
|
60 |
+
The following snippet shows how to use the CleanCoNLL NER models with Flair:
|
61 |
+
|
62 |
+
```python
|
63 |
+
from flair.data import Sentence
|
64 |
+
from flair.models import SequenceTagger
|
65 |
+
|
66 |
+
# load tagger
|
67 |
+
tagger = SequenceTagger.load("stefan-it/flair-barner-wiki-coarse-gbert-large")
|
68 |
+
|
69 |
+
# make example sentence
|
70 |
+
sentence = Sentence("Dochau ( amtli : Dochau ) is a Grouße Kroasstod in Obabayern nordwestli vo Minga und liagt im gleichnoming Landkroas ..")
|
71 |
+
|
72 |
+
# predict NER tags
|
73 |
+
tagger.predict(sentence)
|
74 |
+
|
75 |
+
# print sentence
|
76 |
+
print(sentence)
|
77 |
+
|
78 |
+
# print predicted NER spans
|
79 |
+
print('The following NER tags are found:')
|
80 |
+
# iterate over entities and print
|
81 |
+
for entity in sentence.get_spans('ner'):
|
82 |
+
print(entity)
|
83 |
+
```
|