Skip to content

Commit

Permalink
Merge pull request #780 from kuke/decoder_init
Browse files Browse the repository at this point in the history
Add decoder init & verify output
  • Loading branch information
Yibing Liu authored Mar 30, 2018
2 parents 05f36d8 + a6ca29f commit 2796ea7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion fluid/DeepASR/infer_by_ckpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,10 @@ 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,
args.acoustic_scale)

ltrans = [
trans_add_delta.TransAddDelta(2, 2),
trans_mean_variance_norm.TransMeanVarianceNorm(args.mean_var),
Expand Down Expand Up @@ -184,7 +188,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))

Expand Down

0 comments on commit 2796ea7

Please sign in to comment.