Upload folder using huggingface_hub
Browse filesFiles changed (2)
185 unmodified lines18618718818919019119219319419519619719819920020120220320420567 unmodified lines273274275276277278279280281282283284285286287185 unmodified lineshelp="States are sampled from walks of 1..this many moves. Past ""~20 every state is fully mixed (God's Number), so a larger ""value buys nothing.")p.add_argument("--update-threshold", type=float, default=0.01,help="Refresh the target network once training loss falls below ""this. This is meant to be the binding constraint: it lets ""an easy early target move on fast and gives a harder later ""one as long as it needs. Set it above the loss the net ""actually reaches and it never binds, leaving --min-update-""steps to pin the cadence -- measured at 0.05, the net sat ""at 0.0004 and idled ~800 of every 1000 steps.")p.add_argument("--min-update-steps", type=int, default=200,help="Floor on the refresh interval, so one lucky batch cannot ""ratchet the target forward. Each refresh propagates ""accuracy roughly one move further from solved, so this ""floor times ~30 is the run length; measured re-convergence ""after a refresh is ~200 steps.")p.add_argument("--eval-every", type=int, default=2000)p.add_argument("--eval-n", type=int, default=200)p.add_argument("--eval-depths", default="3,6,10,15,20")67 unmodified linesopt.step()l = loss.item()if l < args.update_threshold and step - last_update >= args.min_update_steps:target_net.load_state_dict(net.state_dict())updates += 1last_update = stepprint(f" step {step}: target net updated (#{updates}, loss {l:.4f})",flush=True)if step % 100 == 0:print(f"step {step}/{args.max_steps} loss {l:.4f} "f"tgt_updates {updates} {step/(time.time()-t0):.1f} it/s", flush=True)if step % args.eval_every == 0 or step == args.max_steps:185 unmodified lines18618718818919019119219319419519619719819920020120220320420520620720820921067 unmodified lines278279280281282283284285286287288289290291292293294295296297298185 unmodified lineshelp="States are sampled from walks of 1..this many moves. Past ""~20 every state is fully mixed (God's Number), so a larger ""value buys nothing.")p.add_argument("--update-threshold", type=float, default=0.15, metavar="MOVES",help="Refresh the target network once the net fits its current ""target to within this mean absolute error, IN MOVES. ""Deliberately not an MSE threshold: target values grow from ""~1 early to ~20 at full distance and MSE scales with their ""square, so the achievable loss floor rises through the run ""and no fixed MSE value works at both ends (measured: 0.0006 ""at step 400, 0.02-0.03 by step 1500). MAE in moves is ""interpretable and roughly scale-stable.")p.add_argument("--min-update-steps", type=int, default=100,help="Floor on the refresh interval, so one lucky batch cannot ""ratchet the target forward.")p.add_argument("--max-update-steps", type=int, default=400,help="Backstop: refresh after this many steps even if the ""threshold is unmet. Each refresh propagates accuracy about ""one move further from solved, so a threshold that stops ""being reachable stalls the frontier outright while training ""still looks healthy -- observed at 1300 steps with no ""refresh. This bounds the run at ~max*30 steps.")p.add_argument("--eval-every", type=int, default=2000)p.add_argument("--eval-n", type=int, default=200)p.add_argument("--eval-depths", default="3,6,10,15,20")67 unmodified linesopt.step()l = loss.item()with torch.no_grad():mae = (pred.float() - y).abs().mean().item()since = step - last_updateready = mae < args.update_threshold and since >= args.min_update_stepsforced = since >= args.max_update_stepsif ready or forced:target_net.load_state_dict(net.state_dict())updates += 1last_update = stepprint(f" step {step}: target net updated (#{updates}, "f"mae {mae:.3f} moves{', forced' if forced and not ready else ''})",flush=True)if step % 100 == 0:print(f"step {step}/{args.max_steps} loss {l:.4f} mae {mae:.3f} "f"tgt_updates {updates} {step/(time.time()-t0):.1f} it/s", flush=True)if step % args.eval_every == 0 or step == args.max_steps:
104 unmodified lines105106107108109110111112104 unmodified lines--hidden "${HIDDEN:-512}" --layers "${LAYERS:-8}" --heads 8 \--batch-size "${BATCH:-1024}" --lr "${LR:-3e-4}" --max-steps "${STEPS:-30000}" \--scramble-depth "${WALK_DEPTH:-30}" \--update-threshold "${UPDATE_THRESHOLD:-0.05}" \--min-update-steps "${MIN_UPDATE_STEPS:-1000}" \--eval-every "${EVAL_EVERY:-1000}" --eval-n "${EVAL_N:-200}" \--out checkpoints/value_iter --hub-repo "${HUB_REPO:-}"echo "=== done ==="104 unmodified lines105106107108109110111112113104 unmodified lines--hidden "${HIDDEN:-512}" --layers "${LAYERS:-8}" --heads 8 \--batch-size "${BATCH:-1024}" --lr "${LR:-3e-4}" --max-steps "${STEPS:-30000}" \--scramble-depth "${WALK_DEPTH:-30}" \--update-threshold "${UPDATE_THRESHOLD:-0.15}" \--min-update-steps "${MIN_UPDATE_STEPS:-100}" \--max-update-steps "${MAX_UPDATE_STEPS:-400}" \--eval-every "${EVAL_EVERY:-1000}" --eval-n "${EVAL_N:-200}" \--out checkpoints/value_iter --hub-repo "${HUB_REPO:-}"echo "=== done ==="
code/train_value_iteration.py+27-16
code/vast_bootstrap.sh+3-2