使用Tensorflow 2的几乎先进的自动语音识别
tiramisu-asr的Python项目详细描述
提拉米苏亚尔:蛋糕:
Tensorflow 2中最先进的自动语音识别
TiramisuASR实现了一些语音识别体系结构,如基于CTC的模型(Deep speech 2等)、RNN传感器(Conformer等)。这些模型可以转换为TFLite,以减少部署的内存和计算量:smile: 在
有什么新消息吗?在
- (10/10/2020)更新文档并将包上载到pypi
- (10/6/2020)将
nlpaug
版本改为{} - (9/18/2020)支持
word-pieces
(又名subwords
),使用tensorflow-datasets
- 支持
transducer
tflite贪心解码(转换和调用) - 使用
tf.distribute.MirroredStrategy
进行分布式训练
:yum:支持的型号
- CTCModel(使用CTC Loss进行培训的End2end模型)
- 传感器模型(使用RNNT损失进行培训的End模型)
- Conformer传感器(参考:https://arxiv.org/abs/2005.08100) 见examples/conformer
设置环境和数据集
安装tensorflow:pip3 install -U tensorflow
或{
安装软件包(从以下选项中选择one):
- 运行
pip3 install -U tiramisu-asr
- 克隆repo并在repo目录中运行
python3 setup.py install
关于设置数据集,请参见datasets
- 在
对于培训、测试和使用^{str1}$CTC模型,运行
在./scripts/install_ctc_decoders.sh
- 在
对于training传感器模型,导出
在CUDA_HOME
并运行./scripts/install_rnnt_loss.sh
- 在
方法
在tiramisu_asr.utils.setup_environment()
启用混合精度(如果可用)。在 - 在
要启用XLA,请运行
在TF_XLA_FLAGS=--tf_xla_auto_jit=2 $python_train_script
清理:python3 setup.py clean --all
(这将删除/build
内容)
TFLite转换
在转换为tflite之后,tflite模型就像一个函数,它直接从音频信号转换为unicode代码点,然后我们可以将unicode点转换为字符串。在
- 使用
pip install tf-nightly
安装tf-nightly
- 使用与训练模型相同的体系结构构建一个模型(如果模型有tflite参数,则必须将其设置为True),然后将经过训练的模型中的权重加载到构建的模型中
- 使用函数
TFSpeechFeaturizer
和{}加载到模型中 - 将模型的函数转换为tflite,如下所示:
func=model.make_tflite_function(greedy=True)# or Falseconcrete_func=func.get_concrete_function()converter=tf.lite.TFLiteConverter.from_concrete_functions([concrete_func])converter.experimental_new_converter=Trueconverter.optimizations=[tf.lite.Optimize.DEFAULT]converter.target_spec.supported_ops=[tf.lite.OpsSet.TFLITE_BUILTINS,tf.lite.OpsSet.SELECT_TF_OPS]tflite_model=converter.convert()
- 保存转换后的tflite模型,如下所示:
- 然后,
.tflite
模型就可以部署了
特征提取
扩充
培训和测试
Example YAML配置结构
speech_config:...model_config:...decoder_config:...learning_config:augmentations:...dataset_config:train_paths:...eval_paths:...test_paths:...tfrecords_dir:...optimizer_config:...running_config:batch_size:8num_epochs:20outdir:...log_interval_steps:500
有关一些预定义的ASR模型和结果,请参见examples
语料库来源与预训练模型
对于经过预训练的模型,请转到drive
英语
Name | Source | Hours |
---|---|---|
LibriSpeech | LibriSpeech | 970h |
Common Voice | https://commonvoice.mozilla.org | 1932h |
越南语
^{tb2}$德语
^{3}$推荐和学分
- NVIDIA OpenSeq2Seq Toolkit
- https://github.com/noahchalifour/warp-transducer
- Sequence Transduction with Recurrent Neural Network
- End-to-End Speech Processing Toolkit in PyTorch
- 项目
标签: