File size: 683 Bytes
74b17e0 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
import argparse
import json
import os
def eval_model(args):
answers = [json.loads(q) for q in open(os.path.expanduser(args.answers_file), "r")]
answers_dict = {}
for answer in answers:
answers_dict[answer["question_id"]] = answer["text"]
# print(answer)
with open(args.answers_output, "w") as f:
json.dump(answers_dict, f)
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument(
"--answers-file",
type=str,
required=True
)
parser.add_argument(
"--answers-output",
type=str,
required=True
)
args = parser.parse_args()
eval_model(args)
|