Appraisal Validation Training

With TensorFlow r1.3 monitors are out of date:

"2016-12-05", "Monitors are deprecated. Use tf.train.SessionRunHook." ) and Estimator.train (input_fn, hooks, ..) only works with hooks.

How to implement the functionality of a verification monitor using interceptors?

+6
source share
2 answers

I use SummarySaverHook instead of monitors. They are not so strong yet, and the training material has not been updated with a description of how to accurately reproduce the functionality of the monitor.

Here is how I use it:

summary_hook = tf.train.SummarySaverHook(
      save_steps = SAVE_EVERY_N_STEPS,
      output_dir='./tmp/rnnStats',
      scaffold= tf.train.Scaffold(),
      summary_op=tf.summary.merge_all())


  print("Classifier.train")
  classifier.train(input_fn=train_input_fn, steps=1000, hooks=[summary_hook])
+2
source

. , , , , ...


( , ), train_and_evaluate . EvalSpec, , start_delay_secs throttle_secs, , ( - EVAL).

classifier = tf.estimator.Estimator(
    model_fn=model_fn,
    model_dir=model_dir,
    params=params)

train_spec = tf.estimator.TrainSpec(
    input_fn = input_fn,
)

eval_spec = tf.estimator.EvalSpec(
    input_fn = valid_input_fn,
    throttle_secs=120,
    start_delay_secs=120,
)

tf.estimator.train_and_evaluate(
    classifier,
    train_spec,
    eval_spec
)
+1

All Articles