🚀 whisper large-v2 を CommonVoice Persian でファインチューニング
このリポジトリは、SpeechBrain内でCommonVoice(ペルシャ語)でファインチューニングされたエンドツーエンドのwhisperモデルを使用して自動音声認識を実行するために必要なすべてのツールを提供します。より良い体験のために、SpeechBrainについてもっと学ぶことをお勧めします。
モデルのパフォーマンスは以下の通りです。
リリース |
テストCER |
テストWER |
GPU |
01-02-23 |
9.38 |
31.75 |
1xV100 16GB |
✨ 主な機能
📚 詳細ドキュメント
パイプラインの説明
このASRシステムはwhisperのエンコーダ - デコーダブロックで構成されています。
- 事前学習されたwhisper-large-v2エンコーダは凍結されています。
- 事前学習されたWhisperトークナイザーが使用されます。
- 事前学習されたWhisper-large-v2デコーダ(openai/whisper-large-v2)がCommonVoice Faでファインチューニングされます。
得られた最終的な音響表現は貪欲デコーダに渡されます。
システムは16kHzでサンプリングされた録音(単チャンネル)で訓練されています。コードは、transcribe_file を呼び出す際に必要に応じて自動的にオーディオを正規化します(つまり、リサンプリング + モノチャンネル選択)。
📦 インストール
SpeechBrainのインストール
まず、以下のコマンドでtranformersとSpeechBrainをインストールしてください。
pip install speechbrain transformers==4.28.0
SpeechBrainのチュートリアルを読み、もっと学ぶことをお勧めします。
💻 使用例
基本的な使用法
from speechbrain.inference.ASR import WhisperASR
asr_model = WhisperASR.from_hparams(source="speechbrain/asr-whisper-large-v2-commonvoice-fa", savedir="pretrained_models/asr-whisper-large-v2-commonvoice-fa")
asr_model.transcribe_file("speechbrain/asr-whisper-large-v2-commonvoice-fa/example-fa.wav")
高度な使用法
from speechbrain.inference.ASR import WhisperASR
asr_model = WhisperASR.from_hparams(source="speechbrain/asr-whisper-large-v2-commonvoice-fa", savedir="pretrained_models/asr-whisper-large-v2-commonvoice-fa", run_opts={"device":"cuda"})
asr_model.transcribe_file("speechbrain/asr-whisper-large-v2-commonvoice-fa/example-fa.wav")
訓練
このモデルはSpeechBrainで訓練されています。ゼロから訓練するには、以下の手順に従ってください。
- SpeechBrainをクローンします。
git clone https://github.com/speechbrain/speechbrain/
- インストールします。
cd speechbrain
pip install -r requirements.txt
pip install -e .
- 訓練を実行します。
cd recipes/CommonVoice/ASR/transformer/
python train_with_whisper.py hparams/train_fa_hf_whisper.yaml --data_folder=your_data_folder
訓練結果(モデル、ログなど)はこちらで確認できます。
🔧 技術詳細
⚠️ 重要提示
SpeechBrainチームは、このモデルを他のデータセットで使用した場合のパフォーマンスについて一切の保証を提供しません。
SpeechBrainの引用
@misc{SB2021,
author = {Ravanelli, Mirco and Parcollet, Titouan and Rouhe, Aku and Plantinga, Peter and Rastorgueva, Elena and Lugosch, Loren and Dawalatabad, Nauman and Ju-Chieh, Chou and Heba, Abdel and Grondin, Francois and Aris, William and Liao, Chien-Feng and Cornell, Samuele and Yeh, Sung-Lin and Na, Hwidong and Gao, Yan and Fu, Szu-Wei and Subakan, Cem and De Mori, Renato and Bengio, Yoshua },
title = {SpeechBrain},
year = {2021},
publisher = {GitHub},
journal = {GitHub repository},
howpublished = {\\\\url{https://github.com/speechbrain/speechbrain}},
}
SpeechBrainについて
SpeechBrainはオープンソースの統合型音声ツールキットです。シンプルで、非常に柔軟性が高く、使いやすいように設計されています。様々なドメインで競争力のある、または最先端のパフォーマンスが得られます。
ウェブサイト: https://speechbrain.github.io/
GitHub: https://github.com/speechbrain/speechbrain
📄 ライセンス
このモデルはApache-2.0ライセンスの下で提供されています。