From 9a92fa40cae1bc16cb2fabf5d0f513d0fc00f94e Mon Sep 17 00:00:00 2001 From: Catalin Voss Date: Mon, 2 Nov 2020 21:09:35 -0800 Subject: [PATCH 1/2] Make variables consistent --- training/deepspeech_training/train.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/training/deepspeech_training/train.py b/training/deepspeech_training/train.py index 5d4d7a0d..ded45d2d 100644 --- a/training/deepspeech_training/train.py +++ b/training/deepspeech_training/train.py @@ -900,21 +900,21 @@ def do_single_file_inference(input_file_path): features = create_overlapping_windows(features).eval(session=session) features_len = features_len.eval(session=session) - logits = outputs['outputs'].eval(feed_dict={ + probs = outputs['outputs'].eval(feed_dict={ inputs['input']: features, inputs['input_lengths']: features_len, inputs['previous_state_c']: previous_state_c, inputs['previous_state_h']: previous_state_h, }, session=session) - logits = np.squeeze(logits) + probs = np.squeeze(probs) if FLAGS.scorer_path: scorer = Scorer(FLAGS.lm_alpha, FLAGS.lm_beta, FLAGS.scorer_path, Config.alphabet) else: scorer = None - decoded = ctc_beam_search_decoder(logits, Config.alphabet, FLAGS.beam_width, + decoded = ctc_beam_search_decoder(probs, Config.alphabet, FLAGS.beam_width, scorer=scorer, cutoff_prob=FLAGS.cutoff_prob, cutoff_top_n=FLAGS.cutoff_top_n) # Print highest probability result From 98e75c3c0370effbcdff7cdd7560ad2cbec3f105 Mon Sep 17 00:00:00 2001 From: Catalin Voss Date: Tue, 3 Nov 2020 09:49:27 -0800 Subject: [PATCH 2/2] Call the logits probs in `create_inference_graph` after they go thru softmax --- training/deepspeech_training/train.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/training/deepspeech_training/train.py b/training/deepspeech_training/train.py index ded45d2d..8bf7a354 100644 --- a/training/deepspeech_training/train.py +++ b/training/deepspeech_training/train.py @@ -730,7 +730,7 @@ def create_inference_graph(batch_size=1, n_steps=16, tflite=False): logits = tf.squeeze(logits, [1]) # Apply softmax for CTC decoder - logits = tf.nn.softmax(logits, name='logits') + probs = tf.nn.softmax(logits, name='logits') if batch_size <= 0: if tflite: @@ -743,7 +743,7 @@ def create_inference_graph(batch_size=1, n_steps=16, tflite=False): 'input_lengths': seq_length, }, { - 'outputs': logits, + 'outputs': probs, }, layers ) @@ -763,7 +763,7 @@ def create_inference_graph(batch_size=1, n_steps=16, tflite=False): inputs['input_lengths'] = seq_length outputs = { - 'outputs': logits, + 'outputs': probs, 'new_state_c': new_state_c, 'new_state_h': new_state_h, 'mfccs': mfccs,