🚀 基於CommonVoice盧旺達語訓練的wav2vec 2.0(含CTC/Attention,無語言模型)
本倉庫提供了在SpeechBrain中使用基於CommonVoice(盧旺達語)預訓練的端到端系統進行自動語音識別所需的所有工具。為獲得更好的體驗,建議您進一步瞭解 SpeechBrain。
該模型的性能如下:
發佈日期 |
測試集詞錯誤率(WER) |
GPU配置 |
2021年6月3日 |
18.91 |
2xV100 32GB |
🚀 快速開始
安裝SpeechBrain
首先,請使用以下命令安裝transformers
和SpeechBrain
:
pip install speechbrain transformers
建議您閱讀我們的教程,進一步瞭解 SpeechBrain。
轉錄您自己的音頻文件(盧旺達語)
from speechbrain.pretrained import EncoderDecoderASR
asr_model = EncoderDecoderASR.from_hparams(source="speechbrain/asr-wav2vec2-commonvoice-rw", savedir="pretrained_models/asr-wav2vec2-commonvoice-rw")
asr_model.transcribe_file("speechbrain/asr-wav2vec2-commonvoice-rw/example.mp3")
在GPU上進行推理
若要在GPU上進行推理,在調用from_hparams
方法時添加 run_opts={"device":"cuda"}
。
批量並行推理
請參考 此Colab筆記本,瞭解如何使用預訓練模型並行轉錄一批輸入語句。
訓練
該模型使用SpeechBrain進行訓練。若要從頭開始訓練,請按以下步驟操作:
- 克隆SpeechBrain倉庫:
git clone https://github.com/speechbrain/speechbrain/
- 安裝依賴:
cd speechbrain
pip install -r requirements.txt
pip install -e .
- 運行訓練腳本:
cd recipes/CommonVoice/ASR/seq2seq
python train_with_wav2vec.py hparams/train_rw_with_wav2vec.yaml --data_folder=your_data_folder
您可以在 此處 找到我們的訓練結果(模型、日誌等)。
✨ 主要特性
管道描述
此自動語音識別(ASR)系統由兩個不同但相互關聯的模塊組成:
- 分詞器(unigram):將單詞轉換為子詞單元,並使用CommonVoice(盧旺達語)的訓練轉錄文件(train.tsv)進行訓練。
- 聲學模型(wav2vec2.0 + CTC/Attention):將預訓練的wav2vec 2.0模型(wav2vec2-large-xlsr-53)與兩個深度神經網絡(DNN)層結合,並在CommonVoice英語數據集上進行微調。得到的最終聲學表示將輸入到CTC和注意力解碼器中。
該系統使用採樣率為16kHz(單聲道)的錄音進行訓練。調用transcribe_file
時,代碼會根據需要自動對音頻進行歸一化處理(即重採樣和單聲道選擇)。
📄 許可證
本項目採用Apache 2.0許可證。
🔧 技術細節
侷限性
SpeechBrain團隊不保證該模型在其他數據集上的性能。
關於SpeechBrain
- 官網:https://speechbrain.github.io/
- 代碼倉庫:https://github.com/speechbrain/speechbrain/
- HuggingFace頁面:https://huggingface.co/speechbrain/
📚 詳細文檔
引用SpeechBrain
如果您在研究或業務中使用了SpeechBrain,請引用以下文獻:
@misc{speechbrain,
title={{SpeechBrain}: A General-Purpose Speech Toolkit},
author={Mirco Ravanelli and Titouan Parcollet and Peter Plantinga and Aku Rouhe and Samuele Cornell and Loren Lugosch and Cem Subakan and Nauman Dawalatabad and Abdelwahab Heba and Jianyuan Zhong and Ju-Chieh Chou and Sung-Lin Yeh and Szu-Wei Fu and Chien-Feng Liao and Elena Rastorgueva and François Grondin and William Aris and Hwidong Na and Yan Gao and Renato De Mori and Yoshua Bengio},
year={2021},
eprint={2106.04624},
archivePrefix={arXiv},
primaryClass={eess.AS},
note={arXiv:2106.04624}
}