Cion-lab commited on
Commit
e26f3f1
·
verified ·
1 Parent(s): 576e5ae

trainer: the post-stop assertions are rank-0 facts (E-044: hub_cb.steps is empty on rank 1 by construction, so the guard killed every correctly-checkpointed segment)

Browse files
Files changed (1) hide show
  1. train/train_ounce100m.py +13 -7
train/train_ounce100m.py CHANGED
@@ -603,7 +603,13 @@ def main():
603
  # the target, but performing the save at that step is the library's decision. If it ever ordered the
604
  # stop ahead of the save, the session would exit 0 having pushed nothing, and every relaunch would
605
  # redo the same interval while `latest` stayed put -- which looks like a stuck run, not a broken one.
606
- if hub_cb is not None and args.stop_after_steps:
 
 
 
 
 
 
607
  if args.stop_after_steps <= start_step:
608
  raise SystemExit(f"--stop-after-steps {args.stop_after_steps} is not beyond the resume point "
609
  f"step {start_step}: this session would train nothing")
@@ -632,12 +638,12 @@ def main():
632
 
633
  # A segment that stopped short of the horizon does not run the validation pass, on every rank.
634
  #
635
- # Probe 1 v1 and v4 showed the same split twice: the leg stopped early by `--stop-after-steps` died inside
636
- # `evaluate()` on rank 1 with no Python traceback at all, while the leg that reached its horizon ran the
637
- # same call and exported cleanly. `should_training_stop` is raised from `on_step_end`, so the two ranks
638
- # can leave the inner loop one batch apart, and a collective entered in that state kills a rank without
639
- # raising -- which is exactly the signature. The report's PPL comes from the horizon leg, and the
640
- # mid-run legs keep their training loss, which is what §5 asks to watch on every wake.
641
  forced_stop = bool(hub_cb and hub_cb.stopped_at and step < steps_planned)
642
  print(f"[rank {rank}] past the stop guard: forced_stop={forced_stop} "
643
  f"stopped_at={getattr(hub_cb, 'stopped_at', None)}", flush=True)
 
603
  # the target, but performing the save at that step is the library's decision. If it ever ordered the
604
  # stop ahead of the save, the session would exit 0 having pushed nothing, and every relaunch would
605
  # redo the same interval while `latest` stayed put -- which looks like a stuck run, not a broken one.
606
+ if hub_cb is not None and args.stop_after_steps and rank == 0:
607
+ # Rank 0 only, because every fact below is a rank-0 fact: `on_save` returns early on the other
608
+ # ranks, so `hub_cb.steps` is empty on rank 1 by construction and this guard -- written to catch
609
+ # a segment that ended without a pushed checkpoint -- killed *every* correctly checkpointed
610
+ # segment on rank 1 with `pushed: []`. That SystemExit, not a divergent collective, is what
611
+ # probe v1/v4/v5/v6/v7 saw as "rank 1 exitcode 1 with error_file <N/A>": rank 1 died on its own
612
+ # assertion while rank 0 sat in the next all_reduce until torchrun SIGTERMed it (E-044).
613
  if args.stop_after_steps <= start_step:
614
  raise SystemExit(f"--stop-after-steps {args.stop_after_steps} is not beyond the resume point "
615
  f"step {start_step}: this session would train nothing")
 
638
 
639
  # A segment that stopped short of the horizon does not run the validation pass, on every rank.
640
  #
641
+ # Written for what probes v1/v4 saw ("rank 1 exitcode 1, error_file <N/A>, right after a forced stop"),
642
+ # which was attributed to `evaluate()` being entered from a diverged collective state. E-044 later found
643
+ # the actual cause -- the rank-0-only push assertion firing on rank 1 -- so this skip is not what makes
644
+ # the forced-stop leg work. It stays, on its own merits: the held-out PPL of a 762-step segment is not
645
+ # worth a forward pass over 2 M tokens inside a billed session, and §5's per-wake monitoring is served by
646
+ # the training loss. The report's PPL comes from the horizon leg, which is where it is measured.
647
  forced_stop = bool(hub_cb and hub_cb.stopped_at and step < steps_planned)
648
  print(f"[rank {rank}] past the stop guard: forced_stop={forced_stop} "
649
  f"stopped_at={getattr(hub_cb, 'stopped_at', None)}", flush=True)