espnet中语言模型换为transformer的步骤----aishell为例
espnet是一个e2e的语音工具箱,可以做asr以及tts的一些任务
脚本走的是kaldi的风格,目前提供的asr脚本有WSJ, Switchboard, CHiME-4/5, Librispeech, TED, CSJ, AMI, HKUST, Voxforge, REVERB。 THCHS30讨论过,后来觉得(This corpus uses the same sentences for training and development data)就放弃了,但是提供aishell1。还有一些tts,translation,separation。具体请查看README
本身的网络架构走的是最新的joint CTC-attention这个架构(both training and decoding),效果相比CTC和HMM-DNN是State-of-the-art performanc
data processing干脆就直接复用的kaldi的。
e2e的网络结构是pytorch和chainer都支持的,但是部分任务是只支持pytorch的
使用tensorboard作为monitor。
espnet是支持transformer的,但默认的语言模型都是lstm,那transformer的语言模型如何用呢?
下面是详细步骤:
1.在aishell/asr1/conf目录下,mkdir lm_transformer.yaml
,并配置为如下内容:
layer: 2 # 2 for character LMs
unit: 1000 # 650 for character LMs
opt: sgd # adam for character LMs
sortagrad: 0 # Feed samples from shortest to longest ; -1: enabled for all epochs, 0: disabled, other: enabled for 'other' epochs
batchsize: 32 # 1024 for character LMs
epoch: 20 # number of epochs
patience: 3
maxlen: 40 # 150 for character LMs
model-module: transformer
2. 在aishell/asr1打开run.sh脚本
将24 行 lm_config=conf/lm.yaml
改为:
lm_config=conf/lm_transformer.yaml
将160 行lmexpname=train_transformerlm_${backend}_${lmtag}
改为:
lmexpname=train_transformerlm_${backend}_${lmtag}
3. 在aishell/asr1运行run.sh脚本
结果在aishell/asr1/exp下的train_transformerlm_pytorch_lm_transformer目录下
本次实验设置了20 epoch,从0开始,打开log文件epoch=19为:
{
"main/loss": 5.020274195671082,
"main/nll": 69915.06751586914,
"main/count": 13826.06,
"validation/main/loss": 262.1110324859619,
"validation/main/nll": 1202852.94140625,
"validation/main/count": 219667.0,
"epoch": 19,
"iteration": 2400,
"elapsed_time": 322.4424499068409,
"perplexity": 157.08075329845133,
"val_perplexity": 238.84187991402425
}
- 点赞
- 收藏
- 关注作者
评论(0)