File size: 4,854 Bytes
366380e
 
543a0cf
e6c16dc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36f8676
543a0cf
e6c16dc
 
c641472
e6c16dc
a92c3ba
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e6c16dc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61405d9
 
334c3c5
 
 
 
61405d9
f1570d1
 
415ad13
 
 
f1570d1
 
 
 
 
415ad13
 
f1570d1
415ad13
f1570d1
415ad13
 
f1570d1
415ad13
f1570d1
415ad13
f1570d1
61405d9
 
e6c16dc
 
 
c641472
e6c16dc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
---
license: afl-3.0

language: 
- am
- bm
- obj
- ee
- fon
- ha
- ig
- rw
- lg
- luo
- mos
- ny
- pcm
- sn
- sw
- tn
- tw
- wo
- xh
- yo
- zu
- multilingual


datasets:
- masakhaner2
---


# masakhane/afroxlmr-large-ner-masakhaner-1.0_2.0
## Model description
**masakhane/afroxlmr-large-ner-masakhaner-1.0_2.0** is a **Named Entity Recognition (NER)** model for 21 African languages. Specifically, this model is a *Davlan/afro-xlmr-large* model that was fine-tuned on an aggregation of African language datasets obtained from two versions of MasakhaNER dataset i.e. [MasakhaNER 1.0](https://huggingface.co/datasets/masakhaner) and [MasakhaNER 2.0](https://huggingface.co/datasets/masakhane/masakhaner2). The languages covered are:

- Amharic (Amharic)
- Bambara (bam)
- Ghomala (bbj)
- Ewe (ewe)
- Fon (fon)
- Hausa (hau)
- Igbo (ibo)
- Kinyarwanda (kin)
- Luganda (lug)
- Dholuo (luo)
 -Mossi (mos)
- Chichewa (nya)
- Nigerian Pidgin
- chShona (sna)
- Kiswahili (swą)
- Setswana (tsn)
- Twi (twi)
- Wolof (wol)
- isiXhosa (xho)
- Yorùbá (yor)
- isiZulu (zul)

It has been trained to recognize four types of entities: dates & times (DATE), location (LOC), organization (ORG), and person (PER). 

## Intended uses & limitations
#### How to use
You can use this model with Transformers *pipeline* for NER.
```python
from transformers import AutoTokenizer, AutoModelForTokenClassification
from transformers import pipeline
tokenizer = AutoTokenizer.from_pretrained("masakhane/afroxlmr-large-ner-masakhaner-1.0_2.0")
model = AutoModelForTokenClassification.from_pretrained("masakhane/afroxlmr-large-ner-masakhaner-1.0_2.0")
nlp = pipeline("ner", model=model, tokenizer=tokenizer)
example = "Emir of Kano turban Zhang wey don spend 18 years for Nigeria"
ner_results = nlp(example)
print(ner_results)
```

## Eval results on MasakhaNER (F-score)

Model evaluated on MasakhaNER 1.0 and MasakhaNER 2.0 test sets

language| MasakhaNER 1.0 |  MasakhaNER 2.0 
-|-|-
amh |80.5| 
bam || 83.1
bbj || 76.6
ewe || 89.6
fon || 83.8
hau |90.3| 87.5
ibo |89.5| 93.5
kin |82.0| 87.6
lug |87.1| 89.7
luo |80.8| 82.5
mos || 75.5
nya || 92.7
pcm |91.1| 90.9
sna || 96.5
swa |88.5| 93.4
tsn || 90.3
twi || 81.3
wol |72.7| 87.3
xho || 90.0
yor |88.1| 90.5
zul || 91.3
avg |**85.1**| **87.7**


#### Limitations and bias
This model is limited by its training dataset of entity-annotated news articles from a specific span of time. This may not generalize well for all use cases in different domains.  
## Training data
This model was fine-tuned on the aggregation of [MasakhaNER 1.0](https://huggingface.co/datasets/masakhaner) and [MasakhaNER 2.0](https://huggingface.co/datasets/masakhane/masakhaner2) datasets

The training dataset distinguishes between the beginning and continuation of an entity so that if there are back-to-back entities of the same type, the model can output where the second entity begins. As in the dataset, each token will be classified as one of the following classes:
Abbreviation|Description
-|-
O|Outside of a named entity
B-DATE |Beginning of a DATE entity right after another DATE entity
I-DATE |DATE entity
B-PER |Beginning of a person’s name right after another person’s name
I-PER |Person’s name
B-ORG |Beginning of an organisation right after another organisation
I-ORG |Organisation
B-LOC |Beginning of a location right after another location
I-LOC |Location
## Training procedure
This model was trained on a single NVIDIA V100 GPU with recommended hyperparameters from the [original MasakhaNER paper](https://arxiv.org/abs/2103.11811) which trained & evaluated the model on MasakhaNER corpus. 


### BibTeX entry and citation info
```
@article{Adelani2022MasakhaNER2A,
  title={MasakhaNER 2.0: Africa-centric Transfer Learning for Named Entity Recognition},
  author={David Ifeoluwa Adelani and Graham Neubig and Sebastian Ruder and Shruti Rijhwani and Michael Beukman and Chester Palen-Michel and Constantine Lignos and Jesujoba Oluwadara Alabi and Shamsuddeen Hassan Muhammad and Peter Nabende and Cheikh M. Bamba Dione and Andiswa Bukula and Rooweither Mabuya and Bonaventure F. P. Dossou and Blessing K. Sibanda and Happy Buzaaba and Jonathan Mukiibi and Godson Kalipe and Derguene Mbaye and Amelia Taylor and Fatoumata Kabore and Chris C. Emezue and Anuoluwapo Aremu and Perez Ogayo and Catherine W. Gitau and Edwin Munkoh-Buabeng and Victoire Memdjokam Koagne and Allahsera Auguste Tapo and Tebogo Macucwa and Vukosi Marivate and Elvis Mboning and Tajuddeen R. Gwadabe and Tosin P. Adewumi and Orevaoghene Ahia and Joyce Nakatumba-Nabende and Neo L. Mokono and Ignatius M Ezeani and Chiamaka Ijeoma Chukwuneke and Mofetoluwa Adeyemi and Gilles Hacheme and Idris Abdulmumin and Odunayo Ogundepo and Oreen Yousuf and Tatiana Moteu Ngoli and Dietrich Klakow},
  journal={ArXiv},
  year={2022},
  volume={abs/2210.12391}
}
```