🚀 wav2vec 2.0 with CTC 在 CommonVoice 西班牙語數據集上訓練的模型(無語言模型)
本倉庫提供了在 SpeechBrain 中基於在 CommonVoice(西班牙語)上預訓練的端到端系統進行自動語音識別所需的所有工具。為獲得更好的使用體驗,建議您進一步瞭解 SpeechBrain。
屬性 |
詳情 |
模型類型 |
自動語音識別 |
標籤 |
CTC、pytorch、speechbrain、Transformer |
許可證 |
apache - 2.0 |
訓練數據集 |
CommonVoice 14.0 |
評估指標 |
wer、cer |
模型在測試集上的表現如下:
發佈日期 |
測試字符錯誤率 (CER) |
測試詞錯誤率 (WER) |
GPU 配置 |
2023 年 8 月 15 日 |
3.80 |
13.28 |
1 塊 V100 32GB GPU |
🚀 快速開始
本自動語音識別(ASR)系統由兩個不同但相互關聯的模塊組成:
- 分詞器(unigram):將單詞轉換為 unigram,並使用 CommonVoice(西班牙語)的訓練轉錄文件(train.tsv)進行訓練。
- 聲學模型(wav2vec2.0 + CTC):一個預訓練的 wav2vec 2.0 模型(wav2vec2 - large - xlsr - 53)與兩個深度神經網絡(DNN)層相結合,並在 CommonVoice 西班牙語數據集上進行微調。最終得到的聲學表示將輸入到 CTC 解碼器中。
該系統使用採樣率為 16kHz 的單聲道錄音進行訓練。當調用 transcribe_file
時,代碼會自動對音頻進行歸一化處理(即重採樣和單聲道選擇)。
📦 安裝指南
首先,請使用以下命令安裝 transformers
和 SpeechBrain
:
pip install speechbrain transformers
建議您閱讀我們的教程,進一步瞭解 SpeechBrain。
💻 使用示例
基礎用法
對自己的西班牙語音頻文件進行轉錄:
from speechbrain.inference.ASR import EncoderASR
asr_model = EncoderASR.from_hparams(source="speechbrain/asr-wav2vec2-commonvoice-14-es", savedir="pretrained_models/asr-wav2vec2-commonvoice-14-es")
asr_model.transcribe_file("speechbrain/asr-wav2vec2-commonvoice-14-es/example_es.wav")
高級用法
在 GPU 上進行推理:
在調用 from_hparams
方法時,添加 run_opts={"device":"cuda"}
即可在 GPU 上進行推理。
批量並行推理
請參考 此 Colab 筆記本,瞭解如何使用預訓練模型對一批輸入語句進行並行轉錄。
模型訓練
該模型使用 SpeechBrain 進行訓練。要從頭開始訓練該模型,請按照以下步驟操作:
- 克隆 SpeechBrain 倉庫:
git clone https://github.com/speechbrain/speechbrain/
- 安裝依賴:
cd speechbrain
pip install -r requirements.txt
pip install -e .
- 運行訓練腳本:
cd recipes/CommonVoice/ASR/CTC/
python train_with_wav2vec.py hparams/train_es_with_wav2vec.yaml --data_folder=your_data_folder
您可以在 這裡 找到我們的訓練結果(模型、日誌等)。
⚠️ 重要提示
SpeechBrain 團隊不保證該模型在其他數據集上的性能。
📄 許可證
本項目採用 apache - 2.0 許可證。
關於 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}
}