File size: 1,681 Bytes
24126b7 90c4bb4 24126b7 |
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 |
---
pipeline_tag: automatic-speech-recognition
datasets:
- mozilla-foundation/common_voice_11_0
license: cc
language:
- rw
metrics:
- cer
base_model:
- openai/whisper-small
tags:
- STT
- fine-tune-kinyarwanda
- kinyarwanda
---
# Model description
This model is an openai's whisper-small model fine-tuned on the Kinyarwanda common-voice dataset. The Kinyarwanda language was added by fine-tuning on top of the Swahili language.
It achieves a 24 WER. Currently, it does not provide Kinyarwanda-to-English translation.
# Usage
```python
>>> from transformers import WhisperProcessor, WhisperForConditionalGeneration
>>> from datasets import load_dataset
>>> import datasets
>>> import torch
>>> # load model and processor
>>> processor = WhisperProcessor.from_pretrained("mbazaNLP/Whisper-Small-Kinyarwanda")
>>> model = WhisperForConditionalGeneration.from_pretrained("mbazaNLP/Whisper-Small-Kinyarwanda")
>>> ds = load_dataset("common_voice", "rw", split="test", streaming=True)
>>> ds = ds.cast_column("audio", datasets.Audio(sampling_rate=16_000))
>>> input_speech = next(iter(ds))["audio"]["array"]
>>> model.config.forced_decoder_ids = processor.get_decoder_prompt_ids(language = "sw", task = "transcribe")
>>> input_features = processor(input_speech, return_tensors="pt").input_features
>>> predicted_ids = model.generate(input_features)
>>> transcription = processor.batch_decode(predicted_ids)
['<|startoftranscript|><|sw|><|transcribe|><|notimestamps|>Abamugariye ku rugamba bafashwa kubona insimburangingo<|endoftext|>']
>>> transcription = processor.batch_decode(predicted_ids, skip_special_tokens = True)
['Abamugariye ku rugamba bafashwa kubona insimburangingo']
``` |