Instructions to use JohnAlbarkaIbrahim/afroxlmr-mini-nigerian-sentiment with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use JohnAlbarkaIbrahim/afroxlmr-mini-nigerian-sentiment with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="JohnAlbarkaIbrahim/afroxlmr-mini-nigerian-sentiment")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("JohnAlbarkaIbrahim/afroxlmr-mini-nigerian-sentiment", device_map="auto") - Notebooks
- Google Colab
- Kaggle
AfroXLMR-Mini Nigerian Sentiment
Fine-tuned sentiment-classification model based on
Davlan/afro-xlmr-mini.
The model is designed for sentiment classification of Nigerian English, Nigerian Pidgin, Hausa, Igbo, and Yoruba, with additional domain adaptation using consented real-world WhatsApp conversations.
Task
Three-class sentiment classification:
positivenegativeneutral
Base Model
Davlan/afro-xlmr-mini
The base model is used independently in another part of the project for multilingual vector embedding generation.
This repository contains the fine-tuned sentiment classifier. It should not be used as the embedding model.
Training Data
General Nigerian-language sentiment data
The training corpus contains 140,256 examples across:
| Language | Samples |
|---|---|
| English | 76,706 |
| Hausa | 22,152 |
| Igbo | 15,715 |
| Pidgin | 10,556 |
| Yoruba | 15,127 |
| Total | 140,256 |
The training pipeline applies language-balanced sampling during fine-tuning so that the dominant English corpus does not overwhelm the lower-resource Nigerian languages.
WhatsApp domain adaptation
An additional 1,058 consented and anonymized WhatsApp messages were used for domain adaptation.
| Language | Samples |
|---|---|
| English | 500 |
| Pidgin | 498 |
| Mixed English/Pidgin | 60 |
| Total | 1,058 |
The WhatsApp dataset contains anonymized conversational text and was collected with participant consent.
Training Strategy
The model was trained in two stages:
- Multilingual sentiment fine-tuning using the language-balanced
otherstraining corpus. - Continued fine-tuning using the WhatsApp training corpus for conversational-domain adaptation.
The WhatsApp test set was kept separate from training.
Evaluation
Evaluation artifacts and benchmark results are provided in:
v1/results/
The results include evaluation information from the multilingual test sets and the held-out WhatsApp test set.
Metrics include class-level and aggregate classification metrics where available.
Model Formats
This repository contains several deployment formats:
v1/
βββ final_model/ # Hugging Face Transformers model
βββ onnx/ # ONNX model
βββ onnx_int8/ # Dynamically quantized INT8 ONNX model
βββ results/ # Evaluation and benchmark artifacts
βββ deployment/ # Deployment-related files
For CPU-based production inference, the recommended artifact is:
v1/onnx_int8/
Intended Use
This model is intended for:
Nigerian social-media sentiment analysis
Nigerian conversational text analysis
WhatsApp-style sentiment classification
Research involving low-resource African languages
CPU-efficient sentiment inference in backend services
Limitations
Performance may vary substantially across languages, dialects,
code-switching patterns, spelling variations, slang, emojis, and
informal conversational expressions.
The WhatsApp domain-adaptation corpus is substantially smaller than
the general multilingual corpus. Results should therefore not be
interpreted as representing all Nigerian WhatsApp conversations.
The model should not be used for high-stakes decisions involving
individuals.
Privacy
The WhatsApp domain-adaptation data was anonymized before training
and was collected with participant consent.
No personally identifying information should be inferred from the
published model or artifacts.
Deployment
The INT8 ONNX model is intended to be loaded using ONNX Runtime,
making it suitable for CPU inference in a FastAPI backend.
The sentiment classifier is architecturally separate from the
project's AfroXLMR embedding model.
Citation
If you use this model in research or a project, please cite this
repository and the original AfroXLMR-mini model.