Create checkpoint dir before writing flags file in it

This commit is contained in:
Reuben Morais 2019-09-06 13:55:55 +02:00
parent ba2d29b36f
commit 371e73eb69

View File

@ -472,6 +472,8 @@ def train():
best_dev_filename = 'best_dev_checkpoint' best_dev_filename = 'best_dev_checkpoint'
# Save flags next to checkpoints # Save flags next to checkpoints
os.makedirs(FLAGS.checkpoint_dir, exist_ok=True)
flags_file = os.path.join(FLAGS.checkpoint_dir, 'flags.txt') flags_file = os.path.join(FLAGS.checkpoint_dir, 'flags.txt')
with open(flags_file, 'w') as fout: with open(flags_file, 'w') as fout:
fout.write(FLAGS.flags_into_string()) fout.write(FLAGS.flags_into_string())