coderofpears commited on
Commit
020a3e3
·
verified ·
1 Parent(s): 359f2c4

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. 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
- if not os.path.exists(os.path.join(data_dir, "train.bin")):
80
- print(f"[modal] train.bin missing; generating data locally (scale={scale}) ...")
 
 
 
 
 
 
 
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