-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript_data_retouch.py
More file actions
executable file
·39 lines (29 loc) · 905 Bytes
/
script_data_retouch.py
File metadata and controls
executable file
·39 lines (29 loc) · 905 Bytes
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
31
32
33
34
35
36
37
38
39
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import argparse
from pathlib import Path
import pickle
import numpy as np
from tqdm import tqdm # type: ignore[import]
SCRIPT_DIR = Path(__file__).absolute().parent
DATA_DIR = SCRIPT_DIR / "data"
def main():
files = list(Path(DATA_DIR).glob("*.pkl"))
for file in tqdm(files):
with open(file, "rb") as f:
obj = pickle.load(f)
print("Loaded data")
print(obj["config"])
config = argparse.Namespace(**obj["config"])
obj["config"][
"output_name"
] = (
f"{config.max_total_length}_{config.max_answer_length}_"
f"{config.max_depth}_{config.max_qty_per_level}.json"
)
print("Saving data")
with open(file, "wb") as f:
pickle.dump(obj, f)
print("Saved data")
if __name__ == "__main__":
main()