Skip to content

Commit

Permalink
[scripts] RNNLM script fix: to accept successive spaces in configs (e…
Browse files Browse the repository at this point in the history
  • Loading branch information
danpovey authored and xiaohui-zhang committed Aug 11, 2018
1 parent 66fc53f commit 039b6c9
Show file tree
Hide file tree
Showing 11 changed files with 12 additions and 11 deletions.
3 changes: 2 additions & 1 deletion egs/wsj/s5/steps/libs/nnet3/xconfig/basic_layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']))

Expand Down
2 changes: 1 addition & 1 deletion scripts/rnnlm/choose_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 "
Expand Down
2 changes: 1 addition & 1 deletion scripts/rnnlm/get_special_symbol_opts.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 "
Expand Down
2 changes: 1 addition & 1 deletion scripts/rnnlm/get_unigram_probs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 "
Expand Down
2 changes: 1 addition & 1 deletion scripts/rnnlm/get_vocab.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion scripts/rnnlm/get_word_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
2 changes: 1 addition & 1 deletion scripts/rnnlm/prepare_split_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
2 changes: 1 addition & 1 deletion scripts/rnnlm/show_word_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 "
Expand Down
2 changes: 1 addition & 1 deletion scripts/rnnlm/validate_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion scripts/rnnlm/validate_text_dir.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
2 changes: 1 addition & 1 deletion scripts/rnnlm/validate_word_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 "
Expand Down

0 comments on commit 039b6c9

Please sign in to comment.