语言: "fr"
缩略图:
标签:
- 自动语音识别
- CTC
- 注意力机制
- pytorch
- speechbrain
许可证: "apache-2.0"
数据集:
- common_voice
评估指标:
- 词错误率(WER)
- 字符错误率(CER)
基于CommonVoice法语训练的CRDNN+CTC/Attention模型(无语言模型)
本仓库提供了一套完整的工具,用于在SpeechBrain框架下执行基于CommonVoice(法语)预训练的端到端自动语音识别系统。为了获得更好的体验,我们建议您深入了解SpeechBrain。
该模型的性能如下:
发布日期 |
测试集CER |
测试集WER |
所用GPU |
2021-03-07 |
6.54% |
17.70% |
2块V100 16GB |
系统架构说明
该ASR系统由两个相互关联的模块组成:
- 分词器(unigram):将单词转换为子词单元,使用CommonVoice法语训练集文本(train.tsv)训练
- 声学模型(CRDNN + CTC/Attention):CRDNN架构由多个卷积神经网络块组成,在频域进行归一化和池化操作。随后连接双向LSTM和最终的全连接网络,生成同时供给CTC和注意力解码器的声学表征。
系统训练使用16kHz单通道音频样本。当调用transcribe_file时,代码会自动执行音频标准化处理(如需要,包括重采样和单声道选择)。
安装SpeechBrain
首先执行以下命令安装SpeechBrain:
pip install speechbrain
建议您阅读官方教程以深入了解SpeechBrain。
法语音频文件转录示例
from speechbrain.inference.ASR import EncoderDecoderASR
asr_model = EncoderDecoderASR.from_hparams(source="speechbrain/asr-crdnn-commonvoice-fr", savedir="pretrained_models/asr-crdnn-commonvoice-fr")
asr_model.transcribe_file("speechbrain/asr-crdnn-commonvoice-fr/example-fr.wav")
GPU加速推理
在调用from_hparams
方法时添加参数run_opts={"device":"cuda"}
即可启用GPU推理。
批量并行推理
请参考此Colab笔记本了解如何使用预训练模型并行转录多个句子。
训练流程
该模型基于SpeechBrain(986a2175版本)训练。从头训练步骤如下:
- 克隆仓库:
git clone https://github.com/speechbrain/speechbrain/
- 安装依赖:
cd speechbrain
pip install -r requirements.txt
pip install -e .
- 启动训练:
cd recipes/CommonVoice/ASR/seq2seq
python train.py hparams/train_fr.yaml --data_folder=您的数据目录
训练结果(模型、日志等)可在此链接获取。
使用限制
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}
}