#!/usr/bin/env python3 """After LR screening, compare the top two methods with PyTorch Muon.""" import json import shutil import time from argparse import Namespace from pathlib import Path import torch from run_distributed_idea_grid import ( SLUG, TokenCorpus, distributed_run, write_json, GPTConfig, ) ROOT=Path("/workspace/experiments/distributed_idea_grid") K=16 SEED=16384 MUON_LR=0.02 def read_json(path): return json.loads(path.read_text(encoding="utf-8")) def wait_for_lr_sweep(): root_results=ROOT/"results.json" lr_results=ROOT/"lr_sweep"/"lr_sweep_results.json" status=ROOT/"muon_progress.json" while True: if root_results.exists() and lr_results.exists(): try: root=read_json(root_results) sweep=read_json(lr_results) if root.get("lr_sweep_complete") and sweep.get("selection_complete"): return root,sweep except (json.JSONDecodeError,OSError): pass write_json(status,{"stage":"waiting_for_lr_sweep","checked_unix":time.time()}) time.sleep(30) def main(): print("Waiting for LR sweep to finish...",flush=True) root_results,sweep=wait_for_lr_sweep() by_method={} for row in sweep["runs"]: current=by_method.get(row["method"]) if current is None or row["best_full_val_loss"]