From ae9f3795473bf9b0115dfc692af414cefc30c50c Mon Sep 17 00:00:00 2001 From: huangyuxin Date: Tue, 26 Oct 2021 08:17:49 +0000 Subject: [PATCH] refactor the code --- deepspeech/decoders/recog.py | 4 ++-- examples/librispeech/s2/local/recog.sh | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/deepspeech/decoders/recog.py b/deepspeech/decoders/recog.py index b4c55f286..e175c2477 100644 --- a/deepspeech/decoders/recog.py +++ b/deepspeech/decoders/recog.py @@ -85,8 +85,8 @@ def recog_v2(args): if args.preprocess_conf is None else args.preprocess_conf, preprocess_args={"train": False}, ) - if args.rnnlm: - lm_path = args.rnnlm + if args.use_lm: + lm_path = args.rnnlm_path lm_config_path = args.rnnlm_conf lm_config = get_config(lm_config_path) lm_class = dynamic_import_lm("transformer") diff --git a/examples/librispeech/s2/local/recog.sh b/examples/librispeech/s2/local/recog.sh index 8a902c05c..811b161a4 100755 --- a/examples/librispeech/s2/local/recog.sh +++ b/examples/librispeech/s2/local/recog.sh @@ -11,8 +11,9 @@ tag= decode_config=conf/decode/decode.yaml # lm params +use_lm=true lang_model=transformerLM.pdparams -lmexpdir=exp/transformerLM +lmexpdir=exp/lm/transformer lmtag='nolm' rnnlm_config_path=conf/lm/transformer.yaml @@ -94,8 +95,9 @@ for dmethd in join_ctc; do --result-label ${decode_dir}/data.JOB.json \ --model-conf ${config_path} \ --model ${ckpt_prefix}.pdparams \ + --use_rnnlm ${use_lm} \ --rnnlm-conf ${rnnlm_config_path} \ - --rnnlm ${lmexpdir}/${lang_model} + --rnnlm-path ${lmexpdir}/${lang_model} score_sclite.sh --bpe ${nbpe} --bpemodel ${bpemodel} --wer false ${decode_dir} ${dict}