From d2fe50416367bd107356a10162a753af6a490786 Mon Sep 17 00:00:00 2001 From: Mingshuang Luo <37799481+luomingshuang@users.noreply.github.com> Date: Wed, 10 Nov 2021 11:19:20 +0800 Subject: [PATCH] Do some changes --- egs/timit/ASR/local/compute_fbank_timit.py | 2 +- egs/timit/ASR/local/prepare_lexicon.py | 2 +- egs/timit/ASR/prepare.sh | 8 ++++---- egs/timit/ASR/tdnn_ligru_ctc/decode.py | 1 - egs/timit/ASR/tdnn_ligru_ctc/model.py | 5 ++--- egs/timit/ASR/tdnn_lstm_ctc/decode.py | 1 - 6 files changed, 8 insertions(+), 11 deletions(-) diff --git a/egs/timit/ASR/local/compute_fbank_timit.py b/egs/timit/ASR/local/compute_fbank_timit.py index 4013c36a8..70be7051c 100644 --- a/egs/timit/ASR/local/compute_fbank_timit.py +++ b/egs/timit/ASR/local/compute_fbank_timit.py @@ -70,7 +70,7 @@ def compute_fbank_timit(): recordings=m["recordings"], supervisions=m["supervisions"], ) - if "TRAIN" in partition: + if partition == "TRAIN": cut_set = ( cut_set + cut_set.perturb_speed(0.9) diff --git a/egs/timit/ASR/local/prepare_lexicon.py b/egs/timit/ASR/local/prepare_lexicon.py index e2d19c643..f0168ebd6 100644 --- a/egs/timit/ASR/local/prepare_lexicon.py +++ b/egs/timit/ASR/local/prepare_lexicon.py @@ -58,7 +58,7 @@ def prepare_lexicon(manifests_dir: str, lang_dir: str): Return: The lexicon.txt file and the train.text in lang_dir. """ - phones = set([]) + phones = set() supervisions_train = Path(manifests_dir) / "supervisions_TRAIN.json" lexicon = Path(lang_dir) / "lexicon.txt" diff --git a/egs/timit/ASR/prepare.sh b/egs/timit/ASR/prepare.sh index e7805b086..ae1b96a68 100644 --- a/egs/timit/ASR/prepare.sh +++ b/egs/timit/ASR/prepare.sh @@ -23,8 +23,8 @@ stop_stage=100 # on 39 phones. About how to get these LM files, you can know it # from https://github.com/luomingshuang/Train_LM_with_kaldilm. # -# - lm_3_gram_tgmed.arpa -# - lm_4_gram_tgmed.arpa +# - lm_3_gram.arpa +# - lm_4_gram.arpa # # - $dl_dir/musan # This directory contains the following directories downloaded from @@ -135,7 +135,7 @@ if [ $stage -le 6 ] && [ $stop_stage -ge 6 ]; then --read-symbol-table="data/lang_phone/words.txt" \ --disambig-symbol='#0' \ --max-order=3 \ - $dl_dir/lm/lm_3_gram_tgmed.arpa > data/lm/G_3_gram.fst.txt + $dl_dir/lm/lm_3_gram.arpa > data/lm/G_3_gram.fst.txt fi if [ ! -f data/lm/G_4_gram.fst.txt ]; then @@ -144,7 +144,7 @@ if [ $stage -le 6 ] && [ $stop_stage -ge 6 ]; then --read-symbol-table="data/lang_phone/words.txt" \ --disambig-symbol='#0' \ --max-order=4 \ - $dl_dir/lm/lm_4_gram_tgmed.arpa > data/lm/G_4_gram.fst.txt + $dl_dir/lm/lm_4_gram.arpa > data/lm/G_4_gram.fst.txt fi fi diff --git a/egs/timit/ASR/tdnn_ligru_ctc/decode.py b/egs/timit/ASR/tdnn_ligru_ctc/decode.py index d5085d32f..b141e58fa 100644 --- a/egs/timit/ASR/tdnn_ligru_ctc/decode.py +++ b/egs/timit/ASR/tdnn_ligru_ctc/decode.py @@ -410,7 +410,6 @@ def main(): if params.method in ["nbest-rescoring", "whole-lattice-rescoring"]: if not (params.lm_dir / "G_4_gram.pt").is_file(): logging.info("Loading G_4_gram.fst.txt") - logging.warning("It may take 8 minutes.") with open(params.lm_dir / "G_4_gram.fst.txt") as f: first_word_disambig_id = lexicon.word_table["#0"] diff --git a/egs/timit/ASR/tdnn_ligru_ctc/model.py b/egs/timit/ASR/tdnn_ligru_ctc/model.py index 0a4e6d82b..890f48247 100644 --- a/egs/timit/ASR/tdnn_ligru_ctc/model.py +++ b/egs/timit/ASR/tdnn_ligru_ctc/model.py @@ -452,9 +452,8 @@ class LiGRU_Layer(torch.nn.Module): ).data # Sampling the mask - drop_mask = self.drop_masks[ - self.drop_mask_cnt:self.drop_mask_cnt + self.batch_size - ] + right_boundary = self.drop_mask_cnt + self.batch_size + drop_mask = self.drop_masks[self.drop_mask_cnt:right_boundary] self.drop_mask_cnt = self.drop_mask_cnt + self.batch_size else: diff --git a/egs/timit/ASR/tdnn_lstm_ctc/decode.py b/egs/timit/ASR/tdnn_lstm_ctc/decode.py index 41e683779..e9ca96615 100644 --- a/egs/timit/ASR/tdnn_lstm_ctc/decode.py +++ b/egs/timit/ASR/tdnn_lstm_ctc/decode.py @@ -409,7 +409,6 @@ def main(): if params.method in ["nbest-rescoring", "whole-lattice-rescoring"]: if not (params.lm_dir / "G_4_gram.pt").is_file(): logging.info("Loading G_4_gram.fst.txt") - logging.warning("It may take 8 minutes.") with open(params.lm_dir / "G_4_gram.fst.txt") as f: first_word_disambig_id = lexicon.word_table["#0"]