Upload _claude_memory/feedback_disk_management.md with huggingface_hub
Browse files
_claude_memory/feedback_disk_management.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
name: Manage disk proactively — prefer move-to-/shm over delete; record manifest
|
| 3 |
+
description: Disk-fill-up incidents are costly. Mitigate by uploading important to HF + MOVING (not deleting) intermediate files to /shm with a manifest of what went where.
|
| 4 |
+
type: feedback
|
| 5 |
+
originSessionId: 4037f43b-2133-46c6-84bd-02f7d454ec8b
|
| 6 |
+
---
|
| 7 |
+
When a long-running session generates many GB of artifacts:
|
| 8 |
+
|
| 9 |
+
1. **Upload important checkpoints to HF immediately** when achieved, don't accumulate on local disk:
|
| 10 |
+
- Final-quality oracles → `explcre/dnathinker-checkpoints/runs/<run_dir>/`
|
| 11 |
+
- Major arch-ablation checkpoints (e.g., midway-decision-point ones)
|
| 12 |
+
- Ground-truth motif targets / extracted labels (if costly to regenerate)
|
| 13 |
+
- The bundle scripts + README so others can use them
|
| 14 |
+
|
| 15 |
+
2. **MOVE intermediate files to `/shm` instead of deleting them.** `/shm` is a symlink to `/dev/shm` (157 GB tmpfs). Always log every move so the user can restore.
|
| 16 |
+
- Quarantine area: `/shm/dnathinker_quarantine/<original-relative-path>`
|
| 17 |
+
- Manifest log: `/shm/dnathinker_quarantine/MANIFEST.tsv` — append `<ISO-timestamp>\t<source-abs-path>\t<dest-abs-path>\t<size-bytes>\t<reason>` per move.
|
| 18 |
+
- Order priority for moving (most-unneeded first): corrupt/partial ckpts, then obsolete intermediate eval_loss > final, then HF Trainer's `checkpoint-<step>/` dirs that duplicate human-named `ckpt_step<step>.pt`, then eval-output caches (FIMO TSVs).
|
| 19 |
+
- Only resort to actual `rm` when the file is truly known-recoverable AND the user explicitly approves (e.g., regenerable in minutes from versioned source).
|
| 20 |
+
|
| 21 |
+
**Why:** previous H100 disk fill killed an in-flight ablation (loss 5.45→4.57 was achieved but ckpt-2000 corrupted) and broke the Bash runtime itself. The user does not want a repeat — and prefers reversibility ("prefer not deleting things, and record what's moved, to where").
|
| 22 |
+
|
| 23 |
+
**Volatility caveat:** `/dev/shm` is RAM-backed tmpfs — files there DO NOT survive container/host restart. Mention this to the user when moving any file that is not regenerable from HF or source. If they want durable moves, ask first; possible alternates: another large block-mounted volume, or just push to HF and delete.
|
| 24 |
+
|
| 25 |
+
**How to apply:** at every meaningful milestone (oracle done, ablation step landed, comparison done): (a) push final artifacts to HF, (b) MOVE previous intermediate copies to `/shm/dnathinker_quarantine/...` and append to the manifest. Never silently `rm` to free space.
|
| 26 |
+
|
| 27 |
+
**Move helper boilerplate:**
|
| 28 |
+
```bash
|
| 29 |
+
QUAR=/shm/dnathinker_quarantine
|
| 30 |
+
MANIFEST=$QUAR/MANIFEST.tsv
|
| 31 |
+
mkdir -p "$QUAR"
|
| 32 |
+
move_to_shm() {
|
| 33 |
+
local src="$1" reason="$2"
|
| 34 |
+
local rel="${src#/}"; local dst="$QUAR/$rel"
|
| 35 |
+
mkdir -p "$(dirname "$dst")"
|
| 36 |
+
local sz; sz=$(stat -c %s "$src" 2>/dev/null || du -sb "$src" | cut -f1)
|
| 37 |
+
mv "$src" "$dst" && \
|
| 38 |
+
printf "%s\t%s\t%s\t%s\t%s\n" "$(date -Iseconds)" "$src" "$dst" "$sz" "$reason" >> "$MANIFEST"
|
| 39 |
+
}
|
| 40 |
+
```
|
| 41 |
+
|
| 42 |
+
**HF upload boilerplate:**
|
| 43 |
+
```python
|
| 44 |
+
from huggingface_hub import HfApi
|
| 45 |
+
api = HfApi()
|
| 46 |
+
api.upload_file(path_or_fileobj=local, path_in_repo=repo_path,
|
| 47 |
+
repo_id="explcre/dnathinker-checkpoints", repo_type="model")
|
| 48 |
+
```
|