FinMM-MultiModal-Forecasting / fin-mm /code /fix_manifest_paths.py
GoldenGrapeGentleman1's picture
Upload fin-mm before machine wipe (part 2)
bc200fc verified
Raw History Blame Contribute Delete
747 Bytes
"""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!")