Downloads · 30 days
20
4% of all-time downloads
eolang/sw-fillmask
sw-fillmask is a fill-mask model from eolang. Use it when you need the model to fill a missing word. It is set up for transformers. The card lists the license as mit.
SW-FillMask is a BERT-based transformer model pre-trained on a large corpus of Swahili text in a self-supervised fashion. The model was trained specifically to handle real-world Kenyan Swahili, which frequently involv…
Downloads · 30 days
20
4% of all-time downloads
All-time downloads
508
Public
Parameters
110M
876 MB on disk
Likes
0
Public
Click a slice to open those files.
.bin438 MB · 50%
How the weights are stored.
F32110M · 100%
From the Hugging Face model README
SW-FillMask is a BERT-based transformer model pre-trained on a large corpus of Swahili text in a self-supervised fashion. The model was trained specifically to handle real-world Kenyan Swahili, which frequently involves code-mixing with English - a limitation of most existing Swahili NLP models trained on formal, clean text.
It was pre-trained on raw texts only, with no human labeling, using an automatic process to generate inputs and labels. More precisely, it was pre-trained with one objective:
This way, the model learns an inner representation of the Swahili language that can then be used to extract features useful for downstream tasks e.g.
The model is based on the original BERT UNCASED which can be found on google-research/bert readme
The model was pre-trained on a curated corpus of Swahili text scraped from publicly available sources, with particular attention to Kenyan Swahili usage patterns including natural code-switching between Swahili and English. Standard preprocessing was applied including tokenisation and text cleaning.
You can use the raw model for masked language modeling, but it is primarily intended to be fine-tuned on a downstream task.
Best suited for:
Not recommended for:
You can use this model directly with a pipeline for masked language modeling:
from transformers import pipeline
fill_mask = pipeline("fill-mask", model="eolang/sw-fillmask")
sample_text = "Tumefanya mabadiliko muhimu [MASK] sera zetu za faragha na vidakuzi"
for prediction in fill_mask(sample_text):
print(f"{prediction['sequence']}, confidence: {prediction['score']:.4f}")
from transformers import AutoTokenizer, AutoModelForMaskedLM
tokenizer = AutoTokenizer.from_pretrained("eolang/sw-fillmask")
model = AutoModelForMaskedLM.from_pretrained("eolang/sw-fillmask")
text = "Hii ni tovuti ya idhaa ya Kiswahili ya BBC ambayo hukuletea habari na makala kutoka Afrika na kote duniani kwa lugha ya Kiswahili."
encoded_input = tokenizer(text, return_tensors='pt')
output = model(**encoded_input)
print(output)
from transformers import AutoTokenizer, AutoModelForTokenClassification
tokenizer = AutoTokenizer.from_pretrained("eolang/sw-fillmask")
model = AutoModelForTokenClassification.from_pretrained("eolang/sw-fillmask", num_labels=NUM_LABELS)
Even if the training data used for this model could be reasonably neutral, this model can have biased predictions. The model's performance on formal or standardised Swahili may also differ from its performance on informal or code-mixed text. This is something I'm still working on improving. Feel free to share suggestions/comments via Discussions
If you use this model in your research, please cite:
@misc{olang2026swfillmask,
author = {Olang', Emmanuel},
title = {SW-FillMask: A Swahili Masked Language Model},
year = {2026},
publisher = {HuggingFace},
url = {https://huggingface.co/eolang/sw-fillmask}
}
Model developed by Emmanuel Olang' | GitHub | Website