Views
No views yet
Zabantu( "Za" for South Africa, "bantu" for Bantu languages) is a collection of masked language models that have been trained from scratch using a compact dataset comprising various subsets of Bantu languages spoken in South Africa. These models are inspired by the work done on AfriBERTa, which demonstrated the effectiveness of training on XLM-R architecture using a smaller dataset. The focus of this work was to use LLMs to advance NLP applications in Tshivenda and also to serve as a benchmark for future works covering Bantu languages.
1from transformers import pipeline
2
3# Initialize the pipeline for masked language model
4# Note: You might need to login, and request permissions to access dsfsi while the model is in private-beta
5unmasker = pipeline('fill-mask', model='dsfsi/zabantu-bantu-250m')
6
7
8sample_sentences = {
9 'zulu': "Le ndoda ithi izo____ ukudla.", # Masked word for Zulu
10 'tshivenda': "Mufana uyo____ vhukuma.", # Masked word for Tshivenda
11 'sepedi': "Mosadi o ____ pheka.", # Masked word for Sepedi
12 'tswana': "Monna o ____ tsamaya.", # Masked word for Tswana
13 'tsonga': "N'wana wa xisati u ____ ku tsaka." # Masked word for Tsonga
14}
15
16
17for language, sentence in sample_sentences.items():
18 masked_sentence = sentence.replace('____', unmasker.tokenizer.mask_token)
19 # Get the model predictions
20 results = unmasker(masked_sentence)
21 print(f"Original sentence ({language}): {sentence}")
22 print(f"Top prediction for the masked token: {results[0]['sequence']}\n")| 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 |
| Weighted F1 [%] | Afriberta | Afroxlmr | zabantu-nsoven | zabantu-sotven | zabantu-bantu |
|---|---|---|---|---|---|
| ven | 60 | 62 | 66 | 69 | 55 |