英文

模型描述

这个模型是在开放AI的Whisper-Small模型上,使用基于基音库的正则化自回归函数进行微调得到的,用于Kinyarwanda的常见语音数据集。通过在Swahili语言之上进行微调来添加Kinyarwanda语言。模型实现了24的字错误率(WER)。目前,它不提供Kinyarwanda到英文的翻译。

用法

>>> 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']