def single_eval(eval_tfrecord_filename, estimator, eval_examples, eval_features,
                ckpt_path, output_prediction_file, output_nbest_file,
                output_null_log_odds_file):
  """Run one evaluation using given checkpoint."""
  tf.logging.info("***** Running predictions using %s *****", ckpt_path)
  tf.logging.info("  Num orig examples = %d", len(eval_examples))
  tf.logging.info("  Num split examples = %d", len(eval_features))

  all_results = []

  predict_input_fn = input_fn_builder(
      input_files=[eval_tfrecord_filename],
      seq_length=FLAGS.max_seq_length,
      qry_length=FLAGS.max_query_length,
      is_training=False,
      drop_remainder=False)

  # If running eval on the TPU, you will need to specify the number of
  # steps.
  all_results = []
  for result in estimator.predict(
      predict_input_fn, yield_single_examples=True, checkpoint_path=ckpt_path):
    if len(all_results) % 1000 == 0:
      tf.logging.info("Processing example: %d", len(all_results))
    unique_id = int(result["unique_ids"])
    start_logits = [float(x) for x in result["start_logits"].flat]
    end_logits = [float(x) for x in result["end_logits"].flat]
    all_results.append(
        RawResult(
            unique_id=unique_id,
            start_logits=start_logits,
            end_logits=end_logits,
        ))

  write_predictions(eval_examples, eval_features, all_results,
                    FLAGS.n_best_size, FLAGS.max_answer_length,
                    FLAGS.do_lower_case, output_prediction_file,
                    output_nbest_file, output_null_log_odds_file)
Run one evaluation using given checkpoint.
language/labs/drkit/run_dualencoder_qa.py