You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
1.6 KiB
56 lines
1.6 KiB
11 months ago
|
import glob
|
||
|
import shutil
|
||
11 months ago
|
from pathlib import Path
|
||
|
|
||
9 months ago
|
from check import create_rectangle
|
||
11 months ago
|
|
||
|
|
||
11 months ago
|
def get_exps(pattern: str, splitter: str = "_", dry_run: bool = True):
|
||
11 months ago
|
basedir = "/teamspace/jobs/"
|
||
|
chkpt_basedir = "/work/colors/lightning_logs/"
|
||
|
location = basedir + pattern
|
||
|
res = glob.glob(location)
|
||
11 months ago
|
location = location.replace("*", "")
|
||
11 months ago
|
H = [] # hyperparams used
|
||
|
# print(res)
|
||
|
for r in res:
|
||
11 months ago
|
d = r.replace(location, "").split(splitter)
|
||
11 months ago
|
d = list(float(_d) for _d in d)
|
||
|
d[0] = int(d[0])
|
||
|
H.append(d)
|
||
|
for i, r in enumerate(res):
|
||
11 months ago
|
dir_path = Path(
|
||
|
f"/teamspace/studios/this_studio/colors/lightning_logs/version_{i}/"
|
||
|
)
|
||
11 months ago
|
dir_path.mkdir(parents=True, exist_ok=True)
|
||
|
g = glob.glob(r + chkpt_basedir + "*")
|
||
|
logs = glob.glob(g[0] + "/events*")[-1]
|
||
11 months ago
|
source_path = Path(logs)
|
||
11 months ago
|
print(logs)
|
||
|
if not dry_run:
|
||
|
c = g[0] + "/checkpoints"
|
||
|
latest_checkpoint = glob.glob(c + "/*")[-1]
|
||
|
print(latest_checkpoint)
|
||
|
if not dry_run:
|
||
|
shutil.copy(source_path, dir_path)
|
||
9 months ago
|
create_rectangle(latest_checkpoint, f"out/version_{i}")
|
||
|
# create_rectangle(latest_checkpoint, f"out/version_{i}b", color=False)
|
||
11 months ago
|
else:
|
||
|
print("Would copy", source_path, dir_path)
|
||
11 months ago
|
return H
|
||
|
|
||
|
|
||
|
if __name__ == "__main__":
|
||
|
D = get_exps("color_*", "_")
|
||
11 months ago
|
|
||
|
import numpy as np
|
||
|
|
||
|
D = np.array(D)
|
||
|
# print(len(D), "\n", D)
|
||
|
import pandas as pd
|
||
|
|
||
|
df = pd.DataFrame(D)
|
||
|
df.columns = ["batch_size", "alpha", "learning_rate"]
|
||
|
df.to_csv("experiments.csv")
|
||
|
print(df)
|