Downloads · 30 days
76
5% of all-time downloads
innocent-charles/Swahili-question-answer-latest-cased
Swahili-question-answer-latest-cased is a question answering model from innocent-charles. Use it when the input is a question plus a passage. It is set up for transformers. The card lists the license as cc-by-4.0.
This is the bert-base-multilingual-cased model, fine-tuned using the KenyaCorpus dataset. It's been trained on question-answer pairs, including unanswerable questions, for the task of Question Answering in Swahili Lan…
Downloads · 30 days
76
5% of all-time downloads
All-time downloads
1.5K
Public
Repo size
2.8 GB
Likes
4
Public
Click a slice to open those files.
.pt1.4 GB · 67%
From the Hugging Face model README
This is the bert-base-multilingual-cased model, fine-tuned using the KenyaCorpus dataset. It's been trained on question-answer pairs, including unanswerable questions, for the task of Question Answering in Swahili Language.
Question answering (QA) is a computer science discipline within the fields of information retrieval and NLP that help in the development of systems in such a way that, given a question in natural language, can extract relevant information from provided data and present it in the form of natural language answers.
Language model used: bert-base-multilingual-cased
Language: Kiswahili
Downstream-task: Extractive Swahili QA
Training data: KenyaCorpus
Eval data: KenyaCorpus
Code: See an example QA pipeline on Haystack
Infrastructure: AWS NVIDIA A100 Tensor Core GPU
batch_size = 16
n_epochs = 10
base_LM_model = "bert-base-multilingual-cased"
max_seq_len = 386
learning_rate = 3e-5
lr_schedule = LinearWarmup
warmup_proportion = 0.2
doc_stride=128
max_query_length=64
Haystack is an NLP framework by deepset. You can use this model in a Haystack pipeline to do question answering at scale (over many documents). To load the model in Haystack:
reader = FARMReader(model_name_or_path="innocent-charles/Swahili-question-answer-latest-cased")
# or
reader = TransformersReader(model_name_or_path="innocent-charles/Swahili-question-answer-latest-cased",tokenizer="innocent-charles/Swahili-question-answer-latest-cased")
For a complete example of Swahili-question-answer-latest-cased being used for Swahili Question Answering, check out the Tutorials in Haystack Documentation
from transformers import AutoModelForQuestionAnswering, AutoTokenizer, pipeline
model_name = "innocent-charles/Swahili-question-answer-latest-cased"
# a) Get predictions
nlp = pipeline('question-answering', model=model_name, tokenizer=model_name)
QA_input = {
'question': 'Asubuhi ilitupata pambajioi pa hospitali gani?',
'context': 'Asubuhi hiyo ilitupata pambajioni pa hospitali ya Uguzwa.'
}
res = nlp(QA_input)
# b) Load model & tokenizer
model = AutoModelForQuestionAnswering.from_pretrained(model_name)
tokenizer = AutoTokenizer.from_pretrained(model_name)
"exact": 51.87029394424324,
"f1": 63.91251169582613,
"total": 445,
"HasAns_exact": 50.93522267206478,
"HasAns_f1": 62.02838248389763,
"HasAns_total": 386,
"NoAns_exact": 49.79983179142137,
"NoAns_f1": 60.79983179142137,
"NoAns_total": 59
The project is still going, hence the model is still updated after training the model in more data, Therefore pull requests are welcome to contribute to increase the performance of the model.
Innocent Charles: [email protected]