Unverified Commit ad96f215 authored by Songyang Zhang's avatar Songyang Zhang Committed by GitHub
Browse files

Update merge script (#733)

parent 336d8d76
......@@ -16,10 +16,21 @@ def extract_predictions_from_json(input_folder):
for model_name in os.listdir(pred_folder):
model_folder = os.path.join(pred_folder, model_name)
json_paths = glob(os.path.join(model_folder, 'alignment_bench_*.json'))
try:
# when use split
json_paths = glob(
os.path.join(model_folder, 'alignment_bench_*.json'))
# sorted by index
json_paths = sorted(
json_paths, key=lambda x: int(x.split('.json')[0].split('_')[-1]))
json_paths,
key=lambda x: int(x.split('.json')[0].split('_')[-1]))
except Exception as e:
# when only one complete file
print(e)
json_paths = [os.path.join(model_folder, 'alignment_bench.json')]
else:
raise FileNotFoundError
all_predictions = []
for json_ in json_paths:
json_data = json.load(open(json_))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment