Write final predictions to the json file and log-odds of null if needed.
(predictions, output_nbest_file, qa_ids)
| 73 | return dataset, labels |
| 74 | |
| 75 | def write_t5_predictions(predictions, output_nbest_file, qa_ids): |
| 76 | """Write final predictions to the json file and log-odds of null if needed.""" |
| 77 | logging.info("Writing predictions to: %s" % (output_nbest_file)) |
| 78 | nbest_json = {} |
| 79 | for (qa_id, prediction) in zip(qa_ids, predictions): |
| 80 | nbest_json[qa_id] = prediction |
| 81 | with open(output_nbest_file, "w") as writer: |
| 82 | writer.write(json.dumps(nbest_json, indent=2) + "\n") |
nothing calls this directly
no outgoing calls
no test coverage detected