Download strip.py from Tabloop/tabloop-block-sweep-small: direct link, hf CLI and curl.
- Browser
- Download file 723 Bytes
-
https://huggingface.co/Tabloop/tabloop-block-sweep-small/resolve/main/strip.py
- Command line
-
hf download hf://Tabloop/tabloop-block-sweep-small/strip.py
-
curl -L -o strip.py https://huggingface.co/Tabloop/tabloop-block-sweep-small/resolve/main/strip.py
723 Bytes
| """Strip optimizer + RNG state from TabLoop checkpoints: keeps {step, model, config}. | |
| python strip.py <src checkpoints dir> <dst dir> (skips existing outputs; ignores latest.ckpt)""" | |
| import glob, os, re, sys, torch | |
| src, dst = sys.argv[1], sys.argv[2]; os.makedirs(dst, exist_ok=True) | |
| for p in sorted(glob.glob(f"{src}/step-*.ckpt")): | |
| s = int(re.search(r"step-(\d+)\.ckpt", p).group(1)); out = f"{dst}/step-{s:06d}.ckpt" | |
| if os.path.exists(out): continue | |
| ck = torch.load(p, map_location="cpu", weights_only=False) | |
| torch.save({"step": ck["step"], "model": ck["model"], "config": ck["config"]}, out + ".tmp"); os.replace(out + ".tmp", out) | |
| print(src, len(glob.glob(f"{dst}/step-*.ckpt")), "stripped") | |