🚀 用於德語自動語音識別的微調whisper-medium模型
本模型是一個經過微調的模型,基於openai/whisper-medium,在mozilla-foundation/common_voice_11_0德語數據集上進行訓練。使用該模型時,請確保語音輸入的採樣率為16Khz。該模型還能預測大小寫和標點符號。

此模型是bofenghuang/whisper-medium-cv11-german轉換為ctranslate2的版本。
🚀 快速開始
本模型是一個經過微調的版本,基於openai/whisper-medium,在mozilla-foundation/common_voice_11_0德語數據集上進行訓練。使用該模型時,請確保語音輸入的採樣率為16Khz。該模型還能預測大小寫和標點符號。
✨ 主要特性
- 基於微調的
whisper-medium
模型,適用於德語自動語音識別。
- 能夠預測大小寫和標點符號。
📚 詳細文檔
性能
以下是預訓練模型在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-medium-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-medium-cv11-german").to(device)
processor = AutoProcessor.from_pretrained("bofenghuang/whisper-medium-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]
📄 許可證
本模型採用Apache-2.0許可證。
📋 模型信息
屬性 |
詳情 |
模型類型 |
微調的whisper-medium模型,用於德語自動語音識別 |
訓練數據 |
mozilla-foundation/common_voice_11_0德語數據集 |
評估指標 |
字錯率(WER) |