(config_map, data_fn, additional_trial_info)
Run training or evaluation.
Run training or evaluation.
Run training or evaluation .
def run(config_map, data_fn, additional_trial_info):
  """Run training or evaluation."""
  tf.logging.set_verbosity(FLAGS.log)

  config = config_map[FLAGS.config]
  model_dir = os.path.expanduser(FLAGS.model_dir)

  hparams = config.hparams

  # Command line flags override any of the preceding hyperparameter values.
  hparams.parse(FLAGS.hparams)

  if FLAGS.mode == 'train':
    train_util.train(
        model_fn=config.model_fn,
        data_fn=data_fn,
        additional_trial_info=additional_trial_info,
        master=FLAGS.master,
        tpu_cluster=FLAGS.tpu_cluster,
        model_dir=model_dir,
        use_tpu=FLAGS.use_tpu,
        preprocess_examples=FLAGS.preprocess_examples,
        hparams=hparams,
        keep_checkpoint_max=FLAGS.keep_checkpoint_max,
        num_steps=FLAGS.num_steps,
        warm_start_from=FLAGS.warm_start_from
    )
  elif FLAGS.mode == 'eval':
    train_util.evaluate(
        model_fn=config.model_fn,
        data_fn=data_fn,
        additional_trial_info=additional_trial_info,
        master=FLAGS.master,
        model_dir=model_dir,
        name=FLAGS.eval_name,
        preprocess_examples=FLAGS.preprocess_examples,
        hparams=hparams,
        num_steps=FLAGS.eval_num_steps)
  else:
    raise ValueError('Unknown/unsupported mode: %s' % FLAGS.mode)
def run ( config_map , data_fn , additional_trial_info ) : tf . logging . set_verbosity ( FLAGS . log ) config = config_map [ FLAGS . config ] model_dir = os . path . expanduser ( FLAGS . model_dir ) hparams = config . hparams # Command line flags override any of the preceding hyperparameter values. hparams . parse ( FLAGS . hparams ) if FLAGS . mode == 'train' : train_util . train ( model_fn = config . model_fn , data_fn = data_fn , additional_trial_info = additional_trial_info , master = FLAGS . master , tpu_cluster = FLAGS . tpu_cluster , model_dir = model_dir , use_tpu = FLAGS . use_tpu , preprocess_examples = FLAGS . preprocess_examples , hparams = hparams , keep_checkpoint_max = FLAGS . keep_checkpoint_max , num_steps = FLAGS . num_steps , warm_start_from = FLAGS . warm_start_from ) elif FLAGS . mode == 'eval' : train_util . evaluate ( model_fn = config . model_fn , data_fn = data_fn , additional_trial_info = additional_trial_info , master = FLAGS . master , model_dir = model_dir , name = FLAGS . eval_name , preprocess_examples = FLAGS . preprocess_examples , hparams = hparams , num_steps = FLAGS . eval_num_steps ) else : raise ValueError ( 'Unknown/unsupported mode: %s' % FLAGS . mode )