Downloads · 30 days
188
11% of all-time downloads
dsfsi/zabantu-xlm-roberta
zabantu-xlm-roberta is a fill-mask model from dsfsi. Use it when you need the model to fill a missing word. It is set up for transformers. The card lists the license as cc-by-4.0.
Zabantu-XLM-RoBERTa is a multilingual masked language model developed to investigate whether cross-lingual learning, via pretraining on related Bantu languages, can improve NLP coverage for Tshivenda, a language with…
Downloads · 30 days
188
11% of all-time downloads
All-time downloads
1.7K
Public
Repo size
2 GB
Likes
4
Public
Click a slice to open those files.
.bin1000 MB · 100%
From the Hugging Face model README
Zabantu-XLM-RoBERTa is a multilingual masked language model developed to investigate whether cross-lingual learning, via pretraining on related Bantu languages, can improve NLP coverage for Tshivenda, a language with very little text of its own. It uses the XLM-RoBERTa architecture and was pre-trained from scratch, inspired by AfriBERTa, developed by Kelechi Ogueji, Yuxin Zhu, and Jimmy Lin. Their paper, Small Data? No Problem! Exploring the Viability of Pretrained Multilingual Language Models for Low-resourced Languages (2021), demonstrated that competitive multilingual language models could be trained from scratch on limited amounts of text from African languages. This work applies cross-lingual learning to advance NLP applications in Tshivenda, and it also serves as a benchmark for future work on other Bantu languages.
The word Zabantu is derived from: "Za" for South Africa, and "bantu" for Bantu languages
This repository hosts the Zabantu large variant, trained on nine South African Bantu languages: Tshivenda, Sepedi, Sesotho, Setswana, Xitsonga, isiNdebele, isiXhosa, isiZulu, and siSwati. The wider Zabantu project explores different combinations of Bantu languages through monolingual, bilingual, and multilingual experiments.
| Property | This checkpoint |
|---|---|
| Hub ID | dsfsi/zabantu-xlm-roberta |
| Model class | XLMRobertaForMaskedLM |
| Training objective | Masked language modelling (MLM) |
| Transformer layers | 8 |
| Hidden size | 768 |
| Attention heads per layer | 6 |
| Feed-forward intermediate size | 3,072 |
| Vocabulary size | 250,002, including special tokens |
| Maximum sequence length | 512 tokens |
| Tokenizer | SentencePiece BPE |
| Model size | ~250M parameters |
| Licence | CC BY 4.0 |
See config.json for the architecture configuration.
from transformers import pipeline
unmasker = pipeline('fill-mask', model='dsfsi/zabantu-xlm-roberta')
sample_sentences = {
'zulu': "Le ndoda ithi izo____ ukudla.", # Masked word for Zulu
'tshivenda': "Mufana uyo____ vhukuma.", # Masked word for Tshivenda
'sepedi': "Mosadi o ____ pheka.", # Masked word for Sepedi
'tswana': "Monna o ____ tsamaya.", # Masked word for Tswana
'tsonga': "N'wana wa xisati u ____ ku tsaka." # Masked word for Tsonga
}
for language, sentence in sample_sentences.items():
masked_sentence = sentence.replace('____', unmasker.tokenizer.mask_token)
# Get the model predictions
results = unmasker(masked_sentence)
print(f"Original sentence ({language}): {sentence}")
print(f"Top prediction for the masked token: {results[0]['sequence']}\n")
Like any Masked Language Model (MLM), Zabantu models can be adapted to a variety of semantic tasks such as:
Monolingual test F1 scores on News Topic Classification
| Weighted F1 [%] | Afriberta-large | Afroxlmr | zabantu-nsoven | zabantu-sotven | zabantu-bantu |
|---|---|---|---|---|---|
| nso | 71.4 | 71.6 | 74.3 | 69 | 70.6 |
| ven | 74.3 | 74.1 | 77 | 76 | 75.6 |
Few-shot(50 shots) test F1 scores on News Topic Classification
| Weighted F1 [%] | Afriberta | Afroxlmr | zabantu-nsoven | zabantu-sotven | zabantu-bantu |
|---|---|---|---|---|---|
| ven | 60 | 62 | 66 | 69 | 55 |
Limitations:
Although efforts have been made to include a wide range of South African languages, the model's coverage may still be limited for certain dialects. We note that the training set was largely dominated by Setwana and IsiXhosa.
We also acknowledge the potential to further improve the model by training it on more data, including additional domains and topics.
As with any language model, the generated output should be carefully reviewed and post-processed to ensure accuracy and cultural sensitivity.
The models have been trained on a large corpus of text data collected from various sources, including SADiLaR, Leipnets, Flores, CC-100, Opus and various South African government websites. The training data covers a wide range of topics and domains, notably religion, politics, academics and health (mostly Covid-19).
<hr/>If you use Zabantu in research, please cite:
@mastersthesis{nemakhavhani2023tshivenda,
author = {Nemakhavhani, Ndamulelo},
title = {Exploring cross-lingual learning techniques for advancing Tshivenda NLP coverage},
school = {University of Pretoria},
type = {Mini-dissertation, MIT (Big Data Science)},
year = {2023},
note = {Supervised by Vukosi Marivate and Jocelyn Mazarura},
url = {https://repository.up.ac.za/handle/2263/98198}
}
Zabantu was developed in Ndamulelo Nemakhavhani's 2023 mini-dissertation at the University of Pretoria, supervised by Prof. Vukosi Marivate and Dr Jocelyn Mazarura.