MCPcopy Create free account
hub / github.com/tensorflow/models / write_predictions

Function write_predictions

official/nlp/data/squad_lib.py:551–582  ·  view source on GitHub ↗

Write final predictions to the json file and log-odds of null if needed.

(all_examples,
                      all_features,
                      all_results,
                      n_best_size,
                      max_answer_length,
                      do_lower_case,
                      output_prediction_file,
                      output_nbest_file,
                      output_null_log_odds_file,
                      version_2_with_negative=False,
                      null_score_diff_threshold=0.0,
                      verbose=False)

Source from the content-addressed store, hash-verified

549
550
551def write_predictions(all_examples,
552 all_features,
553 all_results,
554 n_best_size,
555 max_answer_length,
556 do_lower_case,
557 output_prediction_file,
558 output_nbest_file,
559 output_null_log_odds_file,
560 version_2_with_negative=False,
561 null_score_diff_threshold=0.0,
562 verbose=False):
563 """Write final predictions to the json file and log-odds of null if needed."""
564 logging.info("Writing predictions to: %s", (output_prediction_file))
565 logging.info("Writing nbest to: %s", (output_nbest_file))
566
567 all_predictions, all_nbest_json, scores_diff_json = (
568 postprocess_output(
569 all_examples=all_examples,
570 all_features=all_features,
571 all_results=all_results,
572 n_best_size=n_best_size,
573 max_answer_length=max_answer_length,
574 do_lower_case=do_lower_case,
575 version_2_with_negative=version_2_with_negative,
576 null_score_diff_threshold=null_score_diff_threshold,
577 verbose=verbose))
578
579 write_to_json_files(all_predictions, output_prediction_file)
580 write_to_json_files(all_nbest_json, output_nbest_file)
581 if version_2_with_negative:
582 write_to_json_files(scores_diff_json, output_null_log_odds_file)
583
584
585def postprocess_output(all_examples,

Callers

nothing calls this directly

Calls 3

infoMethod · 0.80
postprocess_outputFunction · 0.70
write_to_json_filesFunction · 0.70

Tested by

no test coverage detected