zziang commited on
Commit
2003020
·
verified ·
1 Parent(s): 0738280

director train: reuse collected scripts

Browse files
Files changed (1) hide show
  1. kaggle/notebook_director_train.py +10 -1
kaggle/notebook_director_train.py CHANGED
@@ -12,6 +12,7 @@ Everything runs out-of-process because transformers has to be upgraded to 5.x
12
  and this notebook already imported huggingface_hub to fetch the bundle.
13
  """
14
  import os
 
15
  import subprocess
16
  import sys
17
 
@@ -39,7 +40,15 @@ def main() -> None:
39
  if not os.path.exists(os.path.join(BUNDLE, "kaggle", "director_probe.py")):
40
  raise SystemExit("director_probe.py missing")
41
 
42
- run("director_probe.py", MODE="collect", TARGET="160", MAX_TRIES="700")
 
 
 
 
 
 
 
 
43
  if run("director_sft.py", EPOCHS="4", TRAIN_LAYERS="6") != 0:
44
  raise SystemExit("training failed")
45
  run("director_probe.py", MODE="eval", N_SAMPLES="12",
 
12
  and this notebook already imported huggingface_hub to fetch the bundle.
13
  """
14
  import os
15
+ import shutil
16
  import subprocess
17
  import sys
18
 
 
40
  if not os.path.exists(os.path.join(BUNDLE, "kaggle", "director_probe.py")):
41
  raise SystemExit("director_probe.py missing")
42
 
43
+ # 160 scripts collected on the first attempt (68% acceptance); reuse them
44
+ # instead of paying 25 minutes of sampling again.
45
+ seed = os.path.join(BUNDLE, "director", "sft.jsonl")
46
+ if os.path.exists(seed):
47
+ os.makedirs("/kaggle/working/director", exist_ok=True)
48
+ shutil.copyfile(seed, "/kaggle/working/director/sft.jsonl")
49
+ print("reusing collected scripts", flush=True)
50
+ else:
51
+ run("director_probe.py", MODE="collect", TARGET="160", MAX_TRIES="700")
52
  if run("director_sft.py", EPOCHS="4", TRAIN_LAYERS="6") != 0:
53
  raise SystemExit("training failed")
54
  run("director_probe.py", MODE="eval", N_SAMPLES="12",