diff --git a/deep_speech_2/decoders/swig_wrapper.py b/deep_speech_2/decoders/swig_wrapper.py index 0a921125827b02bbe6b19668bcd4c965d32c9596..21aed03c1b551383a75aa4019c4cb002e48254b2 100644 --- a/deep_speech_2/decoders/swig_wrapper.py +++ b/deep_speech_2/decoders/swig_wrapper.py @@ -35,7 +35,8 @@ def ctc_greedy_decoder(probs_seq, vocabulary): :return: Decoding result string. :rtype: basestring """ - return swig_decoders.ctc_greedy_decoder(probs_seq.tolist(), vocabulary) + result = swig_decoders.ctc_greedy_decoder(probs_seq.tolist(), vocabulary) + return result.decode('utf-8') def ctc_beam_search_decoder(probs_seq, @@ -69,9 +70,11 @@ def ctc_beam_search_decoder(probs_seq, results, in descending order of the probability. :rtype: list """ - return swig_decoders.ctc_beam_search_decoder(probs_seq.tolist(), vocabulary, - beam_size, cutoff_prob, - cutoff_top_n, ext_scoring_func) + beam_results = swig_decoders.ctc_beam_search_decoder( + probs_seq.tolist(), vocabulary, beam_size, cutoff_prob, cutoff_top_n, + ext_scoring_func) + beam_results = [(res[0], res[1].decode('utf-8')) for res in beam_results] + return beam_results def ctc_beam_search_decoder_batch(probs_split, @@ -111,6 +114,11 @@ def ctc_beam_search_decoder_batch(probs_split, """ probs_split = [probs_seq.tolist() for probs_seq in probs_split] - return swig_decoders.ctc_beam_search_decoder_batch( + batch_beam_results = swig_decoders.ctc_beam_search_decoder_batch( probs_split, vocabulary, beam_size, num_processes, cutoff_prob, cutoff_top_n, ext_scoring_func) + batch_beam_results = [ + [(res[0], res[1].decode("utf-8")) for res in beam_results] + for beam_results in batch_beam_results + ] + return batch_beam_results diff --git a/deep_speech_2/examples/tiny/run_train.sh b/deep_speech_2/examples/tiny/run_train.sh index 88b09bee5d1017bf45c8682e9b27403aaa021d3e..e03a8aff04965692ae8c69e574b1cd94ea4677fc 100644 --- a/deep_speech_2/examples/tiny/run_train.sh +++ b/deep_speech_2/examples/tiny/run_train.sh @@ -33,7 +33,7 @@ python -u train.py \ --shuffle_method='batch_shuffle_clipped' if [ $? -ne 0 ]; then - echo "Fail to do inference!" + echo "Fail in training!" exit 1 fi