File size: 8,314 Bytes
8c1f76c a459fe0 8c1f76c a459fe0 8c1f76c a459fe0 8c1f76c a459fe0 8c1f76c a459fe0 8c1f76c a459fe0 8c1f76c a459fe0 8c1f76c a459fe0 8c1f76c a459fe0 8c1f76c a459fe0 8c1f76c a459fe0 8c1f76c a459fe0 8c1f76c a459fe0 8c1f76c a459fe0 8c1f76c a459fe0 8c1f76c a459fe0 8c1f76c a459fe0 8c1f76c a459fe0 8c1f76c a459fe0 8c1f76c a459fe0 8c1f76c a459fe0 8c1f76c a459fe0 8c1f76c a459fe0 8c1f76c a459fe0 8c1f76c a459fe0 8c1f76c a459fe0 8c1f76c a459fe0 8c1f76c a459fe0 8c1f76c a459fe0 8c1f76c a459fe0 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 |
---
library_name: transformers
base_model:
- eddiegulay/wav2vec2-large-xlsr-mvc-swahili
tags:
- automatic-speech-recognition
- wav2vec2
- swahili
- huggingface
- transformers
- common-voice
license: apache-2.0
datasets:
- mozilla-foundation/common_voice_11_0
language:
- sw
metrics:
- bleu
- wer
- rouge
- f1
---
# π°πͺ Model Card for `RareElf/swahili-wav2vec2-asr`
This model is a fine-tuned version of [`eddiegulay/wav2vec2-large-xlsr-mvc-swahili`](https://huggingface.co/eddiegulay/wav2vec2-large-xlsr-mvc-swahili) for **automatic speech recognition (ASR)** in **Swahili**. It has been trained using the [Common Voice 11.0 Swahili dataset](https://huggingface.co/datasets/mozilla-foundation/common_voice_11_0).
---
## π Model Details
### Model Description
This model leverages the `wav2vec2` architecture from Facebook AI, fine-tuned for Swahili ASR. It maps raw speech waveforms sampled at 16kHz to transcriptions using a CTC (Connectionist Temporal Classification) loss. It supports real-time transcription for voice-based Swahili applications.
- **Developed by:** Kevin Obote / RareElf
- **Funded by:** Internal research at Guild Code
- **Shared by:** RareElf
- **Model type:** Automatic Speech Recognition (ASR)
- **Language(s) (NLP):** Swahili (`sw`)
- **License:** Apache-2.0
- **Finetuned from model:** `eddiegulay/wav2vec2-large-xlsr-mvc-swahili`
### Model Sources [optional]
<!-- Provide the basic links for the model. -->
- **Repository:** https://huggingface.co/RareElf/swahili-wav2vec2-asr
- **Paper [optional]:** Coming soon
- **Demo [optional]:** Coming soon on semasasa.ai
## Uses
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
### Direct Use
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
This model can be used for:
- Transcribing Swahili audio for accessibility, journalism, documentation, education, etc.
- Integration into chatbots or voice agents in Swahili.
### Downstream Use [optional]
<!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
- Can be integrated with translation and sentiment analysis pipelines.
- Useful for fine-tuning on domain-specific Swahili data (e.g.education, healthcare, government).
### Out-of-Scope Use
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
- Not suitable for noisy, far-field, or multi-speaker environments without preprocessing.
- Not recommended for use in legal, medical, or high-stakes domains without additional validation.
## Bias, Risks, and Limitations
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
- The model may underperform on underrepresented dialects of Swahili.
- Accents, noisy recordings, and overlapping speech may impact accuracy.
- Reflects the linguistic distribution of Common Voice contributors, which may not be representative of all Swahili speakers.
### Recommendations
<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
- Preprocess noisy audio for best results.
- Fine-tune further on targeted domain data for production use.
- Provide user disclaimers about ASR limitations in live deployments.
## How to Get Started with the Model
Use the code below to get started with the model.
```python
from transformers import Wav2Vec2Processor, Wav2Vec2ForCTC
import torch
import librosa
model_id = "RareElf/swahili-wav2vec2-asr"
processor = Wav2Vec2Processor.from_pretrained(model_id)
model = Wav2Vec2ForCTC.from_pretrained(model_id)
audio, _ = librosa.load("sample.wav", sr=16000)
inputs = processor(audio, return_tensors="pt", sampling_rate=16000).input_values
with torch.no_grad():
logits = model(inputs).logits
predicted_ids = torch.argmax(logits, dim=-1)
transcription = processor.batch_decode(predicted_ids)[0]
print(transcription)
```
## Training Details
### Training Data
<!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
- **Dataset:** Common Voice 11.0 β Swahili subset
### Training Procedure
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
- Fine-tuned using `Trainer` API from π€ Transformers.
- **Loss:** CTC (Connectionist Temporal Classification)
- **Optimizer:** AdamW
- **Precision:** `fp16` (mixed precision)
#### Preprocessing [optional]
- Resampled to 16kHz
- Normalized text
- Removed empty, corrupted, or misaligned samples
#### Training Hyperparameters
- **Training regime:**
- **Epochs:** 10
- **Batch Size:** 16
- **Learning Rate:** 3e-4
- **Warmup Steps:** 500
- **Weight Decay:** 0.01
- **Gradient Accumulation:** 2 <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
#### Speeds, Sizes, Times [optional]
<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
[More Information Needed]
## Evaluation
<!-- This section describes the evaluation protocols and provides the results. -->
### Testing Data, Factors & Metrics
#### Testing Data
<!-- This should link to a Dataset Card if possible. -->
- **Dataset:** Held-out subset of Common Voice Swahili
#### Factors
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
[More Information Needed]
#### Metrics
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
- WER (Word Error Rate)
- BLEU (for translation use-case)
- ROUGE (for paraphrase quality)
### Results
| Metric | Score |
|--------|-------|
| WER | 0.33 |
| BLEU | 0.44 |
| ROUGE | 0.66 |
> *Note: Evaluation scores are being finalized with the full test set.*
#### Summary
## Model Examination [optional]
<!-- Relevant interpretability work for the model goes here -->
- Visualized attention maps confirm the model learns phonetic and acoustic patterns relevant to Swahili.
## Environmental Impact
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
- **Hardware Type:** ***
- **Hours used:** ~10
- **Cloud Provider:** Google Cloud
- **Compute Region:** ****
- **Carbon Emitted:** ~X gCO2eq (estimation via [mlco2](https://mlco2.github.io/impact))
## Technical Specifications [optional]
### Model Architecture and Objective
- **Architecture:** Wav2Vec2 (base) + CTC head
- **Objective:** Predict character-level transcription from 16kHz audio
### Compute Infrastructure
[More Information Needed]
#### Hardware
** Personal Computer Lenovo ThinkPad T14 Gen 1 (32GB RAM) 1TB SSD
#### Software
- Python 3.10
- PyTorch 2.x
- Transformers 4.39.x
- Datasets 2.x
## Citation [optional]
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
**BibTeX:**
[More Information Needed]
**APA:**
[More Information Needed]
## Glossary [optional]
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
- **ASR:** Automatic Speech Recognition
- **WER:** Word Error Rate
- **CTC:** Connectionist Temporal Classification
## More Information [optional]
- [Common Voice Dataset Card](https://huggingface.co/datasets/mozilla-foundation/common_voice_11_0)
- [Transformers Documentation](https://huggingface.co/docs/transformers)
## Model Card Authors [optional]
- **Kevin Obote/ RareElf / Guild Code Team**
## Model Card Contact
- **Email:** [[email protected]](mailto:[email protected])
- **GitHub:** [Kevin Obote](https://github.com/Kevinobote) |