Skip to content

Commit

Permalink
Merge pull request dennybritz#61 from LargonD/master
Browse files Browse the repository at this point in the history
Number of checkpoints
  • Loading branch information
dennybritz authored Jan 8, 2017
2 parents 4d93ec5 + 16161c0 commit eb9eb5c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions train.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
tf.flags.DEFINE_integer("num_epochs", 200, "Number of training epochs (default: 200)")
tf.flags.DEFINE_integer("evaluate_every", 100, "Evaluate model on dev set after this many steps (default: 100)")
tf.flags.DEFINE_integer("checkpoint_every", 100, "Save model after this many steps (default: 100)")
tf.flags.DEFINE_integer("num_checkpoints", 5, "Number of checkpoints to store (default: 5)")
# Misc Parameters
tf.flags.DEFINE_boolean("allow_soft_placement", True, "Allow device soft device placement")
tf.flags.DEFINE_boolean("log_device_placement", False, "Log placement of ops on devices")
Expand All @@ -41,7 +42,7 @@
print("")


# Data Preparatopn
# Data Preparation
# ==================================================

# Load data
Expand Down Expand Up @@ -126,7 +127,7 @@
checkpoint_prefix = os.path.join(checkpoint_dir, "model")
if not os.path.exists(checkpoint_dir):
os.makedirs(checkpoint_dir)
saver = tf.train.Saver(tf.global_variables())
saver = tf.train.Saver(tf.global_variables(), max_to_keep=FLAGS.num_checkpoints)

# Write vocabulary
vocab_processor.save(os.path.join(out_dir, "vocab"))
Expand Down

0 comments on commit eb9eb5c

Please sign in to comment.