def single_eval(eval_dataset, estimator, ckpt_path, mention2text, entityid2name,
                supervision, output_prediction_file, eval_fn, **kwargs):
  """Run one evaluation using given checkpoint."""
  tf.logging.info("***** Running predictions using %s *****", ckpt_path)
  tf.logging.info("  Num eval examples = %d", len(eval_dataset.examples))
  tf.logging.info("  Batch size = %d", FLAGS.predict_batch_size)

  # Collect ground truth answers.
  if supervision == "mention":
    name_map = mention2text
  else:
    name_map = entityid2name

  # If running eval on the TPU, you will need to specify the number of
  # steps.
  all_results = []
  for result in estimator.predict(
      eval_dataset.input_fn,
      yield_single_examples=True,
      checkpoint_path=ckpt_path):
    if not all_results:
      t_st = time.time()
    if len(all_results) % 1000 == 0:
      tf.logging.info("Processing example: %d", len(all_results))
    all_results.append(result)
  total_time = time.time() - t_st

  # Compute metrics.
  metrics = eval_fn(
      eval_dataset,
      all_results,
      name_map,
      output_prediction_file,
      supervision=supervision,
      **kwargs)
  metrics["QPS"] = float(len(all_results)) / total_time

  return metrics
Run one evaluation using given checkpoint.
language/labs/drkit/run_multihop_follow.py