File size: 623 Bytes
4615d65
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import json
import random

with open(
    "/mnt/storage/Documents/hugging_face/colaborative_hub_training/demo_neurips/training-transformers-together-dashboard/data/"
    "serializaledata.json",
    "r",
) as f:
    serialized_data = json.load(f)

serialized_data_v2 = serialized_data
serialized_data_v2["points"] = [[item for item in serialized_data["points"][-1] if random.random() > 0.8]]

with open(
    "/mnt/storage/Documents/hugging_face/colaborative_hub_training/demo_neurips/training-transformers-together-dashboard/data/"
    "serializaledata_V2.json",
    "w",
) as f:
    f.write(json.dumps(serialized_data_v2))