From ca204f83f889255efbaf467e2e1e16a7d9223d76 Mon Sep 17 00:00:00 2001 From: Charles Martin Date: Sun, 20 Sep 2026 08:59:52 -0700 Subject: [PATCH] Allow Muon continuation to chain from completed extensions --- .../continue_muon_100k.py | 32 ++++++++++++++----- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/baseline/experiments/nanogpt_alpha_memorization/continue_muon_100k.py b/baseline/experiments/nanogpt_alpha_memorization/continue_muon_100k.py index 9d330b5..0acf333 100644 --- a/baseline/experiments/nanogpt_alpha_memorization/continue_muon_100k.py +++ b/baseline/experiments/nanogpt_alpha_memorization/continue_muon_100k.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -"""Continue one completed Muon run from step 10k to 100k without replaying canaries.""" +"""Continue one completed Muon trajectory to any longer horizon without replaying canaries.""" from __future__ import annotations import argparse, copy, json, math, time from collections import Counter @@ -24,14 +24,29 @@ def main(): a=p.parse_args() root=Path(a.root).resolve(); original_cfg=json.loads((root/'protocol.json').read_text()) - start_run=root/'muon'/f'seed_{a.seed}'; source_checkpoint=start_run/'checkpoint_latest.pt' - if not source_checkpoint.exists(): raise FileNotFoundError(source_checkpoint) - source_saved=torch.load(source_checkpoint,map_location='cpu',weights_only=True) - start_step=int(source_saved['step']) - if start_step!=int(original_cfg['steps']): raise ValueError(f'Expected completed checkpoint at {original_cfg["steps"]}, found {start_step}') - if a.target_step<=start_step: raise ValueError('target-step must exceed the source checkpoint step') + start_run=root/'muon'/f'seed_{a.seed}' + if not start_run.exists(): raise FileNotFoundError(start_run) - # Freeze the original 0..5000 canary acquisition schedule while extending only ordinary training. + # Resume the longest completed Muon trajectory below the requested horizon. + # This preserves optimizer state: for example a 1M run starts from the completed + # 100k extension rather than replaying from the original 30k checkpoint. + candidates=[start_run/'checkpoint_latest.pt'] + extensions=root/'extensions' + if extensions.exists(): + for folder in extensions.glob(f'muon_seed_{a.seed}_to_*'): + try: horizon=int(folder.name.rsplit('_to_',1)[1]) + except (IndexError,ValueError): continue + if horizon {a.target_step} on {a.device}',flush=True) + print(f'Source checkpoint: {source_checkpoint}',flush=True) print(f'Canary withdrawal remains frozen at step {data.withdrawal}; no new canary presentations occur.',flush=True) print(f'Original LR schedule length={schedule_steps}; continuation uses the configured minimum LR after schedule end.',flush=True) print(f'Output: {out}',flush=True)