Instructions to use arnolfokam/bert-base-uncased-pcm with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use arnolfokam/bert-base-uncased-pcm with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("token-classification", model="arnolfokam/bert-base-uncased-pcm")# Load model directly from transformers import AutoTokenizer, AutoModelForTokenClassification tokenizer = AutoTokenizer.from_pretrained("arnolfokam/bert-base-uncased-pcm") model = AutoModelForTokenClassification.from_pretrained("arnolfokam/bert-base-uncased-pcm") - Notebooks
- Google Colab
- Kaggle
Commit ·
a717809
1
Parent(s): cff43eb
Update README.md
Browse files
README.md
CHANGED
|
@@ -13,4 +13,61 @@ license: apache-2.0
|
|
| 13 |
widget:
|
| 14 |
- text: "Mixed Martial Arts joinbodi, Ultimate Fighting Championship, UFC don decide say dem go enta back di octagon on Saturday, 9 May, for Jacksonville, Florida."
|
| 15 |
---
|
| 16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
widget:
|
| 14 |
- text: "Mixed Martial Arts joinbodi, Ultimate Fighting Championship, UFC don decide say dem go enta back di octagon on Saturday, 9 May, for Jacksonville, Florida."
|
| 15 |
---
|
| 16 |
+
|
| 17 |
+
# Model description
|
| 18 |
+
**bert-base-uncased-pcm** is a model based on the fine-tuned BERT base uncased 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 Nigerian Pidgin corpus **(pcm)** 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 **(pcm)** 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-pcm**| 88.61 | 84.17 | 86.33
|
| 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-pcm")
|
| 66 |
+
model = AutoModelForTokenClassification.from_pretrained("bert-base-uncased-pcm")
|
| 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 |
+
```
|