Skip to content

Commit

Permalink
Fix from_ckpt and to_ckpt.
Browse files Browse the repository at this point in the history
  • Loading branch information
thtrieu committed Aug 16, 2019
1 parent c6fff90 commit e05448b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions back_translate.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@

if __name__ == '__main__':
# Convert directory into checkpoints
from_ckpt = FLAGS.from_ckpt
to_ckpt = FLAGS.to_ckpt

if tf.gfile.IsDirectory(FLAGS.from_ckpt):
from_ckpt = tf.train.latest_checkpoint(FLAGS.from_ckpt)
if tf.gfile.IsDirectory(FLAGS.to_ckpt):
Expand All @@ -79,9 +82,9 @@
# Step 1: Translating from source language to the other language.
decoding.t2t_decoder(FLAGS.from_problem, FLAGS.from_data_dir,
FLAGS.paraphrase_from_file, tmp_file,
FLAGS.from_ckpt)
from_ckpt)

# Step 2: Translating from the other language (tmp_file) to source.
decoding.t2t_decoder(FLAGS.to_problem, FLAGS.to_data_dir,
tmp_file, FLAGS.paraphrase_to_file,
FLAGS.to_ckpt)
to_ckpt)

0 comments on commit e05448b

Please sign in to comment.