forked from shtoshni/e2e_asr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbeam_search_test.py
29 lines (21 loc) · 985 Bytes
/
beam_search_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from beam_search import BeamSearch
import data_utils
class BeamSearchTest(object):
ckpt_file = ("/share/data/speech/shtoshni/research/asr_multi/models/"
"skip_2_lstm_lm_prob_0.75_run_id_205/asr.ckpt-39000")
vocab_file = ("/share/data/speech/shtoshni/research/datasets/"
"asr_swbd/lang/vocab/char.vocab")
def __init__(self):
self.rev_vocab = self.load_char_vocab()
self.beam_search = BeamSearch(self.ckpt_file, self.rev_vocab)
def load_char_vocab(self):
_, rev_char_vocab = data_utils.initialize_vocabulary(self.vocab_file)
return rev_char_vocab
def test_param_load(self):
"""Test file loading."""
for param_name in self.beam_search.params:
param_shape = self.beam_search.params[param_name].shape
print (param_name + ": " + str(param_shape))
if __name__=="__main__":
beam_search_tester = BeamSearchTest()
beam_search_tester.test_param_load()