Browse Source

[linting]: housekeeping

new-sep-loss
Michael Pilosov 10 months ago
parent
commit
5c90cc809c
  1. 1
      .gitignore
  2. 3
      check.py
  3. 2
      makefile
  4. 22
      scrape.py
  5. 2
      search.py

1
.gitignore

@ -4,3 +4,4 @@ out/
*.png *.png
.sw[opqr] .sw[opqr]
*.tar.gz *.tar.gz
.pat

3
check.py

@ -6,9 +6,6 @@ import torch
from dataloader import extract_colors, preprocess_data from dataloader import extract_colors, preprocess_data
from model import ColorTransformerModel from model import ColorTransformerModel
import numpy as np
import matplotlib.pyplot as plt
# import matplotlib.colors as mcolors # import matplotlib.colors as mcolors

2
makefile

@ -1,7 +1,7 @@
lint: lint:
black . black .
isort --profile=black . isort --profile=black .
flake8 --ignore E501 . flake8 --ignore E501,W503 .
test: test:
python main.py --alpha 1 --lr 1e-4 --max_epochs 500 python main.py --alpha 1 --lr 1e-4 --max_epochs 500

22
scrape.py

@ -5,7 +5,7 @@ from pathlib import Path
from check import make_image from check import make_image
def get_exps(pattern: str, splitter: str = "_"): def get_exps(pattern: str, splitter: str = "_", dry_run: bool = True):
basedir = "/teamspace/jobs/" basedir = "/teamspace/jobs/"
chkpt_basedir = "/work/colors/lightning_logs/" chkpt_basedir = "/work/colors/lightning_logs/"
location = basedir + pattern location = basedir + pattern
@ -24,17 +24,19 @@ def get_exps(pattern: str, splitter: str = "_"):
) )
dir_path.mkdir(parents=True, exist_ok=True) dir_path.mkdir(parents=True, exist_ok=True)
g = glob.glob(r + chkpt_basedir + "*") g = glob.glob(r + chkpt_basedir + "*")
c = g[0] + "/checkpoints"
latest_checkpoint = glob.glob(c + "/*")[-1]
# print(latest_checkpoint)
logs = glob.glob(g[0] + "/events*")[-1] logs = glob.glob(g[0] + "/events*")[-1]
print(logs)
source_path = Path(logs) source_path = Path(logs)
print("Would copy", source_path, dir_path) print(logs)
# shutil.copy(source_path, dir_path) if not dry_run:
# make_image(latest_checkpoint, f"out/version_{i}") c = g[0] + "/checkpoints"
# make_image(latest_checkpoint, f"out/version_{i}b", color=False) latest_checkpoint = glob.glob(c + "/*")[-1]
print(latest_checkpoint)
if not dry_run:
shutil.copy(source_path, dir_path)
make_image(latest_checkpoint, f"out/version_{i}")
# make_image(latest_checkpoint, f"out/version_{i}b", color=False)
else:
print("Would copy", source_path, dir_path)
return H return H

2
search.py

@ -3,7 +3,7 @@ import sys
from random import sample from random import sample
import numpy as np import numpy as np
from lightning_sdk import Machine, Studio from lightning_sdk import Machine, Studio # noqa: F401
NUM_JOBS = 64 NUM_JOBS = 64

Loading…
Cancel
Save