File size: 914 Bytes
9fa3d89
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import os
import json
import argparse

parser = argparse.ArgumentParser(
    description='Probe eval')
parser.add_argument('--ckpt',
                    help='ckpt',
                    default='probe_llava-1.5-vicuna-7b-lr-1e-3')
parser.add_argument('--mode',
                    help='mode',
                    default='gen')
parser.add_argument("--num-chunks", type=int, default=1)


def save_merged_json(data, output_file):
    with open(output_file, 'w') as file:
        json.dump(data, file, indent=4)

if __name__ == "__main__":
    args = parser.parse_args()
    merge_data = {}
    name = args.ckpt.split("/")[-1]

    for i in range(args.num_chunks):
        with open(f'plots/probe_scores/{name}/{args.mode}/{args.num_chunks}_{i}.json', 'r') as file:
           data = json.load(file)
        merge_data.update(data)
    
    save_merged_json(merge_data, f'plots/probe_scores/{name}/{args.mode}.json')