🚀 用於LibriSpeech的Transformer模型(含Transformer語言模型)
本倉庫提供了在SpeechBrain框架下,基於在LibriSpeech(英文)數據集上預訓練的端到端系統進行自動語音識別所需的全部工具。為獲得更好的使用體驗,建議您進一步瞭解 SpeechBrain。該模型的性能如下:
版本發佈日期 |
純淨測試集詞錯誤率(WER) |
其他測試集詞錯誤率(WER) |
所用GPU |
2022年3月24日 |
2.27 |
5.53 |
4xV100 32GB |
🚀 快速開始
本ASR系統由三個不同但相互關聯的模塊組成:
- 分詞器(Unigram):將單詞轉換為子詞單元,使用LibriSpeech的訓練轉錄數據進行訓練。
- 神經語言模型(Transformer LM):在包含1000萬個單詞的完整數據集上進行訓練。
- 聲學模型:由Transformer編碼器和結合了CTC與Transformer的聯合解碼器組成。因此,解碼過程也會考慮CTC概率。
該系統使用採樣率為16kHz(單聲道)的錄音進行訓練。當調用 transcribe_file 時,代碼會根據需要自動對音頻進行歸一化處理(即重採樣和單聲道選擇)。
✨ 主要特性
- 多模塊協同:由分詞器、神經語言模型和聲學模型三個模塊協同工作,實現高效的自動語音識別。
- 音頻自動處理:代碼會自動對音頻進行歸一化處理,方便用戶使用。
- 多指標評估:使用詞錯誤率(WER)和字符錯誤率(CER)等指標對模型性能進行評估。
📦 安裝指南
首先,請使用以下命令安裝SpeechBrain:
pip install speechbrain
請注意,建議您閱讀我們的教程,進一步瞭解 SpeechBrain。
💻 使用示例
基礎用法
from speechbrain.inference.ASR import EncoderDecoderASR
asr_model = EncoderDecoderASR.from_hparams(source="speechbrain/asr-transformer-transformerlm-librispeech", savedir="pretrained_models/asr-transformer-transformerlm-librispeech")
asr_model.transcribe_file("speechbrain/asr-transformer-transformerlm-librispeech/example.wav")
高級用法
在GPU上進行推理
若要在GPU上進行推理,在調用 from_hparams
方法時添加 run_opts={"device":"cuda"}
:
from speechbrain.inference.ASR import EncoderDecoderASR
asr_model = EncoderDecoderASR.from_hparams(source="speechbrain/asr-transformer-transformerlm-librispeech", savedir="pretrained_models/asr-transformer-transformerlm-librispeech", run_opts={"device":"cuda"})
asr_model.transcribe_file("speechbrain/asr-transformer-transformerlm-librispeech/example.wav")
批量並行推理
請參考 此Colab筆記本,瞭解如何使用預訓練模型對一批輸入語句進行並行轉錄。
模型訓練
該模型使用SpeechBrain進行訓練(提交哈希值:'f73fcc35')。若要從頭開始訓練該模型,請按照以下步驟操作:
- 克隆SpeechBrain倉庫:
git clone https://github.com/speechbrain/speechbrain/
- 安裝依賴:
cd speechbrain
pip install -r requirements.txt
pip install -e .
- 運行訓練腳本:
cd recipes/LibriSpeech/ASR/transformer
python train.py hparams/transformer.yaml --data_folder=your_data_folder
您可以在 此處 找到我們的訓練結果(模型、日誌等)。
侷限性
SpeechBrain團隊不對該模型在其他數據集上的性能提供任何保證。
📚 詳細文檔
模型信息
屬性 |
詳情 |
模型類型 |
用於自動語音識別的Transformer模型,結合了Transformer語言模型 |
訓練數據 |
LibriSpeech數據集 |
評估指標 |
詞錯誤率(WER)、字符錯誤率(CER) |
關於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}
}
⚠️ 重要提示
SpeechBrain團隊不對該模型在其他數據集上的性能提供任何保證。
💡 使用建議
建議您閱讀我們的教程,進一步瞭解 SpeechBrain,以獲得更好的使用體驗。