Skip to content

Commit 1ac8029

Browse files
committed
Less memory-hungry rename
1 parent 0b26fd9 commit 1ac8029

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

notebooks_jason/wandb_models_rename.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
model_base.mkdir(exist_ok=True, parents=True)
1313
known_models = set()
1414
for path in tqdm(list(model_base.glob("*.pth")), "Known models"):
15-
known_models.add(path.read_bytes())
15+
known_models.add(hash(path.read_bytes()))
1616

1717
with tqdm(wandbs) as pbar:
1818
for path in pbar:
1919
pbar.set_postfix({})
20-
if path.read_bytes() in known_models:
20+
if hash(path.read_bytes()) in known_models:
2121
continue
2222
cache = torch.load(path, map_location="cpu")
2323
# if cache["run_config"]["experiment"]["p"] not in (7, 12):

0 commit comments

Comments
 (0)