summaryrefslogtreecommitdiff
path: root/ep_run/t2fix_freezer.py
diff options
context:
space:
mode:
authorYuren Hao <yurenh2@illinois.edu>2026-07-03 05:56:50 -0500
committerYuren Hao <yurenh2@illinois.edu>2026-07-03 05:56:50 -0500
commitb83947778e2c776f757a07d4719b7ce961d7ed55 (patch)
treeb9cc01d7adda691d9156d9d04f4fb2f644674e96 /ep_run/t2fix_freezer.py
Initial commit: ept — backprop-free equilibrium transformer (EP)
Code (ep_run/), organized docs (docs/{method,campaign,hardware,outreach,paper}), analysis scripts (scripts/), ONBOARDING.md entry point. Large data/checkpoints git-ignored (share separately). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014FAPDWQ49M5Ye3NpTndTpn
Diffstat (limited to 'ep_run/t2fix_freezer.py')
-rw-r--r--ep_run/t2fix_freezer.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/ep_run/t2fix_freezer.py b/ep_run/t2fix_freezer.py
new file mode 100644
index 0000000..d5d090f
--- /dev/null
+++ b/ep_run/t2fix_freezer.py
@@ -0,0 +1,21 @@
+import time, os, re, shutil
+os.chdir("/home/yurenh2/ept/ep_run")
+LOG, CK = "runs/ep_t2fix.log", "runs/ep_t2fix.pt"
+os.makedirs("runs/t2fix_traj", exist_ok=True)
+last_mt=0; t0=time.time()
+while time.time()-t0 < 24*3600:
+ time.sleep(30)
+ try: ls=[l for l in open(LOG) if l.startswith("step")]
+ except Exception: continue
+ if not ls: continue
+ m=re.search(r"step\s+(\d+)/.*res=([\d.eE+-]+)", ls[-1])
+ if not m: continue
+ step=int(m.group(1)); res=float(m.group(2))
+ try: mt=os.path.getmtime(CK)
+ except Exception: continue
+ if mt!=last_mt and os.path.getsize(CK)>1e6:
+ last_mt=mt
+ try: shutil.copy2(CK, f"runs/t2fix_traj/s{step}.pt"); print(f"froze s{step} res={res:.2e}",flush=True)
+ except Exception: pass
+ if res>0.25: print(f"ep_t2fix DIVERGED step {step}",flush=True); break
+print("t2fix freezer done")