arnolfokam
commited on
Commit
•
511a308
1
Parent(s):
a76b854
Update README.md
Browse files
README.md
CHANGED
@@ -13,4 +13,61 @@ license: apache-2.0
|
|
13 |
widget:
|
14 |
- text: "Wizara ya afya ya Tanzania imeripoti Jumatatu kuwa, watu takriban 14 zaidi wamepata maambukizi ya Covid-19."
|
15 |
---
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
widget:
|
14 |
- text: "Wizara ya afya ya Tanzania imeripoti Jumatatu kuwa, watu takriban 14 zaidi wamepata maambukizi ya Covid-19."
|
15 |
---
|
16 |
+
|
17 |
+
# Model description
|
18 |
+
**bert-base-uncased-swa** is a model based on the fine-tuned RoBERTa base model. It has been trained to recognize four types of entities:
|
19 |
+
- dates & time (DATE)
|
20 |
+
- Location (LOC)
|
21 |
+
- Organizations (ORG)
|
22 |
+
- Person (PER)
|
23 |
+
|
24 |
+
# Intended Use
|
25 |
+
- Intended to be used for research purposes concerning Named Entity Recognition for African Languages.
|
26 |
+
- Not intended for practical purposes.
|
27 |
+
|
28 |
+
# Training Data
|
29 |
+
This model was fine-tuned on the Swahili corpus **(swa)** of the [MasakhaNER](https://github.com/masakhane-io/masakhane-ner) dataset. However, we thresholded the number of entity groups per sentence in this dataset to 10 entity groups.
|
30 |
+
|
31 |
+
# Training procedure
|
32 |
+
This model was trained on a single NVIDIA P5000 from [Paperspace](https://www.paperspace.com)
|
33 |
+
#### Hyperparameters
|
34 |
+
- **Learning Rate:** 5e-5
|
35 |
+
- **Batch Size:** 32
|
36 |
+
- **Maximum Sequence Length:** 164
|
37 |
+
- **Epochs:** 30
|
38 |
+
|
39 |
+
# Evaluation Data
|
40 |
+
We evaluated this model on the test split of the Swahili corpus **(swa)** present in the [MasakhaNER](https://github.com/masakhane-io/masakhane-ner) with no thresholding.
|
41 |
+
|
42 |
+
# Metrics
|
43 |
+
- Precision
|
44 |
+
- Recall
|
45 |
+
- F1-score
|
46 |
+
|
47 |
+
# Limitations
|
48 |
+
- The size of the pre-trained language model prevents its usage in anything other than research.
|
49 |
+
- Lack of analysis concerning the bias and fairness in these models may make them dangerous if deployed into production system.
|
50 |
+
- The train data is a less populated version of the original dataset in terms of entity groups per sentence. Therefore, this can negatively impact the performance.
|
51 |
+
|
52 |
+
# Caveats and Recommendations
|
53 |
+
- The topics in the dataset corpus are centered around **News**. Future training could be done with a more diverse corpus.
|
54 |
+
|
55 |
+
# Results
|
56 |
+
Model Name| Precision | Recall | F1-score
|
57 |
+
-|-|-|-
|
58 |
+
**bert-base-uncased-swa**| 85.59 | 90.80 | 88.12
|
59 |
+
|
60 |
+
# Usage
|
61 |
+
```python
|
62 |
+
from transformers import AutoTokenizer, AutoModelForTokenClassification
|
63 |
+
from transformers import pipeline
|
64 |
+
|
65 |
+
tokenizer = AutoTokenizer.from_pretrained("arnolfokam/bert-base-uncased-swa")
|
66 |
+
model = AutoModelForTokenClassification.from_pretrained("bert-base-uncased-swa")
|
67 |
+
|
68 |
+
nlp = pipeline("ner", model=model, tokenizer=tokenizer)
|
69 |
+
example = "Wizara ya afya ya Tanzania imeripoti Jumatatu kuwa, watu takriban 14 zaidi wamepata maambukizi ya Covid-19."
|
70 |
+
|
71 |
+
ner_results = nlp(example)
|
72 |
+
print(ner_results)
|
73 |
+
```
|