MCPcopy Create free account
hub / github.com/apache/singa / postprocess

Function postprocess

examples/onnx/bert/bert-squad.py:74–86  ·  view source on GitHub ↗
(eval_examples, extra_data, all_results)

Source from the content-addressed store, hash-verified

72
73
74def postprocess(eval_examples, extra_data, all_results):
75 output_dir = 'predictions'
76 os.makedirs(output_dir, exist_ok=True)
77 output_prediction_file = os.path.join(output_dir, "predictions.json")
78 output_nbest_file = os.path.join(output_dir, "nbest_predictions.json")
79 write_predictions(eval_examples, extra_data, all_results, n_best_size,
80 max_answer_length, True, output_prediction_file,
81 output_nbest_file)
82
83 # print results
84 with open(output_prediction_file) as json_file:
85 test_data = json.load(json_file)
86 print("The result is:", json.dumps(test_data, indent=2))
87
88
89class MyModel(sonnx.SONNXModel):

Callers 1

bert-squad.pyFile · 0.70

Calls 2

write_predictionsFunction · 0.90
loadMethod · 0.45

Tested by

no test coverage detected