innocent-charles
commited on
Commit
•
e1ee1d5
1
Parent(s):
4c2b8f8
Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,116 @@
|
|
1 |
---
|
|
|
|
|
|
|
2 |
license: cc-by-4.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
+
language: en
|
3 |
+
datasets:
|
4 |
+
- kenyacorpus_v2
|
5 |
license: cc-by-4.0
|
6 |
+
model-index:
|
7 |
+
- name: innocent-charles/Swahili-question-answer-latest-cased
|
8 |
+
results:
|
9 |
+
- task:
|
10 |
+
type: question-answering
|
11 |
+
name: Question Answering
|
12 |
+
dataset:
|
13 |
+
name: kenyacorpus
|
14 |
+
type: kenyacorpus
|
15 |
+
config: kenyacorpus
|
16 |
+
split: validation
|
17 |
+
metrics:
|
18 |
+
- name: Exact Match
|
19 |
+
type: exact_match
|
20 |
+
value: 79.9309
|
21 |
+
verified: true
|
22 |
+
- name: F1
|
23 |
+
type: f1
|
24 |
+
value: 82.9501
|
25 |
+
verified: true
|
26 |
+
- name: total
|
27 |
+
type: total
|
28 |
+
value: 11869
|
29 |
+
verified: true
|
30 |
---
|
31 |
+
|
32 |
+
# SWAHILI QUESTION - ANSWER MODEL
|
33 |
+
|
34 |
+
This is the [bert-base-multilingual-cased](https://huggingface.co/bert-base-multilingual-cased) model, fine-tuned using the [KenyaCorpus](https://github.com/Neurotech-HQ/Swahili-QA-dataset) dataset. It's been trained on question-answer pairs, including unanswerable questions, for the task of Question Answering in Swahili Language.
|
35 |
+
|
36 |
+
|
37 |
+
## Overview
|
38 |
+
**Language model used:** bert-base-multilingual-cased
|
39 |
+
**Language:** Kiswahili
|
40 |
+
**Downstream-task:** Extractive Swahili QA
|
41 |
+
**Training data:** KenyaCorpus
|
42 |
+
**Eval data:** KenyaCorpus
|
43 |
+
**Code:** See [an example QA pipeline on Haystack](https://haystack.deepset.ai)
|
44 |
+
**Infrastructure**: Google Colab GPU
|
45 |
+
|
46 |
+
## Hyperparameters
|
47 |
+
|
48 |
+
```
|
49 |
+
batch_size = 16
|
50 |
+
n_epochs = 10
|
51 |
+
base_LM_model = "bert-base-multilingual-cased"
|
52 |
+
max_seq_len = 386
|
53 |
+
learning_rate = 3e-5
|
54 |
+
lr_schedule = LinearWarmup
|
55 |
+
warmup_proportion = 0.2
|
56 |
+
doc_stride=128
|
57 |
+
max_query_length=64
|
58 |
+
```
|
59 |
+
|
60 |
+
## Usage
|
61 |
+
|
62 |
+
### In Haystack
|
63 |
+
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](https://github.com/deepset-ai/haystack/):
|
64 |
+
```python
|
65 |
+
reader = FARMReader(model_name_or_path="innocent-charles/Swahili-question-answer-latest-cased")
|
66 |
+
# or
|
67 |
+
reader = TransformersReader(model_name_or_path="innocent-charles/Swahili-question-answer-latest-cased",tokenizer="innocent-charles/Swahili-question-answer-latest-cased")
|
68 |
+
```
|
69 |
+
For a complete example of ``Swahili-question-answer-latest-cased`` being used for Swahili Question Answering, check out the [Tutorials in Haystack Documentation](https://haystack.deepset.ai)
|
70 |
+
|
71 |
+
### In Transformers
|
72 |
+
```python
|
73 |
+
from transformers import AutoModelForQuestionAnswering, AutoTokenizer, pipeline
|
74 |
+
|
75 |
+
model_name = "innocent-charles/Swahili-question-answer-latest-cased"
|
76 |
+
|
77 |
+
# a) Get predictions
|
78 |
+
nlp = pipeline('question-answering', model=model_name, tokenizer=model_name)
|
79 |
+
QA_input = {
|
80 |
+
'question': 'Asubuhi ilitupata pambajioi pa hospitali gani?',
|
81 |
+
'context': 'Asubuhi hiyo ilitupata pambajioni pa hospitali ya Uguzwa.'
|
82 |
+
}
|
83 |
+
res = nlp(QA_input)
|
84 |
+
|
85 |
+
# b) Load model & tokenizer
|
86 |
+
model = AutoModelForQuestionAnswering.from_pretrained(model_name)
|
87 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
88 |
+
```
|
89 |
+
|
90 |
+
## Performance
|
91 |
+
|
92 |
+
```
|
93 |
+
"exact": 79.87029394424324,
|
94 |
+
"f1": 82.91251169582613,
|
95 |
+
|
96 |
+
"total": 11873,
|
97 |
+
"HasAns_exact": 77.93522267206478,
|
98 |
+
"HasAns_f1": 84.02838248389763,
|
99 |
+
"HasAns_total": 5928,
|
100 |
+
"NoAns_exact": 81.79983179142137,
|
101 |
+
"NoAns_f1": 81.79983179142137,
|
102 |
+
"NoAns_total": 5945
|
103 |
+
```
|
104 |
+
|
105 |
+
## Authors
|
106 |
+
**Innocent Charles:** [email protected]
|
107 |
+
|
108 |
+
## About Me
|
109 |
+
|
110 |
+
<P>
|
111 |
+
I build good things using Artificial Intelligence ,Data and Analytics , with over 3 Years of Experience as Applied AI Engineer & Data scientist from a strong background in Software Engineering ,with passion and extensive experience in Data and Businesses.
|
112 |
+
</P>
|
113 |
+
|
114 |
+
|
115 |
+
[Linkedin](https://www.linkedin.com/in/innocent-charles/) | [GitHub](https://github.com/innocent-charles) | [Website](innocentcharles.com)
|
116 |
+
|