🚀 ドイツ語の自動音声認識用にファインチューニングされたwhisper-smallモデル
このモデルは、openai/whisper-smallをファインチューニングしたもので、mozilla-foundation/common_voice_11_0のドイツ語データセットで学習されています。モデルを使用する際には、音声入力が16Khzでサンプリングされていることを確認してください。このモデルは大文字小文字と句読点も予測します。

🚀 クイックスタート
このドイツ語の自動音声認識用にファインチューニングされたwhisper-smallモデルを使うことで、高精度な音声認識が可能になります。以下では、このモデルの性能や使用方法について説明します。
✨ 主な機能
- ドイツ語の自動音声認識に特化したファインチューニング済みモデルです。
- 大文字小文字と句読点の予測が可能です。
- 🤗 Pipelineや🤗 low - level APIsを使った推論がサポートされています。
📦 インストール
このモデルを使用するためには、必要なライブラリをインストールする必要があります。以下のコマンドで必要なライブラリをインストールできます。
pip install transformers datasets torchaudio torch
💻 使用例
基本的な使用法
🤗 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-small-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-small-cv11-german").to(device)
processor = AutoProcessor.from_pretrained("bofenghuang/whisper-small-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]
📚 ドキュメント
性能
以下は、Common Voice 9.0における事前学習モデルのWER(単語誤り率)です。これらの結果は、元の論文に報告されています。
以下は、Common Voice 11.0におけるファインチューニング済みモデルのWERです。
📄 ライセンス
このモデルはApache - 2.0ライセンスの下で提供されています。