HCAI-Lab/w2-consensus-deepdive-unlearning-artifacts / social-data-attribution-w2 /scripts /unlearning /cleanup_truncated.py
| #!/usr/bin/env python3 | |
| """Delete faithful multiseed dirs whose latest checkpoint is truncated/incomplete | |
| (adapter_model.safetensors < 30MB or missing adapter_config.json) so they get re-trained.""" | |
| from pathlib import Path | |
| import shutil | |
| MS = Path.home() / "scratch/n16_selectivity/multiseed" | |
| GOOD_MIN = 30_000_000 # complete rank-8 LoRA adapter is ~33.6MB | |
| deleted = [] | |
| for d in sorted(MS.glob("faithful_*")): | |
| if not d.is_dir(): | |
| continue | |
| cks = sorted( | |
| d.glob("checkpoint-*"), | |
| key=lambda c: ( | |
| int(c.name.split("-")[-1]) if c.name.split("-")[-1].isdigit() else 0 | |
| ), | |
| ) | |
| if not cks: | |
| continue | |
| latest = cks[-1] | |
| model = latest / "adapter_model.safetensors" | |
| cfg = latest / "adapter_config.json" | |
| ok = model.exists() and model.stat().st_size >= GOOD_MIN and cfg.exists() | |
| if not ok: | |
| shutil.rmtree(d) | |
| deleted.append(d.name) | |
| print(f"deleted {len(deleted)} truncated/incomplete dirs:") | |
| for x in deleted: | |
| print(" ", x) | |
Xet Storage Details
- Size:
- 1.01 kB
- Xet hash:
- 355dddd11712a9bc45d909aba6a17d806e723f6081318a4f4cae6105f3dc3ae8
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.