dsfsi/setswana-sentiment
Viewer • Updated • 7.01k • 75
How to use Ido-shraga/setswana-sentiment-afroxlmr-large with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-classification", model="Ido-shraga/setswana-sentiment-afroxlmr-large") # pip install -U transformers accelerate
# Load model directly
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("Ido-shraga/setswana-sentiment-afroxlmr-large")
model = AutoModelForSequenceClassification.from_pretrained("Ido-shraga/setswana-sentiment-afroxlmr-large", device_map="auto")AfroXLMR-large fine-tuned for 3-class sentiment classification of Setswana (Tswana) tweets: Positive / Negative / Neutral.
Trained on the DSFSI Setswana Sentiment corpus — 3,555 Setswana Twitter posts (2021–2022) annotated by three native speakers (arXiv:2605.27239).
| Metric | Value |
|---|---|
| Accuracy | 0.532 |
| Macro-F1 | 0.405 |
Sibling models fine-tuned on the same data for comparison — this is the weakest of the family on macro-F1:
| Model | Test accuracy | Test macro-F1 |
|---|---|---|
| Ido-shraga/setswana-sentiment-mbert | 0.567 | 0.524 |
| Ido-shraga/setswana-sentiment-afriberta-large | 0.552 | 0.504 |
| this model (afro-xlmr-large) | 0.532 | 0.405 |
| Ido-shraga/setswana-sentiment-afroxlmr-base | 0.500 | 0.486 |
Two findings worth knowing:
torch_dtype=torch.float32 leaves the weights in fp16, gradients underflow to zero, and training deterministically collapses to the majority class (test accuracy exactly 0.431, macro-F1 0.201) at every learning rate, seed, and precision setting tried. Always load with an explicit fp32 upcast.This model is the best of 7 runs; its weights were preserved from the winning run.
torch_dtype=torch.float32 (fp16→fp32 upcast)dsfsi/setswana-sentiment text → consensus_label (train 2,762 / validation 346 / test 346)from transformers import pipeline
clf = pipeline("text-classification", model="Ido-shraga/setswana-sentiment-afroxlmr-large")
clf("setswana text here")
# [{'label': 'Neutral', 'score': 0.91}]
The training data is released under the NOODL license (dsfsi/setswana-sentiment).
@misc{abdulmumin2026temporalsimultaneitypredictsannotation,
title={Temporal Simultaneity Predicts Annotation Quality in Sentiment Corpora},
author={Idris Abdulmumin and Mokgadi Penelope Matloga and Tadesse Destaw Belay and Botshelo Kondowe and Letlhogonolo Mohleleng and Hareaipha Nkopo Letsoalo and Shamsuddeen Hassan Muhammad and Vukosi Marivate},
year={2026},
eprint={2605.27239},
archivePrefix={arXiv},
url={https://arxiv.org/abs/2605.27239},
}
Base model
Davlan/afro-xlmr-large