许可证:apache-2.0
语言:德语
库名称:transformers
缩略图:无
标签:
- 自动语音识别
- whisper-event
数据集:
- mozilla-foundation/common_voice_11_0
评估指标:
- 词错误率(WER)
模型索引:
- 名称:针对德语ASR微调的whisper-large-v2模型
结果:
- 任务:
名称:自动语音识别
类型:automatic-speech-recognition
数据集:
名称:Common Voice 11.0
类型:mozilla-foundation/common_voice_11_0
配置:德语
拆分:测试集
参数:德语
评估指标:



针对德语ASR微调的whisper-large-v2模型
本模型是基于openai/whisper-large-v2在mozilla-foundation/common_voice_11_0德语数据集上微调的版本。使用时请确保语音输入采样率为16kHz。该模型可预测大小写和标点符号。
性能表现
下表为预训练模型在Common Voice 9.0的WER结果,数据源自原始论文。
下表为微调模型在Common Voice 11.0的WER结果。
使用方式
使用🤗 Pipeline推理
import torch
from datasets import load_dataset
from transformers import pipeline
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
pipe = pipeline("automatic-speech-recognition", model="bofenghuang/whisper-large-v2-cv11-german", device=device)
pipe.model.config.forced_decoder_ids = pipe.tokenizer.get_decoder_prompt_ids(language="de", task="transcribe")
ds_mcv_test = load_dataset("mozilla-foundation/common_voice_11_0", "de", split="test", streaming=True)
test_segment = next(iter(ds_mcv_test))
waveform = test_segment["audio"]
pipe.model.config.max_length = 225 + 1
generated_sentences = pipe(waveform)["text"]
使用🤗底层API推理
import torch
import torchaudio
from datasets import load_dataset
from transformers import AutoProcessor, AutoModelForSpeechSeq2Seq
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
model = AutoModelForSpeechSeq2Seq.from_pretrained("bofenghuang/whisper-large-v2-cv11-german").to(device)
processor = AutoProcessor.from_pretrained("bofenghuang/whisper-large-v2-cv11-german", language="german", task="transcribe")
model.config.forced_decoder_ids = processor.get_decoder_prompt_ids(language="de", task="transcribe")
model_sample_rate = processor.feature_extractor.sampling_rate
ds_mcv_test = load_dataset("mozilla-foundation/common_voice_11_0", "de", split="test", streaming=True)
test_segment = next(iter(ds_mcv_test))
waveform = torch.from_numpy(test_segment["audio"]["array"])
sample_rate = test_segment["audio"]["sampling_rate"]
if sample_rate != model_sample_rate:
resampler = torchaudio.transforms.Resample(sample_rate, model_sample_rate)
waveform = resampler(waveform)
inputs = processor(waveform, sampling_rate=model_sample_rate, return_tensors="pt")
input_features = inputs.input_features
input_features = input_features.to(device)
generated_ids = model.generate(inputs=input_features, max_new_tokens=225)
generated_sentences = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]