"...pytorch/ogb/git@developer.sourcefind.cn:OpenDAS/dgl.git" did not exist on "38b3d0c4ccfada8c5034932d0559d65f0d39bddc"
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): ...@@ -16,10 +16,21 @@ def extract_predictions_from_json(input_folder):
for model_name in os.listdir(pred_folder): for model_name in os.listdir(pred_folder):
model_folder = os.path.join(pred_folder, model_name) model_folder = os.path.join(pred_folder, model_name)
json_paths = glob(os.path.join(model_folder, 'alignment_bench_*.json')) try:
# sorted by index # when use split
json_paths = sorted( json_paths = glob(
json_paths, key=lambda x: int(x.split('.json')[0].split('_')[-1])) 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]))
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 = [] all_predictions = []
for json_ in json_paths: for json_ in json_paths:
json_data = json.load(open(json_)) 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