File size: 747 Bytes
43235e7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
"""Fix Windows path separators in manifest file for Linux compatibility."""
import json

manifest_path = '/home/amd/yueyuan/Finance/fin-mm/data/paired_dataset/manifest_pred20.json'

with open(manifest_path, 'r', encoding='utf-8') as f:
    data = json.load(f)

count = 0
for split_name in data['splits']:
    for sample in data['splits'][split_name]:
        if '\\' in sample['csv_path']:
            sample['csv_path'] = sample['csv_path'].replace('\\', '/')
            count += 1
        if '\\' in sample['png_path']:
            sample['png_path'] = sample['png_path'].replace('\\', '/')

with open(manifest_path, 'w', encoding='utf-8') as f:
    json.dump(data, f, indent=2)

print(f"Fixed {count} paths in manifest!")