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

import glob
import shutil
11 months ago
from pathlib import Path
9 months ago
from check import create_rectangle
def get_exps(pattern: str, splitter: str = "_", dry_run: bool = True):
basedir = "/teamspace/jobs/"
chkpt_basedir = "/work/colors/lightning_logs/"
location = basedir + pattern
res = glob.glob(location)
11 months ago
location = location.replace("*", "")
H = [] # hyperparams used
# print(res)
for r in res:
11 months ago
d = r.replace(location, "").split(splitter)
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}/"
)
dir_path.mkdir(parents=True, exist_ok=True)
g = glob.glob(r + chkpt_basedir + "*")
logs = glob.glob(g[0] + "/events*")[-1]
source_path = Path(logs)
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)
else:
print("Would copy", source_path, dir_path)
return H
if __name__ == "__main__":
D = get_exps("color_*", "_")
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)