diff --git a/egs/wsj/s5/steps/libs/nnet3/xconfig/basic_layers.py b/egs/wsj/s5/steps/libs/nnet3/xconfig/basic_layers.py index e95de336586..9a856bc6fe1 100644 --- a/egs/wsj/s5/steps/libs/nnet3/xconfig/basic_layers.py +++ b/egs/wsj/s5/steps/libs/nnet3/xconfig/basic_layers.py @@ -748,7 +748,8 @@ def check_configs(self): if self.config['target-rms'] < 0.0: raise RuntimeError("target-rms has invalid value {0}" .format(self.config['target-rms'])) - if self.config['learning-rate-factor'] <= 0.0: + if (self.config['learning-rate-factor'] != '' and + self.config['learning-rate-factor'] <= 0.0): raise RuntimeError("learning-rate-factor has invalid value {0}" .format(self.config['learning-rate-factor'])) diff --git a/scripts/rnnlm/choose_features.py b/scripts/rnnlm/choose_features.py index 0686c8f88c6..842cafb3c97 100755 --- a/scripts/rnnlm/choose_features.py +++ b/scripts/rnnlm/choose_features.py @@ -11,7 +11,7 @@ sys.stdout = open(1, 'w', encoding='latin-1', closefd=False) import re -tab_or_space = re.compile('[ \t]') +tab_or_space = re.compile('[ \t]+') parser = argparse.ArgumentParser(description="This script chooses the sparse feature representation of words. " "To be more specific, it chooses the set of features-- you compute " diff --git a/scripts/rnnlm/get_special_symbol_opts.py b/scripts/rnnlm/get_special_symbol_opts.py index 83f7d708a49..4310b116ad7 100755 --- a/scripts/rnnlm/get_special_symbol_opts.py +++ b/scripts/rnnlm/get_special_symbol_opts.py @@ -9,7 +9,7 @@ import sys import re -tab_or_space = re.compile('[ \t]') +tab_or_space = re.compile('[ \t]+') parser = argparse.ArgumentParser(description="This script checks whether the special symbols " "appear in words.txt with expected values, if not, it will " diff --git a/scripts/rnnlm/get_unigram_probs.py b/scripts/rnnlm/get_unigram_probs.py index abb8515f330..ab3f9bb382f 100755 --- a/scripts/rnnlm/get_unigram_probs.py +++ b/scripts/rnnlm/get_unigram_probs.py @@ -8,7 +8,7 @@ import sys import re -tab_or_space = re.compile('[ \t]') +tab_or_space = re.compile('[ \t]+') parser = argparse.ArgumentParser(description="This script gets the unigram probabilities of words.", epilog="E.g. " + sys.argv[0] + " --vocab-file=data/rnnlm/vocab/words.txt " diff --git a/scripts/rnnlm/get_vocab.py b/scripts/rnnlm/get_vocab.py index e30ce4a94c9..5036db0ed2a 100755 --- a/scripts/rnnlm/get_vocab.py +++ b/scripts/rnnlm/get_vocab.py @@ -9,7 +9,7 @@ sys.stdout = open(1, 'w', encoding='latin-1', closefd=False) import re -tab_or_space = re.compile('[ \t]') +tab_or_space = re.compile('[ \t]+') parser = argparse.ArgumentParser(description="This script get a vocab from unigram counts " "of words produced by get_unigram_counts.sh", diff --git a/scripts/rnnlm/get_word_features.py b/scripts/rnnlm/get_word_features.py index 54d84077060..aeb7a3ec6ae 100755 --- a/scripts/rnnlm/get_word_features.py +++ b/scripts/rnnlm/get_word_features.py @@ -10,7 +10,7 @@ from collections import defaultdict import re -tab_or_space = re.compile('[ \t]') +tab_or_space = re.compile('[ \t]+') parser = argparse.ArgumentParser(description="This script turns the words into the sparse feature representation, " "using features from rnnlm/choose_features.py.", diff --git a/scripts/rnnlm/prepare_split_data.py b/scripts/rnnlm/prepare_split_data.py index e39f4504f37..cceac48313e 100755 --- a/scripts/rnnlm/prepare_split_data.py +++ b/scripts/rnnlm/prepare_split_data.py @@ -9,7 +9,7 @@ import sys import re -tab_or_space = re.compile('[ \t]') +tab_or_space = re.compile('[ \t]+') parser = argparse.ArgumentParser(description="This script prepares files containing integerized text, " "for consumption by nnet3-get-egs.", diff --git a/scripts/rnnlm/show_word_features.py b/scripts/rnnlm/show_word_features.py index 5fe049cb8ce..53d4729b4bb 100755 --- a/scripts/rnnlm/show_word_features.py +++ b/scripts/rnnlm/show_word_features.py @@ -9,7 +9,7 @@ sys.stdout = open(1, 'w', encoding='latin-1', closefd=False) import re -tab_or_space = re.compile('[ \t]') +tab_or_space = re.compile('[ \t]+') parser = argparse.ArgumentParser(description="This script turns the word features to a human readable format.", epilog="E.g. " + sys.argv[0] + "exp/rnnlm/word_feats.txt exp/rnnlm/features.txt " diff --git a/scripts/rnnlm/validate_features.py b/scripts/rnnlm/validate_features.py index 010ceb72615..2a077da4758 100755 --- a/scripts/rnnlm/validate_features.py +++ b/scripts/rnnlm/validate_features.py @@ -8,7 +8,7 @@ import sys import re -tab_or_space = re.compile('[ \t]') +tab_or_space = re.compile('[ \t]+') parser = argparse.ArgumentParser(description="Validates features file, produced by rnnlm/choose_features.py.", epilog="E.g. " + sys.argv[0] + " exp/rnnlm/features.txt", diff --git a/scripts/rnnlm/validate_text_dir.py b/scripts/rnnlm/validate_text_dir.py index 4b311a8abbd..903e720bdf4 100755 --- a/scripts/rnnlm/validate_text_dir.py +++ b/scripts/rnnlm/validate_text_dir.py @@ -8,7 +8,7 @@ import sys import re -tab_or_space = re.compile('[ \t]') +tab_or_space = re.compile('[ \t]+') parser = argparse.ArgumentParser(description="Validates data directory containing text " "files from one or more data sources, including dev.txt.", diff --git a/scripts/rnnlm/validate_word_features.py b/scripts/rnnlm/validate_word_features.py index f8eb5858d95..205b934ae1b 100755 --- a/scripts/rnnlm/validate_word_features.py +++ b/scripts/rnnlm/validate_word_features.py @@ -8,7 +8,7 @@ import sys import re -tab_or_space = re.compile('[ \t]') +tab_or_space = re.compile('[ \t]+') parser = argparse.ArgumentParser(description="Validates word features file, produced by rnnlm/get_word_features.py.", epilog="E.g. " + sys.argv[0] + " --features-file=exp/rnnlm/features.txt "