🚀 ドイツ語の自動音声認識用にファインチューニングされたwhisper-mediumモデル
このモデルは、自動音声認識(ASR)に特化したモデルで、ドイツ語の音声を高精度に認識することができます。openai/whisper-mediumをベースに、mozilla-foundation/common_voice_11_0のドイツ語データセットでファインチューニングされています。音声入力は16KHzでサンプリングする必要があり、大文字小文字や句読点も予測することができます。

このモデルは、bofenghuang/whisper-medium-cv11-germanをctranslate2に変換したバージョンです。
🚀 クイックスタート
このモデルを使用するには、以下の手順に従ってください。
データセットの読み込み
from datasets import load_dataset
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"]
推論の実行
推論には、🤗 Pipelineまたは🤗 低レベルAPIを使用することができます。
🤗 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]
✨ 主な機能
- 高精度な音声認識:ドイツ語の音声を高精度に認識することができます。
- 大文字小文字と句読点の予測:音声認識結果に大文字小文字や句読点を含めることができます。
- 多様な推論方法:🤗 Pipelineまたは🤗 低レベルAPIを使用して推論を実行することができます。
📚 ドキュメント
パフォーマンス
以下は、Common Voice 9.0とCommon Voice 11.0でのWER(単語誤り率)の結果です。
Common Voice 9.0
Common Voice 11.0
📄 ライセンス
このモデルは、Apache-2.0ライセンスの下で公開されています。