Upload folder using huggingface_hub
Browse files- modal_train.py +9 -2
modal_train.py
CHANGED
|
@@ -76,8 +76,15 @@ def train_on_l4(hours: float = 20.0, ckpt_every: int = 250,
|
|
| 76 |
os.makedirs(ckpt_dir, exist_ok=True)
|
| 77 |
|
| 78 |
# ---- ensure data (generate in-container; fast HF egress) ----
|
| 79 |
-
|
| 80 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
subprocess.run([sys.executable, "prep.py", "--out-dir", data_dir,
|
| 82 |
"--scale", str(scale)], check=True)
|
| 83 |
|
|
|
|
| 76 |
os.makedirs(ckpt_dir, exist_ok=True)
|
| 77 |
|
| 78 |
# ---- ensure data (generate in-container; fast HF egress) ----
|
| 79 |
+
# Only treat the dataset as complete if meta.json exists (a partial
|
| 80 |
+
# train.bin from a killed run must be regenerated).
|
| 81 |
+
meta_path = os.path.join(data_dir, "meta.json")
|
| 82 |
+
if not os.path.exists(meta_path):
|
| 83 |
+
stale = os.path.join(data_dir, "train.bin")
|
| 84 |
+
if os.path.exists(stale):
|
| 85 |
+
print("[modal] found partial train.bin without meta.json; discarding.")
|
| 86 |
+
os.remove(stale)
|
| 87 |
+
print(f"[modal] generating data locally (scale={scale}) ...")
|
| 88 |
subprocess.run([sys.executable, "prep.py", "--out-dir", data_dir,
|
| 89 |
"--scale", str(scale)], check=True)
|
| 90 |
|