Phi-3-V / scripts /convert_gqa_for_eval.py
mmaaz60's picture
Adds code to host LLaVA-Phi-3 demo on HF space.
5920b49
raw
history blame contribute delete
487 Bytes
import os
import json
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--src", type=str)
parser.add_argument("--dst", type=str)
args = parser.parse_args()
all_answers = []
for line_idx, line in enumerate(open(args.src)):
res = json.loads(line)
question_id = res['question_id']
text = res['text'].rstrip('.').lower()
all_answers.append({"questionId": question_id, "prediction": text})
with open(args.dst, 'w') as f:
json.dump(all_answers, f)