From a5cd05c6a34685bed2a0e65cecf656f474b13212 Mon Sep 17 00:00:00 2001 From: Yibing Liu Date: Tue, 27 Mar 2018 05:46:12 -0700 Subject: [PATCH 1/2] Add decoder init & verify output --- fluid/DeepASR/infer_by_ckpt.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fluid/DeepASR/infer_by_ckpt.py b/fluid/DeepASR/infer_by_ckpt.py index f267f67498..64905a5501 100644 --- a/fluid/DeepASR/infer_by_ckpt.py +++ b/fluid/DeepASR/infer_by_ckpt.py @@ -143,6 +143,9 @@ def infer_from_ckpt(args): # load checkpoint. fluid.io.load_persistables(exe, args.checkpoint) + # init decoder + decoder = Decoder(args.vocabulary, args.graphs, args.log_prior) + ltrans = [ trans_add_delta.TransAddDelta(2, 2), trans_mean_variance_norm.TransMeanVarianceNorm(args.mean_var), @@ -181,7 +184,7 @@ def infer_from_ckpt(args): infer_batch = split_infer_result(probs, lod) for index, sample in enumerate(infer_batch): key = "utter#%d" % (batch_id * args.batch_size + index) - print(key, ": ", decoder.decode(key, sample), "\n") + print(key, ": ", decoder.decode(key, sample).encode("utf8"), "\n") print(np.mean(infer_costs), np.mean(infer_accs)) From a6ca29f7cc04a2d11bf30911f79572ed9f1edfa8 Mon Sep 17 00:00:00 2001 From: Yibing Liu Date: Thu, 29 Mar 2018 07:13:42 -0700 Subject: [PATCH 2/2] Add acoustic scale in decoder init --- fluid/DeepASR/infer_by_ckpt.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fluid/DeepASR/infer_by_ckpt.py b/fluid/DeepASR/infer_by_ckpt.py index 679634837a..bf6093acb8 100644 --- a/fluid/DeepASR/infer_by_ckpt.py +++ b/fluid/DeepASR/infer_by_ckpt.py @@ -149,7 +149,8 @@ def infer_from_ckpt(args): fluid.io.load_persistables(exe, args.checkpoint) # init decoder - decoder = Decoder(args.vocabulary, args.graphs, args.log_prior) + decoder = Decoder(args.vocabulary, args.graphs, args.log_prior, + args.acoustic_scale) ltrans = [ trans_add_delta.TransAddDelta(2, 2),