Instructions to use ReneNtabana/kirundi-news-classifier with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ReneNtabana/kirundi-news-classifier with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="ReneNtabana/kirundi-news-classifier")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("ReneNtabana/kirundi-news-classifier") model = AutoModelForSequenceClassification.from_pretrained("ReneNtabana/kirundi-news-classifier", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Kirundi News Topic Classifier (AfroXLMR-base, fine-tuned)
Classifies a Kirundi (Ikirundi, run) news article into one of 10 topics:
politics, sport, economy, health, education, entertainment, relationship, technology, environment, culture.
- Base model: Davlan/afro-xlmr-base (Alabi et al., 2022)
- Training data: KIRNEWS (Niyongabo et al., 2020), re-cleaned and re-split (see below)
- Code, report and full experiments: https://github.com/ReneNtabana/Summative
- Demo: https://huggingface.co/spaces/ReneNtabana/kirundi-news-classifier
Data
The official KIRNEWS split leaks: all 923 test articles also occur in the training set. We pooled train+test, removed exact and near-duplicates, removed articles with conflicting labels and dropped classes with fewer than 25 unique articles (history, religion). This gives 1,742 articles, split stratified 70/15/15 (1,219 / 261 / 262).
Training
Fine-tuned for 8 epochs (best epoch by validation macro-F1: 6) with lr 3e-5, effective batch size 16, max length 512 subword tokens, class-weighted cross-entropy and frozen word embeddings (86M of 278M parameters trained). Seed 42, Apple M1 Pro (MPS).
Results
| Evaluation set | Accuracy | Macro-F1 |
|---|---|---|
| KIRNEWS held-out test (262 articles, 10 classes) | 0.897 | 0.795 |
| MasakhaNEWS-run (1,525 BBC Gahuza articles, 5 overlapping classes, out-of-distribution) | 0.872 | 0.799 |
A TF-IDF + linear SVM baseline reaches 0.908 / 0.833 in-domain but drops to 0.801 / 0.722 out-of-distribution.
Limitations
- Trained on ~1.2k articles from eight Burundian news websites. The rare classes (culture, environment, technology: 25β34 articles each) are unreliable.
- The model is over-confident: wrong predictions still average 0.86 probability. The demo flags predictions below 0.9.
- It always picks one of the 10 topics. Articles about other topics (e.g. religion, history) are usually labelled politics.
- It is multilingual and will also classify English/French/Kinyarwanda text, but this is not validated.
- AfroXLMR's adaptation corpus includes unlabelled KIRNEWS text (Alabi et al., 2022), which may make its in-domain test scores optimistic.
Usage
from transformers import pipeline
clf = pipeline("text-classification", model="ReneNtabana/kirundi-news-classifier")
clf("umukino w'umupira w'amaguru wahuje intamba mu rugamba na ...".lower())
Lower-case the text and normalise apostrophes (β β ') as during training.
References
- Niyongabo, R. A., Hong, Q., Kreutzer, J., & Huang, L. (2020). KINNEWS and KIRNEWS: Benchmarking cross-lingual text classification for Kinyarwanda and Kirundi. COLING 2020.
- Alabi, J. O., Adelani, D. I., Mosbach, M., & Klakow, D. (2022). Adapting pre-trained language models to African languages via multilingual adaptive fine-tuning. COLING 2022.
- Adelani, D. I., et al. (2023). MasakhaNEWS: News topic classification for African languages. IJCNLP-AACL 2023.
- Downloads last month
- 16
Model tree for ReneNtabana/kirundi-news-classifier
Base model
Davlan/afro-xlmr-base