matCercola18 commited on
Commit
c4be3a9
·
verified ·
1 Parent(s): e91d8e7

Backup of files only on andromeda (models, results, banks, logs) (1/11)

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. andromeda_variants/hardware/qube/demo/demo_render2.py +287 -0
  2. andromeda_variants/nonlinear/experiments/x21_eval.py +163 -0
  3. andromeda_variants/results/icml_r2/C_mimo/logs/train_asinh_diff_s0.log +24 -0
  4. andromeda_variants/results/icml_r2/C_mimo/logs/train_asinh_diff_s1.log +24 -0
  5. andromeda_variants/results/icml_r2/C_mimo/logs/train_asinh_diff_s2.log +24 -0
  6. andromeda_variants/results/icml_r2/C_mimo/logs/train_asinh_reg_s0.log +24 -0
  7. andromeda_variants/results/icml_r2/C_mimo/logs/train_asinh_reg_s1.log +24 -0
  8. andromeda_variants/results/icml_r2/C_mimo/logs/train_asinh_reg_s2.log +24 -0
  9. andromeda_variants/results/icml_r2/D2_scale/logs/train_d3m3n8000_diff_s0.log +6 -0
  10. andromeda_variants/results/icml_r2/D2_scale/logs/train_d3m3n8000_diff_s1.log +6 -0
  11. andromeda_variants/results/icml_r2/D2_scale/logs/train_d3m3n8000_diff_s2.log +6 -0
  12. andromeda_variants/results/icml_r2/D2_scale/logs/train_d3m3n8000_reg_s0.log +6 -0
  13. andromeda_variants/results/icml_r2/D2_scale/logs/train_d3m3n8000_reg_s1.log +6 -0
  14. andromeda_variants/results/icml_r2/D2_scale/logs/train_d3m3n8000_reg_s2.log +6 -0
  15. andromeda_variants/results/icml_r2/D2_scale/logs/train_d3m4n8000_diff_s0.log +6 -0
  16. andromeda_variants/results/icml_r2/D2_scale/logs/train_d3m4n8000_diff_s1.log +6 -0
  17. andromeda_variants/results/icml_r2/D2_scale/logs/train_d3m4n8000_reg_s0.log +6 -0
  18. andromeda_variants/results/icml_r2/D2_scale/logs/train_d3m4n8000_reg_s1.log +6 -0
  19. andromeda_variants/results/icml_r3/X1F/FROZEN.json +231 -0
  20. andromeda_variants/results/icml_r3/X1S/sample_x3.sh +8 -0
  21. andromeda_variants/results/icml_r3/X21/val/x21_fgen_clL_best_w1_tr.npz +3 -0
  22. andromeda_variants/witsenhausen/e1_bank.py +139 -0
  23. andromeda_variants/witsenhausen/vector_2026_10_19/eval_b.py +120 -0
  24. andromeda_variants/witsenhausen/vector_2026_10_19/v2_lattice/make_table.py +15 -0
  25. cbar.log +0 -0
  26. cbar_eval.log +19 -0
  27. costcond.log +18 -0
  28. data/x2_bank2x.npz +3 -0
  29. data/x2_bank3000.npz.keep_idx.npy +3 -0
  30. data/x2_bank3000.npz.state.pkl +3 -0
  31. data/x2_bank_b.npz +3 -0
  32. data/x2_bank_b.npz.keep_idx.npy +3 -0
  33. data/x2_bank_b.npz.partial.npz +3 -0
  34. data/x2_bank_b.npz.state.pkl +3 -0
  35. logs/train_f2L_s0.log +6 -0
  36. logs/train_f2L_s1.log +6 -0
  37. logs/train_f2L_s2.log +6 -0
  38. logs/train_f2_4c_s2.log +2 -0
  39. logs/train_f2_s2.log +5 -0
  40. models/Last_pend_cbar.pth +3 -0
  41. models/mimou/asinh_diff_s0_resume.pt +3 -0
  42. models/mimou/asinh_diff_s1_resume.pt +3 -0
  43. models/mimou/asinh_diff_s2_resume.pt +3 -0
  44. models/mimou/asinh_reg_s0_resume.pt +3 -0
  45. models/mimou/asinh_reg_s1_resume.pt +3 -0
  46. models/mimou/asinh_reg_s2_resume.pt +3 -0
  47. models/mimou/c3a_diff_s0_resume.pt +3 -0
  48. models/mimou/c3a_diff_s1_resume.pt +3 -0
  49. models/mimou/c3a_diff_s2_resume.pt +3 -0
  50. models/mimou/c3a_reg_s0_resume.pt +3 -0
andromeda_variants/hardware/qube/demo/demo_render2.py ADDED
@@ -0,0 +1,287 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+ """Demo video v2 (camera + control plots + live result tiles) and the static paper-style control figure, from one take.
3
+ python demo_render2.py TAKE_DIR [--video FILE] [--run RUN_DIR] [--sync auto|motion|led] [--crop x,y,w,h] [--slow 0.25] [--out NAME]
4
+ Sync: (1) motion energy of the video is matched to the logged |theta_dot|+|alpha_dot| (works with any camera, no LED needed);
5
+ (2) the QUBE LED turning green at start() (needs the LED in view and the epoch-stamped hw_stdout.txt). Both are printed.
6
+ Design: dark surface, Ubuntu type scale, 8 px grid, dataviz dark categorical slots for the three traces, neutral phase tints,
7
+ stat tiles that fill in live, eased fades between title card / run / result card."""
8
+ import argparse, csv, json, math, re, subprocess, sys
9
+ from pathlib import Path
10
+ import numpy as np, cv2
11
+ import matplotlib; matplotlib.use("Agg")
12
+ import matplotlib.pyplot as plt
13
+ import matplotlib.font_manager as fm
14
+ from PIL import Image, ImageDraw, ImageFont
15
+
16
+ ap = argparse.ArgumentParser()
17
+ ap.add_argument("take"); ap.add_argument("--video"); ap.add_argument("--run"); ap.add_argument("--crop"); ap.add_argument("--slow", type=float, default=0.25)
18
+ ap.add_argument("--sync", default="auto"); ap.add_argument("--go-video", type=float); ap.add_argument("--gen-s", type=float); ap.add_argument("--k", type=int)
19
+ ap.add_argument("--variant", default="computed", choices=["computed", "gengains"]); ap.add_argument("--out", default="demo"); ap.add_argument("--no-video", action="store_true")
20
+ a = ap.parse_args(); T = Path(a.take); T.mkdir(parents=True, exist_ok=True)
21
+ ROOT = Path.home() / "qube/matte_server/DiffusionControl"; FPS, W, H = 30, 1920, 1080; LEDGAP = 0.25
22
+
23
+ # ---------------------------------------------------------------- inputs
24
+ run_dir = Path(a.run) if a.run else None; P = G = None
25
+ if (T / "hw_stdout.txt").exists():
26
+ L = [(float(l.split(" ", 1)[0]), l.split(" ", 1)[1].rstrip("\n")) for l in open(T / "hw_stdout.txt") if " " in l]
27
+ P = next((e for e, t in L if "voltage-sign probe" in t), None); G = next((e for e, t in L if t.strip().endswith("GO.")), None)
28
+ m = next((re.search(r"saved (\S+)", t) for e, t in L if "saved hardware" in t), None)
29
+ if m and run_dir is None: run_dir = ROOT / m.group(1)
30
+ video = Path(a.video) if a.video else T / "cam.mkv"
31
+ gen_s, kc, kok = a.gen_s, a.k, None
32
+ if gen_s is None and (T / "gen_epochs.txt").exists():
33
+ g0, g1 = map(float, open(T / "gen_epochs.txt").read().split()); gen_s = g1 - g0
34
+ if kc is None and (T / "gen_stdout.txt").exists():
35
+ mm = re.search(r"\((\d+)/(\d+) cands\)", open(T / "gen_stdout.txt").read()); kc = int(mm.group(2)) if mm else None; kok = int(mm.group(1)) if mm else None
36
+ assert run_dir is not None and run_dir.exists(), "no run folder"
37
+ S = json.load(open(run_dir / "summary.json")); R = list(csv.DictReader(open(run_dir / "log.csv")))
38
+ col = lambda k: np.array([float(r[k]) for r in R])
39
+ t = col("t"); th = np.degrees(col("theta")); al = np.degrees(col("alpha_wrapped")); V = col("V")
40
+ act = np.degrees(np.abs(col("theta_dot"))) + np.degrees(np.abs(col("alpha_dot")))
41
+ tc = float(S["t_catch"]); tend = float(t[-1])
42
+ print("run", run_dir.name, "caught", S["caught"], "t_catch", tc, "max|theta| %.1f" % S["max_abs_theta_deg"], "gen_s", gen_s, "K", kc)
43
+
44
+ # ---------------------------------------------------------------- tokens (dark surface, dataviz dark categorical slots 1-3)
45
+ BG, PANEL, BORDER = (14, 17, 22), (21, 26, 33), (40, 48, 58)
46
+ INK, INK2, INK3 = (242, 244, 247), (170, 178, 189), (123, 132, 144)
47
+ SER = {"th": (57, 135, 229), "al": (217, 89, 38), "v": (25, 158, 112)} # blue, orange, aqua (dark steps)
48
+ hexc = lambda c: "#%02x%02x%02x" % c
49
+ FD = "/usr/share/fonts/truetype/ubuntu/"
50
+ def F(sz, w="R"):
51
+ try: return ImageFont.truetype(FD + f"Ubuntu-{w}.ttf", sz)
52
+ except Exception: return ImageFont.truetype(fm.findfont(fm.FontProperties(family="DejaVu Sans")), sz)
53
+ for f in ("Ubuntu-R.ttf", "Ubuntu-M.ttf"):
54
+ try: fm.fontManager.addfont(FD + f)
55
+ except Exception: pass
56
+
57
+ # ---------------------------------------------------------------- static control figure (paper mode, house style)
58
+ def static_figure():
59
+ sys.path.insert(0, str(Path.home() / "qube"))
60
+ from plotstyle import set_style, save_figure, figsize, top_legend, C
61
+ from matplotlib.lines import Line2D
62
+ set_style()
63
+ fig, ax = plt.subplots(3, 1, figsize=figsize(cols=1, ratio=1.45), sharex=True)
64
+ ST = {"th": ("arm angle $\\theta$", C.blue), "al": ("pendulum angle $\\alpha$ from upright", C.orange), "v": ("motor voltage $V$", C.teal)}
65
+ ax[0].plot(t, th, color=ST["th"][1], lw=1.2); ax[1].plot(t, np.where(np.r_[False, np.abs(np.diff(al)) > 200], np.nan, al), color=ST["al"][1], lw=1.2)
66
+ ax[2].plot(t, V, color=ST["v"][1], lw=1.2)
67
+ for x in ax: x.axvline(tc, color=C.gray, ls="--", lw=0.8)
68
+ ax[2].axhline(10, color=C.gray, ls=":", lw=0.8); ax[2].axhline(-10, color=C.gray, ls=":", lw=0.8)
69
+ ax[0].set_ylabel("arm angle $\\theta$ (deg)"); ax[1].set_ylabel("pendulum $\\alpha$ (deg)"); ax[2].set_ylabel("motor voltage (V)")
70
+ ax[2].set_xlabel("time since swing-up start (s)"); ax[2].set_xlim(0, tend)
71
+ hs = [Line2D([0], [0], color=ST[k][1], lw=1.2, label=ST[k][0]) for k in ("th", "al", "v")]
72
+ hs += [Line2D([0], [0], color=C.gray, ls="--", lw=0.8, label="catch instant"), Line2D([0], [0], color=C.gray, ls=":", lw=0.8, label="voltage limit $\\pm$10 V")]
73
+ top_legend(fig, hs, ncol=2); save_figure(fig, f"{a.out}_control_plots", outdir=str(T / "figures"))
74
+ try: static_figure()
75
+ except Exception as e: print("static figure FAILED:", repr(e))
76
+ plt.rcdefaults()
77
+ if a.no_video: sys.exit(0)
78
+
79
+ # ---------------------------------------------------------------- video analysis pass 1: timestamps, LED, motion energy, red variance
80
+ pts = np.sort(np.array([float(x) for x in subprocess.run(["ffprobe", "-v", "error", "-select_streams", "v:0", "-show_entries", "packet=pts_time", "-of", "csv=p=0", str(video)], capture_output=True, text=True).stdout.split()]))
81
+ cap = cv2.VideoCapture(str(video)); nb, ng, mot = [], [], []; s1 = s2 = prev = None; i = 0; SW = 480
82
+ while True:
83
+ ok, f = cap.read()
84
+ if not ok: break
85
+ if i == 0: H0, W0 = f.shape[:2]; SH = int(SW * H0 / W0)
86
+ sm = cv2.resize(f, (SW, SH), interpolation=cv2.INTER_AREA); hsv = cv2.cvtColor(sm, cv2.COLOR_BGR2HSV)
87
+ m_ = (hsv[..., 1] > 110) & (hsv[..., 2] > 140); h_ = hsv[..., 0]
88
+ nb.append(int((m_ & (h_ > 100) & (h_ < 130)).sum())); ng.append(int((m_ & (h_ > 45) & (h_ < 85)).sum()))
89
+ red = (((hsv[..., 1] > 90) & (hsv[..., 2] > 70)) & ((h_ < 8) | (h_ > 170))).astype(np.float32); s1 = red if s1 is None else s1 + red; s2 = red * red if s2 is None else s2 + red * red
90
+ g = cv2.cvtColor(sm, cv2.COLOR_BGR2GRAY).astype(np.float32); mot.append(0.0 if prev is None else float(np.abs(g - prev).mean())); prev = g; i += 1
91
+ cap.release(); n = min(i, len(pts)); pts = pts[:n]; nb, ng, mot = np.array(nb[:n]), np.array(ng[:n]), np.array(mot[:n])
92
+ src_fps = (n - 1) / max(pts[-1] - pts[0], 1e-6); print("video: %dx%d, %d frames, %.1f fps, %.1f s" % (W0, H0, n, src_fps, pts[-1] - pts[0]))
93
+
94
+ go_led = go_mot = None
95
+ if P is not None and G is not None:
96
+ base = np.median(ng[:max(5, int(1.5 * src_fps))]); thr = base + max(30, 0.5 * (ng.max() - base))
97
+ if ng.max() > thr and (ng > thr).any() and base < 0.25 * ng.max(): go_led = pts[int(np.argmax(ng > thr))] + (G - (P - LEDGAP)); print(" LED sync: GO at video %.2f s" % go_led)
98
+ else: print(" LED sync: not usable (LED already green at the start, or no green onset)")
99
+ ms = np.convolve(mot, np.ones(3) / 3, mode="same"); ms = ms - ms.mean()
100
+ def motion_search(lo, hi):
101
+ best = (-2.0, None)
102
+ for g0 in np.arange(lo, hi, 0.01):
103
+ aa = np.interp(pts - g0, t, act, left=0.0, right=0.0); aa = aa - aa.mean(); d = np.linalg.norm(aa) * np.linalg.norm(ms)
104
+ c = float(aa @ ms / d) if d > 1e-9 else -1.0
105
+ if c > best[0]: best = (c, g0)
106
+ return best
107
+ hint = None # start-of-recording clock (container creation_time) vs GO epoch: +-3.5 s window
108
+ try:
109
+ ct = subprocess.run(["ffprobe", "-v", "error", "-show_entries", "format_tags=creation_time", "-of", "default=nw=1:nk=1", str(video)], capture_output=True, text=True).stdout.strip()
110
+ if ct and G is not None:
111
+ import datetime as _dt
112
+ e0 = _dt.datetime.strptime(ct.split(".")[0].rstrip("Z"), "%Y-%m-%dT%H:%M:%S").replace(tzinfo=_dt.timezone.utc).timestamp(); hint = G - e0
113
+ print(" container creation_time %s -> hint: GO at video ~%.1f s (clock-rounded; +-3.5 s)" % (ct, hint))
114
+ except Exception as e: print(" no creation_time hint:", repr(e))
115
+ if go_led is not None: win, wname = (go_led - 0.7, go_led + 0.7), "LED +-0.7 s"
116
+ elif hint is not None and 0 <= hint <= pts[-1] + 3: win, wname = (hint - 3.5, hint + 3.5), "creation_time hint +-3.5 s"
117
+ else: win, wname = (pts[0] - 0.6 * tend, pts[-1] - 0.4 * tend), "whole clip"
118
+ bc, go_mot = motion_search(*win); print(" motion sync (window: %s): GO at video %.2f s (correlation %.2f)" % (wname, go_mot, bc))
119
+ if a.go_video is not None: go_v = a.go_video; how = "given"
120
+ elif a.sync == "led" and go_led is not None: go_v, how = go_led, "LED"
121
+ elif go_led is not None and bc < 0.2: go_v, how = go_led, "LED (motion match weak)"
122
+ elif a.sync == "motion" or go_led is None: go_v, how = go_mot, "motion"
123
+ else: go_v, how = go_mot, "motion (refines LED)"
124
+ def onset_refine(gv):
125
+ q = (pts > gv - 1.8) & (pts < gv - 0.7)
126
+ if q.sum() < 8: return None
127
+ b = np.median(mot[q]); sd = 1.4826 * np.median(np.abs(mot[q] - b)) + 1e-6
128
+ for i in np.nonzero((pts >= gv - 0.4) & (pts <= gv + 0.4))[0]:
129
+ if i + 1 < n and mot[i] > b + 3 * sd and mot[i + 1] > b + 2 * sd: return float(pts[i] - 0.5 / src_fps)
130
+ return None
131
+ if a.go_video is None and how.startswith("motion"):
132
+ go_on = onset_refine(go_v)
133
+ if go_on is not None: print(" onset (first frame above the noise): GO at video %.3f s (correlation estimate %.3f)" % (go_on, go_v)); go_v, how = go_on, "motion onset"
134
+ if go_led is not None: print(" LED vs motion differ by %.0f ms" % (1000 * abs(go_led - go_mot)))
135
+ if bc < 0.2: print(" WARNING: weak motion match; check the sync visually")
136
+ print("GO in video: %.2f s (%s)" % (go_v, how))
137
+
138
+ # crop (4:3) around the moving red parts unless given
139
+ PORT = H0 > W0 # portrait clip: show the full original frame in a tall panel (no crop)
140
+ PW, PH = (495, 880) if PORT else (1040, 780)
141
+ if a.crop: x0, y0, cw, ch = map(int, a.crop.split(","))
142
+ elif PORT: x0, y0, cw, ch = 0, 0, W0, H0
143
+ else:
144
+ var = s2 / max(n, 1) - (s1 / max(n, 1)) ** 2; mask = (var > 0.02).astype(np.uint8)
145
+ mask = cv2.morphologyEx(mask, cv2.MORPH_OPEN, np.ones((3, 3), np.uint8)); bx, by, bw, bh = cv2.boundingRect(mask) if mask.any() else (SW // 4, SH // 4, SW // 2, SH // 2)
146
+ sx = W0 / SW; xl, xh, yl, yh = bx * sx, (bx + bw) * sx, by * sx, (by + bh) * sx # full extent of everything that moved and is red
147
+ if H0 > W0: # portrait clip: keep the full width the operator framed, trim the empty wall/table
148
+ cw = float(W0); ch = cw * 3 / 4
149
+ if (yh - yl) * 1.08 > ch: ch = min((yh - yl) * 1.08, H0); cw = ch * 4 / 3 if ch * 4 / 3 <= W0 else float(W0); ch = cw * 3 / 4 if ch * 4 / 3 > W0 else ch
150
+ else:
151
+ ch = max((yh - yl) * 1.25, (xh - xl) * 1.25 * 3 / 4, 0.3 * H0); cw = ch * 4 / 3
152
+ if cw > W0: cw = W0; ch = cw * 3 / 4
153
+ if ch > H0: ch = H0; cw = ch * 4 / 3
154
+ x0 = int(np.clip((xl + xh) / 2 - cw / 2, 0, W0 - cw)); y0 = int(np.clip((yl + yh) / 2 - ch / 2, 0, H0 - ch)); cw, ch = int(cw), int(ch)
155
+ if H0 > W0: y0 = int(np.clip(yl - 0.05 * ch, 0, H0 - ch)) # portrait: align to the top of the pendulum's travel (the base strip skews the bottom)
156
+ print(" moved-red extent x %d-%d, y %d-%d" % (xl, xh, yl, yh))
157
+ print("crop x,y,w,h =", x0, y0, cw, ch)
158
+
159
+ # ---------------------------------------------------------------- timeline (pre real-time, slow-mo swing-up, post real-time)
160
+ PRE, POST = 1.4, 0.3
161
+ def seg(t0, t1, speed):
162
+ k = max(2, int(round((t1 - t0) / speed * FPS))); return list(t0 + (np.arange(k) / k) * (t1 - t0))
163
+ slow_a, slow_b = -0.25, min(1.3, tend)
164
+ TAU = seg(-PRE, slow_a, 1.0) + seg(slow_a, slow_b, a.slow) + seg(slow_b, tend + POST, 1.0)
165
+ # pass 2: keep only the source frames that the timeline needs (nearest two per output frame)
166
+ need = set()
167
+ for tau in TAU:
168
+ j1 = int(np.clip(np.searchsorted(pts, go_v + tau), 1, n - 1)); need.update((j1 - 1, j1))
169
+ cap = cv2.VideoCapture(str(video)); keep = {}; j = 0
170
+ while j < n:
171
+ ok, f = cap.read()
172
+ if not ok: break
173
+ if j in need: keep[j] = cv2.resize(f[y0:y0 + ch, x0:x0 + cw], (PW, PH), interpolation=cv2.INTER_AREA)
174
+ j += 1
175
+ cap.release(); print("kept %d source frames for %d output frames" % (len(keep), len(TAU)))
176
+ def video_frame(tau):
177
+ j1 = int(np.clip(np.searchsorted(pts, go_v + tau), 1, n - 1)); j0 = j1 - 1
178
+ if j0 not in keep or j1 not in keep: return np.zeros((PH, PW, 3), np.uint8)
179
+ w = float(np.clip((go_v + tau - pts[j0]) / max(pts[j1] - pts[j0], 1e-6), 0, 1))
180
+ return keep[j1] if (src_fps >= 100 and w > 0.5) else (keep[j0] if src_fps >= 100 else cv2.addWeighted(keep[j0], 1 - w, keep[j1], w, 0))
181
+
182
+ # ---------------------------------------------------------------- plot panel (small multiples, labels above each axis)
183
+ PLW, PLH = (W - 48 - (48 + PW + 40), 580) if PORT else (744, 570)
184
+ fig = plt.figure(figsize=(PLW / 100, PLH / 100), dpi=100, facecolor=hexc(PANEL))
185
+ rect = lambda y: [0.085, y, 0.895, 0.185]
186
+ axs = [fig.add_axes(rect(0.735)), fig.add_axes(rect(0.435)), fig.add_axes(rect(0.135))]
187
+ XL = (-0.2, tend + 0.05); YL = [(min(-30.0, th.min() - 6), max(75.0, th.max() + 8)), (-195, 195), (-11.5, 11.5)]
188
+ names = ["Arm angle θ (deg)", "Pendulum angle α from upright (deg)", "Motor voltage (V)"]
189
+ for k, ax in enumerate(axs):
190
+ ax.set_facecolor(hexc(PANEL)); ax.set_xlim(*XL); ax.set_ylim(*YL[k])
191
+ for sp in ("top", "right"): ax.spines[sp].set_visible(False)
192
+ for sp in ("left", "bottom"): ax.spines[sp].set_color(hexc(INK3)); ax.spines[sp].set_linewidth(1)
193
+ ax.tick_params(colors=hexc(INK2), labelsize=14, length=3, width=1); ax.grid(alpha=0.14, color=hexc(INK3), lw=0.8)
194
+ ax.axvspan(0, tc, color="white", alpha=0.055, lw=0); ax.axvline(tc, color=hexc(INK3), ls=(0, (4, 3)), lw=1.2)
195
+ ax.set_yticks(([0, 50] if k == 0 else [-180, 0, 180] if k == 1 else [-10, 0, 10]))
196
+ if k < 2: ax.tick_params(labelbottom=False)
197
+ fig.text(0.085, rect([0.735, 0.435, 0.135][k])[1] + 0.185 + 0.012, names[k], color=hexc(INK2), fontsize=15, family="Ubuntu", va="bottom")
198
+ for yv in (10, -10): axs[2].axhline(yv, color=hexc(INK3), ls=":", lw=1.1)
199
+ axs[2].set_xlabel("time since swing-up start (s)", color=hexc(INK2), fontsize=15, family="Ubuntu")
200
+ fig.text(0.985, 0.955, "swing-up | balance", color=hexc(INK3), fontsize=12, family="Ubuntu", ha="right", va="top")
201
+ fig.canvas.draw(); base_panel = cv2.cvtColor(np.asarray(fig.canvas.buffer_rgba())[..., :3], cv2.COLOR_RGB2BGR); Hp = base_panel.shape[0]
202
+ def px(k, x, y):
203
+ X, Y = axs[k].transData.transform((x, y)); return int(round(X)), int(round(Hp - Y))
204
+ PTS = [np.array([px(0, x, y) for x, y in zip(t, th)]), np.array([px(1, x, y) for x, y in zip(t, al)]), np.array([px(2, x, y) for x, y in zip(t, V)])]
205
+ WRAP = np.nonzero(np.abs(np.diff(al)) > 200)[0] + 1
206
+ BGR = {k: SER[k][::-1] for k in SER}; PBGR = PANEL[::-1]
207
+ def panel_at(tau):
208
+ p = base_panel.copy()
209
+ if tau >= 0:
210
+ nn = int(np.searchsorted(t, tau, side="right"))
211
+ for k, key in enumerate(("th", "al", "v")):
212
+ arr = PTS[k][:nn]; cuts = [0] + [int(b) for b in WRAP if k == 1 and b < nn] + [nn]
213
+ for c0, c1 in zip(cuts[:-1], cuts[1:]):
214
+ if c1 - c0 >= 2: cv2.polylines(p, [arr[c0:c1].reshape(-1, 1, 2)], False, BGR[key], 3, cv2.LINE_AA)
215
+ if nn >= 1:
216
+ pt = tuple(int(v) for v in PTS[k][min(nn, len(t)) - 1]); cv2.circle(p, pt, 10, PBGR, -1, cv2.LINE_AA); cv2.circle(p, pt, 8, BGR[key], -1, cv2.LINE_AA)
217
+ xc = px(0, min(max(tau, XL[0]), XL[1]), 0)[0]
218
+ cv2.line(p, (xc, int(Hp * 0.06)), (xc, int(Hp * 0.865)), INK[::-1], 1, cv2.LINE_AA)
219
+ return Image.fromarray(cv2.cvtColor(p, cv2.COLOR_BGR2RGB))
220
+
221
+ # ---------------------------------------------------------------- layout (8 px grid): header, video, right column (plots + tiles), footer
222
+ MX, TOP = 48, (150 if PORT else 168); VX, VY = MX, TOP; RX = VX + PW + 40; RW = W - MX - RX
223
+ gen_txt = ("plan generated on this workstation in %.0f s" % gen_s + ((" (%d of %d samples certified, GTX 1650)" % (kok, kc)) if (kc and kok is not None) else (" (%d samples, GTX 1650)" % kc if kc else ""))) if gen_s else "plan generated on this workstation"
224
+ def rr(d, box, r, fill, outline=None, width=2): d.rounded_rectangle(box, radius=r, fill=fill, outline=outline, width=width)
225
+ vmask = Image.new("L", (PW, PH), 0); ImageDraw.Draw(vmask).rounded_rectangle((0, 0, PW - 1, PH - 1), radius=20, fill=255)
226
+ bg = Image.new("RGB", (W, H), BG); d = ImageDraw.Draw(bg)
227
+ d.text((MX, 44), "Diffusion-generated swing-up control", font=F(48, "B"), fill=INK)
228
+ d.text((MX, 108), "Rotary inverted pendulum (QUBE-Servo 2) · " + gen_txt, font=F(26), fill=INK2)
229
+ rr(d, (VX - 2, VY - 2, VX + PW + 1, VY + PH + 1), 22, None, BORDER, 2)
230
+ rr(d, (RX, TOP, RX + RW, TOP + PLH + 16), 20, PANEL, BORDER, 2)
231
+ TY = TOP + PLH + 16 + 24; TH_ = 170 if PORT else PH - (PLH + 16 + 24) # tile row
232
+ tw = (RW - 3 * 16) // 4
233
+ def ease(x): x = float(np.clip(x, 0, 1)); return x * x * (3 - 2 * x)
234
+
235
+ def tiles(tau, im):
236
+ d = ImageDraw.Draw(im)
237
+ nn = int(np.searchsorted(t, tau, side="right")) if tau >= 0 else 0
238
+ vals = [("catch time", ("%.2f s" % tc) if tau >= tc else "—", INK if tau >= tc else INK3),
239
+ ("peak arm angle", ("%.0f°" % np.abs(th[:nn]).max()) if nn else "—", INK if nn else INK3),
240
+ ("peak voltage", ("%.1f V" % np.abs(V[:nn]).max()) if nn else "—", INK if nn else INK3),
241
+ ("control loop", "%d Hz" % int(S.get("rate", 500)), INK)]
242
+ for i, (lab, val, c) in enumerate(vals):
243
+ x = RX + i * (tw + 16); rr(d, (x, TY, x + tw, TY + TH_), 16, PANEL, BORDER, 2)
244
+ d.text((x + 16, TY + 12), lab, font=F(20), fill=INK3); d.text((x + 16, TY + 12 + 38), val, font=F(38, "M"), fill=c)
245
+
246
+ def chip(tau, im):
247
+ d = ImageDraw.Draw(im)
248
+ txt, dot = ("Resetting: arm centred, pendulum settling", INK3) if tau < 0 else (("Swing-up: generated voltage plan + generated tracking gains" if a.variant == "gengains" else "Swing-up: generated voltage plan + tracking feedback (TVLQR)") if tau < tc else ("Balance: generated gain K, inside the certified catch region"), INK)
249
+ f = F(26, "M"); wd = d.textlength(txt, font=f); CX = RX if PORT else VX; y0c = (TY + TH_ + 28) if PORT else (VY + PH + 24)
250
+ rr(d, (CX, y0c, CX + wd + 72, y0c + 52), 26, PANEL, BORDER, 2); d.ellipse((CX + 20, y0c + 18, CX + 36, y0c + 34), fill=dot); d.text((CX + 52, y0c + 10), txt, font=f, fill=INK)
251
+ note = "t = %+.2f s" % tau + ((" slow motion ×%.2f" % a.slow) if slow_a <= tau < slow_b else "")
252
+ d.text((CX + wd + 72 + 28, y0c + 13), note, font=F(24), fill=INK2)
253
+
254
+ def compose(tau):
255
+ im = bg.copy(); im.paste(Image.fromarray(cv2.cvtColor(video_frame(tau), cv2.COLOR_BGR2RGB)), (VX, VY), vmask)
256
+ im.paste(panel_at(tau), (RX + 0, TOP + 8)); tiles(tau, im); chip(tau, im); return im
257
+
258
+ def card(lines, fade=1.0):
259
+ im = Image.new("RGB", (W, H), BG); d = ImageDraw.Draw(im); y = 230
260
+ for txt, sz, w, c, gap in lines:
261
+ cc = tuple(int(BG[i] + (c[i] - BG[i]) * fade) for i in range(3)); d.text((160, y), txt, font=F(sz, w), fill=cc); y += gap
262
+ return im
263
+ dots = lambda im, ys, c=SER: None
264
+ GEN = a.variant == "gengains"
265
+ gen_fn = ("%d samples in 38 ms on the GPU; %.0f s in total including verification on the CPU" % (kc, gen_s)) if (kc == 8 and gen_s and not GEN) else (("%.0f s in total including the certificate and simulation checks on the CPU" % gen_s) if gen_s else "")
266
+ intro_lines = [("Diffusion-generated", 92, "B", INK, 108), ("swing-up control", 92, "B", INK, 150), ("A rotary inverted pendulum, QUBE-Servo 2", 36, "R", INK2, 90),
267
+ ("A diffusion model, conditioned on the measured pendulum, generates " + ("the complete controller:" if GEN else "the controller:"), 32, "R", INK, 46),
268
+ (("the swing-up voltage plan, the tracking gains, the balance gain and the catch region" if GEN else "the swing-up voltage plan, its duration, the balance gain and the catch region"), 30, "R", INK2, 62),
269
+ ("Each sample is checked by its certificate and in simulation before it runs", 32, "R", INK, 52), ("It then runs on the real hardware at 500 Hz, up to 10 V", 32, "R", INK, 76),
270
+ (gen_txt, 28, "M", SER["th"], 44), (gen_fn, 26, "R", INK3, 0)]
271
+ outro_lines = [("Pendulum caught", 40, "R", INK2, 70), ("%.2f s" % tc, 150, "B", INK, 190),
272
+ ("peak arm angle %.0f° · voltage limit 10 V · no safety stop" % S["max_abs_theta_deg"], 32, "R", INK, 70), (gen_txt, 28, "M", SER["th"], 0)]
273
+
274
+ out = T / f"{a.out}.mp4"
275
+ ff = subprocess.Popen(["ffmpeg", "-y", "-loglevel", "error", "-f", "rawvideo", "-pix_fmt", "bgr24", "-s", f"{W}x{H}", "-r", str(FPS), "-i", "-",
276
+ "-c:v", "libx264", "-preset", "medium", "-crf", "17", "-pix_fmt", "yuv420p", str(out)], stdin=subprocess.PIPE)
277
+ wr = lambda im: ff.stdin.write(cv2.cvtColor(np.asarray(im), cv2.COLOR_RGB2BGR).tobytes())
278
+ NI, NO, XF = int(2.6 * FPS), int(3.2 * FPS), 12
279
+ for k in range(NI): wr(card(intro_lines, ease(k / (0.6 * FPS))))
280
+ first = compose(TAU[0]); icard = card(intro_lines)
281
+ for k in range(XF): wr(Image.blend(icard, first, ease((k + 1) / XF)))
282
+ for tau in TAU[1:-XF]: wr(compose(tau))
283
+ last = compose(TAU[-1]); ocard = card(outro_lines)
284
+ for tau in TAU[-XF:-1]: wr(compose(tau))
285
+ for k in range(XF): wr(Image.blend(last, ocard, ease((k + 1) / XF)))
286
+ for k in range(NO): wr(ocard)
287
+ ff.stdin.close(); ff.wait(); print("video ->", out, "%.1f s" % ((NI + len(TAU) + NO + XF * 2) / FPS))
andromeda_variants/nonlinear/experiments/x21_eval.py ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """X21 validation of an F-generator checkpoint on the 40 X20 pilot plants (seed 7171, disjoint from the X21 training plants).
2
+
3
+ Per plant: K filters sampled with c = 0 (ask for the plant's best), phi = sat_1. A candidate counts iff F is stable with the
4
+ dataset's margin (f_ok, 0.01) and the loop is certified at the pilot's s1 = 0.5 sigma_p (regional circle criterion, rstar);
5
+ certified candidates are costed at x0 = s1 D (siso_x19 cost_batch). Best-of-b (b = 1, 4, 16) is compared with the F-only
6
+ per-plant optimum (X20b), the joint (F, phi) reference and the tuned linear baselines (X20 J_lin).
7
+
8
+ Run: PYTHONPATH=. python -m nonlinear.experiments.x21_eval <ckpt.pth> [guidance ...] (guidance 1 = conditional only)
9
+ <ckpt.pth> may also be retrieval, retrieval_cl or bl:<arm> (X22 baselines, x21_baselines.py).
10
+ Env: X21_EVAL_WORKERS (default 16), X21_K (samples per plant, default 16), X21_TREPAIR=1 (null-space F repair). Appends one block per (ckpt, guidance) to results/icml_r3/X21/val_report.txt (X21_REPORT overrides).
11
+ X21_TEST=1: the fresh test set instead (stage testset, seed 8282; J_fonly = best label, J_lin = min(static gain, tuned
12
+ LQG), no joint reference) -> results/icml_r3/X21/test/ and test_report.txt.
13
+ """
14
+ import os, sys, time, types, glob
15
+ import numpy as np
16
+ import torch
17
+ import concurrent.futures as cf
18
+ from diffusers import DDPMScheduler
19
+ from utils.models.ConditionalDiffusion_mlp import ReverseDiffusionModel
20
+ from utils.samplers import sample_diffusion
21
+ from nonlinear.experiments import siso_x20_unstable as X
22
+ from nonlinear.training.train_x21 import islog, slog, cl_decode, cl_encode, sylvester
23
+
24
+ K, SEED, OUT = int(os.environ.get("X21_K", 16)), 4242, "results/icml_r3/X21/val"
25
+ TEST = os.environ.get("X21_TEST") == "1"
26
+ if TEST:
27
+ OUT = "results/icml_r3/X21/test_eval"
28
+
29
+
30
+ def refs():
31
+ if TEST:
32
+ Z = [z for z in map(np.load, sorted(glob.glob(f"{X.DATA_DIR}/test/plant_*.npz"))) if not bool(z["dropped"]) and int(z["M"])] # M = 0: no F-only reference
33
+ J_lqg = np.array([np.where(z["lqg_cert"], z["lqg_J"], np.inf).min() for z in Z])
34
+ return dict(i=np.array([int(z["i"]) for z in Z]), stratum=np.array([str(z["stratum"]) for z in Z]),
35
+ g=np.stack([z["g"] for z in Z]), D=np.stack([z["D"] for z in Z]), s=np.array([float(z["s"]) for z in Z]),
36
+ J_ref=np.full(len(Z), np.nan), J_lin=np.minimum([z["sg_J"].min() for z in Z], J_lqg), J_lqg=J_lqg,
37
+ J_fonly=np.array([z["J"].min() if int(z["M"]) else np.inf for z in Z]))
38
+ T = X.table()
39
+ Z = [np.load(f"{X.OUT}/pilot/plant_{i:02d}.npz") for i in T["i"]]
40
+ J_fonly = np.array([float(np.load(f"{X.OUT}/ablate/plant_{i:02d}.npz")["fonly_J"]) for i in T["i"]])
41
+ return dict(i=T["i"], g=np.stack([z["g"] for z in Z]), D=np.stack([z["D"] for z in Z]), s=T["s1"],
42
+ J_ref=T["J_ref_s0"], J_lin=T["J_lin_s0"], J_fonly=J_fonly)
43
+
44
+
45
+ def sample(path, G, guidance, dev):
46
+ ck = torch.load(path, map_location=dev, weights_only=False)
47
+ cfg = types.SimpleNamespace(**ck["cfg"], device=dev)
48
+ m = ReverseDiffusionModel(cfg).to(dev)
49
+ m.load_state_dict(ck["ema"]); m.eval()
50
+ st = ck["stats"]
51
+ cond = np.concatenate([(G - st["g_mu"]) / st["g_sd"], np.zeros((len(G), 1))], 1)
52
+ cond = torch.tensor(np.repeat(cond, K, 0), dtype=torch.float32, device=dev)
53
+ if ck.get("loss") == "reg": # regression twin: candidate 1 deterministic, the rest MC-dropout draws
54
+ z, t0 = torch.zeros(len(cond), cfg.output_dim, device=dev), torch.zeros(len(cond), 1, device=dev, dtype=torch.long)
55
+ with torch.no_grad():
56
+ x = m(cond, z, t0)
57
+ m.train(); torch.manual_seed(SEED)
58
+ mc = m(cond, z, t0); m.eval()
59
+ x = torch.where((torch.arange(len(cond), device=dev) % K == 0)[:, None], x, mc)
60
+ else:
61
+ ns = DDPMScheduler(num_train_timesteps=cfg.num_timesteps, beta_schedule="squaredcos_cap_v2")
62
+ gen = torch.Generator(device=dev).manual_seed(SEED)
63
+ x = sample_diffusion(m, cond, (len(cond), cfg.output_dim), ns, device=dev, use_cfg=guidance != 1, guidance_scale=guidance, generator=gen)
64
+ y = (x.cpu().numpy() * st["F_sd"] + st["F_mu"]).reshape(len(G), K, -1)
65
+ if str(st.get("rep", "coef")) == "cl":
66
+ return np.array([[np.concatenate(cl_decode(G[p], yk)) for yk in y[p]] for p in range(len(G))]), int(ck["step"])
67
+ return islog(y), int(ck["step"])
68
+
69
+
70
+ def retrieve(G, cl=False):
71
+ """Look-up baseline: the labels of the nearest training plant (standardized g, Euclidean), cheapest first, topped up
72
+ from the next nearest plants to K."""
73
+ T = np.load("results/icml_r3/X21/train.npz")
74
+ mu, sd = T["g"].mean(0), np.where(T["g"].std(0) < 1e-8, 1.0, T["g"].std(0))
75
+ out = []
76
+ for g in G:
77
+ order = np.argsort((((T["g"] - g) / sd) ** 2).sum(1))
78
+ rows = []
79
+ for p in order:
80
+ k = np.argsort(T["J"][p])[: int(T["M"][p])]
81
+ rows += [np.concatenate(cl_decode(g, cl_encode(T["g"][p], T["num"][p, j], T["den"][p, j])) if cl else
82
+ [T["num"][p, j], T["den"][p, j]]) for j in k]
83
+ if len(rows) >= K:
84
+ break
85
+ out.append(np.stack(rows[:K]))
86
+ return np.stack(out), 0
87
+
88
+
89
+ TREPAIR = os.environ.get("X21_TREPAIR", "0") == "1"
90
+ T_GRID = np.concatenate([-np.logspace(-3, 5, 200)[::-1], [0.0], np.logspace(-3, 5, 200)])
91
+
92
+
93
+ def t_repair(g, f):
94
+ """Null-space repair, no verifier call: theta = theta_0 + t v keeps the linearized closed-loop polynomial (v spans the
95
+ null space of the plant's Sylvester map); if F is unstable, move t to the grid point nearest the current one (in slog)
96
+ that makes F stable with the 0.01 margin. Returns (f, repaired)."""
97
+ if X.f_ok(f[:5], f[5:], 0.01):
98
+ return f, False
99
+ v = sylvester(g)[2]
100
+ t0 = v @ f
101
+ th0 = f - t0 * v
102
+ ok = [t for t in T_GRID if X.f_ok((th0 + t * v)[:5], (th0 + t * v)[5:], 0.01)]
103
+ if not ok:
104
+ return f, False
105
+ t = min(ok, key=lambda t: abs(slog(t) - slog(t0)))
106
+ return th0 + t * v, True
107
+
108
+
109
+ def score(args):
110
+ """One plant: (certified [K], J [K], inf where not certified)."""
111
+ g, F, s, D = args
112
+ torch.set_num_threads(1)
113
+ cert, loops = np.zeros(len(F), bool), {}
114
+ for k, f in enumerate(F):
115
+ if TREPAIR:
116
+ f = t_repair(g, f)[0]
117
+ num, den = f[:5], f[5:]
118
+ if not X.f_ok(num, den, 0.01):
119
+ continue
120
+ r = X.realize(g, X.f5(num, den))
121
+ if r is not None and X.rstar(*r[:3], X.PHI_SAT, D, s=s) >= s:
122
+ cert[k], loops[k] = True, r
123
+ J = np.full(len(F), np.inf)
124
+ if loops:
125
+ ks = sorted(loops)
126
+ J[ks] = X.cost_batch([(*loops[k], X.PHI_SAT) for k in ks], [s * D] * len(ks))[0]
127
+ return cert, J
128
+
129
+
130
+ def main(path, *guid):
131
+ dev = "cuda" if torch.cuda.is_available() else "cpu"
132
+ R = refs()
133
+ os.makedirs(OUT, exist_ok=True)
134
+ L = []
135
+ for w in [float(x) for x in guid] or [1.0]:
136
+ t0 = time.time()
137
+ if path.startswith("bl:"): # X22 baselines (x21_baselines.py)
138
+ from nonlinear.experiments.x21_baselines import candidates
139
+ F, step = candidates(path[3:], R["g"]), 0
140
+ else:
141
+ F, step = retrieve(R["g"], cl=path == "retrieval_cl") if path.startswith("retrieval") else sample(path, R["g"], w, dev)
142
+ ts = time.time() - t0
143
+ with cf.ProcessPoolExecutor(int(os.environ.get("X21_EVAL_WORKERS", 16))) as ex:
144
+ res = list(ex.map(score, [(R["g"][p], F[p], R["s"][p], R["D"][p]) for p in range(len(F))]))
145
+ cert, J = np.stack([r[0] for r in res]), np.stack([r[1] for r in res])
146
+ tag = path.replace(":", "_") if path.startswith(("retrieval", "bl:")) else f"{os.path.basename(os.path.dirname(path))}_{os.path.basename(path)[:-4]}_w{w:g}"
147
+ tag += ("_tr" if TREPAIR else "") + (f"_K{K}" if K != 16 else "")
148
+ np.savez_compressed(f"{OUT}/{tag}.npz", F=F, cert=cert, J=J, **{f"ref_{k}": v for k, v in R.items()})
149
+ L.append(f"== {path} (step {step}){' + t-repair' if TREPAIR else ''}, guidance {w:g}, K = {K}, {len(F)} plants; sampling {ts:.0f} s, scoring {time.time() - t0 - ts:.0f} s")
150
+ L.append(f" certified per candidate {cert.mean() * 100:.1f}%; F unstable or not certified otherwise")
151
+ for b in [b for b in (1, 4, 16, 64) if b <= K]:
152
+ Jb = J[:, :b].min(1)
153
+ d = np.where(np.isfinite(Jb), (Jb - R["J_fonly"]) / R["J_fonly"], 1e3)
154
+ med, lo, hi = X.boot_ci(d, np.median)
155
+ L.append(f" b={b:2d}: plants with a certified candidate {np.isfinite(Jb).mean() * 100:5.1f}% | regret vs F-only optimum median "
156
+ f"{med * 100:7.2f}% [{lo * 100:.2f}, {hi * 100:.2f}] | beats tuned linear on {np.mean(Jb < R['J_lin']) * 100:5.1f}% | "
157
+ f"median (J_lin - J_b)/J_b {np.median(np.where(np.isfinite(Jb), (R['J_lin'] - Jb) / Jb, -1)) * 100:6.1f}%")
158
+ open(os.environ.get("X21_REPORT", f"results/icml_r3/X21/{'test' if TEST else 'val'}_report.txt"), "a").write("\n".join(L) + "\n")
159
+ print("\n".join(L), flush=True)
160
+
161
+
162
+ if __name__ == "__main__":
163
+ main(*sys.argv[1:])
andromeda_variants/results/icml_r2/C_mimo/logs/train_asinh_diff_s0.log ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ step 4000 loss 0.04649 44s
2
+ step 8000 loss 0.03687 87s
3
+ step 12000 loss 0.02392 130s
4
+ step 16000 loss 0.01920 173s
5
+ step 20000 loss 0.03223 217s
6
+ step 24000 loss 0.03985 260s
7
+ step 28000 loss 0.01139 303s
8
+ step 32000 loss 0.03577 347s
9
+ step 36000 loss 0.04083 390s
10
+ step 40000 loss 0.02734 433s
11
+ step 44000 loss 0.01491 477s
12
+ step 48000 loss 0.01360 520s
13
+ step 52000 loss 0.02395 563s
14
+ step 56000 loss 0.01635 607s
15
+ step 60000 loss 0.02080 653s
16
+ step 64000 loss 0.01590 721s
17
+ step 68000 loss 0.03090 790s
18
+ step 72000 loss 0.00845 858s
19
+ step 76000 loss 0.01411 926s
20
+ step 80000 loss 0.00710 994s
21
+ step 84000 loss 0.01409 1062s
22
+ step 88000 loss 0.01246 1135s
23
+ step 92000 loss 0.04597 1229s
24
+ step 96000 loss 0.01233 1321s
andromeda_variants/results/icml_r2/C_mimo/logs/train_asinh_diff_s1.log ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ step 4000 loss 0.07135 44s
2
+ step 8000 loss 0.03600 87s
3
+ step 12000 loss 0.04575 130s
4
+ step 16000 loss 0.04027 174s
5
+ step 20000 loss 0.02403 217s
6
+ step 24000 loss 0.04316 260s
7
+ step 28000 loss 0.03459 304s
8
+ step 32000 loss 0.01907 347s
9
+ step 36000 loss 0.02059 390s
10
+ step 40000 loss 0.02181 434s
11
+ step 44000 loss 0.03345 477s
12
+ step 48000 loss 0.01610 521s
13
+ step 52000 loss 0.02529 564s
14
+ step 56000 loss 0.02086 607s
15
+ step 60000 loss 0.03687 654s
16
+ step 64000 loss 0.01497 722s
17
+ step 68000 loss 0.02045 791s
18
+ step 72000 loss 0.00758 859s
19
+ step 76000 loss 0.00840 928s
20
+ step 80000 loss 0.00874 996s
21
+ step 84000 loss 0.01527 1064s
22
+ step 88000 loss 0.01290 1139s
23
+ step 92000 loss 0.02107 1232s
24
+ step 96000 loss 0.01758 1324s
andromeda_variants/results/icml_r2/C_mimo/logs/train_asinh_diff_s2.log ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ step 4000 loss 0.05946 43s
2
+ step 8000 loss 0.05369 86s
3
+ step 12000 loss 0.04041 130s
4
+ step 16000 loss 0.04975 173s
5
+ step 20000 loss 0.03076 216s
6
+ step 24000 loss 0.02877 259s
7
+ step 28000 loss 0.02140 302s
8
+ step 32000 loss 0.04169 345s
9
+ step 36000 loss 0.02023 389s
10
+ step 40000 loss 0.03587 432s
11
+ step 44000 loss 0.02827 475s
12
+ step 48000 loss 0.02366 518s
13
+ step 52000 loss 0.02277 561s
14
+ step 56000 loss 0.02892 604s
15
+ step 60000 loss 0.00786 649s
16
+ step 64000 loss 0.01585 717s
17
+ step 68000 loss 0.02399 785s
18
+ step 72000 loss 0.02560 853s
19
+ step 76000 loss 0.02641 921s
20
+ step 80000 loss 0.01227 989s
21
+ step 84000 loss 0.01050 1057s
22
+ step 88000 loss 0.01198 1128s
23
+ step 92000 loss 0.01185 1220s
24
+ step 96000 loss 0.02995 1313s
andromeda_variants/results/icml_r2/C_mimo/logs/train_asinh_reg_s0.log ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ step 4000 loss 0.00403 44s
2
+ step 8000 loss 0.00102 87s
3
+ step 12000 loss 0.00097 131s
4
+ step 16000 loss 0.00059 175s
5
+ step 20000 loss 0.00046 218s
6
+ step 24000 loss 0.00038 262s
7
+ step 28000 loss 0.00040 305s
8
+ step 32000 loss 0.00043 349s
9
+ step 36000 loss 0.00021 393s
10
+ step 40000 loss 0.00024 436s
11
+ step 44000 loss 0.00020 480s
12
+ step 48000 loss 0.00023 523s
13
+ step 52000 loss 0.00019 567s
14
+ step 56000 loss 0.00017 611s
15
+ step 60000 loss 0.00016 659s
16
+ step 64000 loss 0.00017 728s
17
+ step 68000 loss 0.00013 797s
18
+ step 72000 loss 0.00015 866s
19
+ step 76000 loss 0.00014 934s
20
+ step 80000 loss 0.00014 1003s
21
+ step 84000 loss 0.00010 1071s
22
+ step 88000 loss 0.00011 1149s
23
+ step 92000 loss 0.00014 1242s
24
+ step 96000 loss 0.00012 1330s
andromeda_variants/results/icml_r2/C_mimo/logs/train_asinh_reg_s1.log ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ step 4000 loss 0.00173 44s
2
+ step 8000 loss 0.00110 87s
3
+ step 12000 loss 0.00078 130s
4
+ step 16000 loss 0.00099 173s
5
+ step 20000 loss 0.00048 217s
6
+ step 24000 loss 0.00032 260s
7
+ step 28000 loss 0.00040 303s
8
+ step 32000 loss 0.00032 346s
9
+ step 36000 loss 0.00024 390s
10
+ step 40000 loss 0.00019 433s
11
+ step 44000 loss 0.00022 476s
12
+ step 48000 loss 0.00018 519s
13
+ step 52000 loss 0.00019 563s
14
+ step 56000 loss 0.00019 606s
15
+ step 60000 loss 0.00013 652s
16
+ step 64000 loss 0.00016 720s
17
+ step 68000 loss 0.00017 788s
18
+ step 72000 loss 0.00012 856s
19
+ step 76000 loss 0.00010 925s
20
+ step 80000 loss 0.00012 993s
21
+ step 84000 loss 0.00012 1061s
22
+ step 88000 loss 0.00012 1133s
23
+ step 92000 loss 0.00016 1227s
24
+ step 96000 loss 0.00013 1319s
andromeda_variants/results/icml_r2/C_mimo/logs/train_asinh_reg_s2.log ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ step 4000 loss 0.00228 44s
2
+ step 8000 loss 0.00116 87s
3
+ step 12000 loss 0.00106 130s
4
+ step 16000 loss 0.00059 173s
5
+ step 20000 loss 0.00047 217s
6
+ step 24000 loss 0.00045 260s
7
+ step 28000 loss 0.00054 304s
8
+ step 32000 loss 0.00044 347s
9
+ step 36000 loss 0.00037 390s
10
+ step 40000 loss 0.00023 434s
11
+ step 44000 loss 0.00023 477s
12
+ step 48000 loss 0.00021 520s
13
+ step 52000 loss 0.00019 564s
14
+ step 56000 loss 0.00023 607s
15
+ step 60000 loss 0.00018 653s
16
+ step 64000 loss 0.00013 722s
17
+ step 68000 loss 0.00012 790s
18
+ step 72000 loss 0.00011 858s
19
+ step 76000 loss 0.00013 926s
20
+ step 80000 loss 0.00011 995s
21
+ step 84000 loss 0.00013 1063s
22
+ step 88000 loss 0.00011 1136s
23
+ step 92000 loss 0.00013 1229s
24
+ step 96000 loss 0.00014 1322s
andromeda_variants/results/icml_r2/D2_scale/logs/train_d3m3n8000_diff_s0.log ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ step 4000 loss 0.06796 79s
2
+ step 8000 loss 0.03975 155s
3
+ step 12000 loss 0.04525 233s
4
+ step 16000 loss 0.04151 306s
5
+ step 20000 loss 0.05084 378s
6
+ step 24000 loss 0.06344 450s
andromeda_variants/results/icml_r2/D2_scale/logs/train_d3m3n8000_diff_s1.log ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ step 4000 loss 0.06766 78s
2
+ step 8000 loss 0.04919 154s
3
+ step 12000 loss 0.04018 232s
4
+ step 16000 loss 0.05754 304s
5
+ step 20000 loss 0.04729 376s
6
+ step 24000 loss 0.10111 449s
andromeda_variants/results/icml_r2/D2_scale/logs/train_d3m3n8000_diff_s2.log ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ step 4000 loss 0.11455 79s
2
+ step 8000 loss 0.05867 155s
3
+ step 12000 loss 0.05926 233s
4
+ step 16000 loss 0.08917 305s
5
+ step 20000 loss 0.05450 378s
6
+ step 24000 loss 0.06598 450s
andromeda_variants/results/icml_r2/D2_scale/logs/train_d3m3n8000_reg_s0.log ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ step 4000 loss 0.00584 79s
2
+ step 8000 loss 0.00516 156s
3
+ step 12000 loss 0.00720 234s
4
+ step 16000 loss 0.00494 307s
5
+ step 20000 loss 0.00332 379s
6
+ step 24000 loss 0.00393 451s
andromeda_variants/results/icml_r2/D2_scale/logs/train_d3m3n8000_reg_s1.log ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ step 4000 loss 0.00647 78s
2
+ step 8000 loss 0.00663 155s
3
+ step 12000 loss 0.00442 233s
4
+ step 16000 loss 0.00358 305s
5
+ step 20000 loss 0.00498 377s
6
+ step 24000 loss 0.00297 450s
andromeda_variants/results/icml_r2/D2_scale/logs/train_d3m3n8000_reg_s2.log ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ step 4000 loss 0.00478 79s
2
+ step 8000 loss 0.00473 155s
3
+ step 12000 loss 0.00478 233s
4
+ step 16000 loss 0.00381 306s
5
+ step 20000 loss 0.00335 378s
6
+ step 24000 loss 0.00356 450s
andromeda_variants/results/icml_r2/D2_scale/logs/train_d3m4n8000_diff_s0.log ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ step 4000 loss 0.08915 79s
2
+ step 8000 loss 0.05696 156s
3
+ step 12000 loss 0.03570 235s
4
+ step 16000 loss 0.03370 308s
5
+ step 20000 loss 0.08863 380s
6
+ step 24000 loss 0.04582 453s
andromeda_variants/results/icml_r2/D2_scale/logs/train_d3m4n8000_diff_s1.log ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ step 4000 loss 0.07128 79s
2
+ step 8000 loss 0.08012 156s
3
+ step 12000 loss 0.05918 235s
4
+ step 16000 loss 0.07753 308s
5
+ step 20000 loss 0.03958 380s
6
+ step 24000 loss 0.08407 453s
andromeda_variants/results/icml_r2/D2_scale/logs/train_d3m4n8000_reg_s0.log ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ step 4000 loss 0.01156 79s
2
+ step 8000 loss 0.00854 156s
3
+ step 12000 loss 0.00563 235s
4
+ step 16000 loss 0.00568 308s
5
+ step 20000 loss 0.00516 381s
6
+ step 24000 loss 0.00450 454s
andromeda_variants/results/icml_r2/D2_scale/logs/train_d3m4n8000_reg_s1.log ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ step 4000 loss 0.00936 79s
2
+ step 8000 loss 0.00487 156s
3
+ step 12000 loss 0.00536 235s
4
+ step 16000 loss 0.00457 308s
5
+ step 20000 loss 0.00477 380s
6
+ step 24000 loss 0.00472 453s
andromeda_variants/results/icml_r3/X1F/FROZEN.json ADDED
@@ -0,0 +1,231 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "test_arms": {
3
+ "flow": {
4
+ "0": [
5
+ [
6
+ "flow_s0",
7
+ "e100",
8
+ [
9
+ 0,
10
+ 1,
11
+ 2
12
+ ]
13
+ ]
14
+ ],
15
+ "config": [
16
+ "flow_s0",
17
+ "e100"
18
+ ],
19
+ "1": [
20
+ [
21
+ "flow_s1",
22
+ "e100",
23
+ [
24
+ 0
25
+ ]
26
+ ]
27
+ ],
28
+ "2": [
29
+ [
30
+ "flow_s2",
31
+ "e100",
32
+ [
33
+ 0
34
+ ]
35
+ ]
36
+ ]
37
+ },
38
+ "mdn": {
39
+ "0": [
40
+ [
41
+ "mdn_M4_s0",
42
+ "modes",
43
+ [
44
+ 0,
45
+ 1,
46
+ 2
47
+ ]
48
+ ]
49
+ ],
50
+ "config": [
51
+ "mdn_M4_s0",
52
+ "modes"
53
+ ],
54
+ "1": [
55
+ [
56
+ "mdn_M4_s1",
57
+ "modes",
58
+ [
59
+ 0
60
+ ]
61
+ ]
62
+ ],
63
+ "2": [
64
+ [
65
+ "mdn_M4_s2",
66
+ "modes",
67
+ [
68
+ 0
69
+ ]
70
+ ]
71
+ ]
72
+ },
73
+ "mip": {
74
+ "0": [
75
+ [
76
+ "mip_s0",
77
+ "dstoch",
78
+ [
79
+ 0,
80
+ 1,
81
+ 2
82
+ ]
83
+ ]
84
+ ],
85
+ "config": [
86
+ "mip_s0",
87
+ "dstoch"
88
+ ],
89
+ "1": [
90
+ [
91
+ "mip_s1",
92
+ "dstoch",
93
+ [
94
+ 0
95
+ ]
96
+ ]
97
+ ],
98
+ "2": [
99
+ [
100
+ "mip_s2",
101
+ "dstoch",
102
+ [
103
+ 0
104
+ ]
105
+ ]
106
+ ]
107
+ },
108
+ "wta": {
109
+ "0": [
110
+ [
111
+ "wta_M32_s0",
112
+ "top",
113
+ [
114
+ 0
115
+ ]
116
+ ]
117
+ ],
118
+ "config": [
119
+ "wta_M32_s0",
120
+ "top"
121
+ ],
122
+ "1": [
123
+ [
124
+ "wta_M32_s1",
125
+ "top",
126
+ [
127
+ 0
128
+ ]
129
+ ]
130
+ ],
131
+ "2": [
132
+ [
133
+ "wta_M32_s2",
134
+ "top",
135
+ [
136
+ 0
137
+ ]
138
+ ]
139
+ ]
140
+ },
141
+ "cvae": {
142
+ "0": [
143
+ [
144
+ "cvae_z16_b1e-2_s0",
145
+ "iid",
146
+ [
147
+ 0,
148
+ 1,
149
+ 2
150
+ ]
151
+ ]
152
+ ],
153
+ "config": [
154
+ "cvae_z16_b1e-2_s0",
155
+ "iid"
156
+ ],
157
+ "1": [
158
+ [
159
+ "cvae_z16_b1e-2_s1",
160
+ "iid",
161
+ [
162
+ 0
163
+ ]
164
+ ]
165
+ ],
166
+ "2": [
167
+ [
168
+ "cvae_z16_b1e-2_s2",
169
+ "iid",
170
+ [
171
+ 0
172
+ ]
173
+ ]
174
+ ]
175
+ },
176
+ "diff": {
177
+ "0": [
178
+ [
179
+ "diff_s0",
180
+ "d10",
181
+ [
182
+ 0,
183
+ 1,
184
+ 2
185
+ ]
186
+ ]
187
+ ],
188
+ "config": [
189
+ "diff_s0",
190
+ "d10"
191
+ ]
192
+ },
193
+ "flowc": {
194
+ "0": [
195
+ [
196
+ "flow_s0",
197
+ "e100c",
198
+ [
199
+ 0
200
+ ]
201
+ ]
202
+ ],
203
+ "config": [
204
+ "flow_s0",
205
+ "e100c"
206
+ ]
207
+ }
208
+ },
209
+ "test_extra": {
210
+ "flow seed0 Euler-10 (matched NFE)": [
211
+ [
212
+ "flow_s0",
213
+ "e10",
214
+ [
215
+ 0,
216
+ 1,
217
+ 2
218
+ ]
219
+ ]
220
+ ]
221
+ },
222
+ "written": {
223
+ "flow": "2026-10-13T01:40:09",
224
+ "mdn": "2026-10-13T01:40:09",
225
+ "mip": "2026-10-13T01:40:09",
226
+ "wta": "2026-10-13T02:46:34",
227
+ "cvae": "2026-10-13T02:46:34",
228
+ "diff": "2026-10-13T02:46:34",
229
+ "flowc": "2026-10-13T02:46:34"
230
+ }
231
+ }
andromeda_variants/results/icml_r3/X1S/sample_x3.sh ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # GPU sampling for X3 models trained by mh_train (names m<m>n8000_{diff,reg}_s<s>) -> cand_x3fm<m>n8000_{kind}_s<s>.npz (train.py-compatible checkpoints, nonlinear.mimo_unstable.sample)
3
+ # usage: sample_x3.sh "<m list>" "<seed list>"
4
+ cd ~/DiffusionControl; export WANDB_MODE=offline OMP_NUM_THREADS=1 PYTHONPATH=.; mkdir -p results/icml_r3/X1S/cand_ref
5
+ for s in $2; do for m in $1; do for k in diff reg; do
6
+ f=models/mhx/m${m}n8000_${k}_s${s}.pth; o=results/icml_r3/X1S/cand_ref/cand_x3fm${m}n8000_${k}_s${s}.npz
7
+ [ -f $f ] && [ ! -f $o ] && .venv/bin/python -m nonlinear.mimo_unstable.sample --m $m --dir results/icml_r2/D2_scale/ --device cuda --ckpt $f --sets m${m}_heldout_4242,m${m}_heldout_9001,m${m}_ood --kcand 16 --out $o --seed $s 2>&1 | tail -1 | cut -c1-80
8
+ done; done; done
andromeda_variants/results/icml_r3/X21/val/x21_fgen_clL_best_w1_tr.npz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:215d5fbe2d55c47333b675e471391c2e44418654783b51eee2c2a4ece36c6fcc
3
+ size 58999
andromeda_variants/witsenhausen/e1_bank.py ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """E1 (docs/witsenhausen_review.md sec. 4): free-edge controller bank over the (k, sigma) family + Tseng-Tang sweep.
2
+ Per instance: exact affine optimum, then free-edge fits (review_2026_10_19/free_edge.py) over P = 2..Pmax(sigma),
3
+ both parities, start spacings DS, flat -> sloped -> curved continuation. Every fit is re-scored with 64-point
4
+ Gauss-Legendre and hy = 0.05; the best fit is also scored by the independent dense evaluator (J_dense).
5
+ Sets: bank (150, seed 101), heldout60 (seed 4242), heldout140 (seed 777), tt (Tseng-Tang CDC 2017 Table II, sigma = 5).
6
+ usage: python -m witsenhausen.e1_bank NPART PARTS PROCS OUT (PARTS = comma list; instance i goes to part i % NPART)
7
+ python -m witsenhausen.e1_bank selfcheck"""
8
+ import sys, time, json, numpy as np, torch
9
+ from multiprocessing import Pool
10
+ from scipy.optimize import minimize, minimize_scalar
11
+ from witsenhausen.bank import sample_family
12
+ from witsenhausen.review_2026_10_19.free_edge import J_torch, J_dense, nodes
13
+
14
+ TT = {0.0: 0.0, 0.05: 0.015517, 0.1: 0.052292, 0.15: 0.104019, 0.2: 0.166897, 0.25: 0.237978, 0.3: 0.314824,
15
+ 0.35: 0.395337, 0.4: 0.477652, 0.45: 0.560067, 0.5: 0.640974, 0.55: 0.718803, 0.6: 0.791935, 0.65: 0.858579,
16
+ 0.7: 0.916458, 0.75: 0.961424, 0.8: 0.961436, 0.85: 0.961446, 0.9: 0.961454, 0.95: 0.961461, 1.0: 0.961467,
17
+ 1.5: 0.961498, 2.0: 0.961509, 2.5: 0.961514, 3.0: 0.961516, 4.0: 0.961519, 5.0: 0.961520, 6.0: 0.961521,
18
+ 7.0: 0.961521, 8.0: 0.961522}
19
+ SETS = {"bank": (150, 101), "heldout60": (60, 4242), "heldout140": (140, 777)}
20
+ DS = (4.0, 5.0, 6.0, 7.0, 8.0)
21
+ def composite(n, panels): # n-point Gauss-Legendre on each of `panels` equal sub-panels of [-1, 1]
22
+ x, w = np.polynomial.legendre.leggauss(n)
23
+ xs = np.concatenate([-1 + (2 * i + 1) / panels + x / panels for i in range(panels)])
24
+ return torch.tensor(xs, dtype=torch.float64), torch.tensor(np.tile(w / panels, panels), dtype=torch.float64)
25
+
26
+
27
+ # Fitting uses one 32-node panel per segment (the bounds in fit_b stop the quadrature exploit); every fit is re-scored
28
+ # on 4 x 64 composite panels with a mass check. On the former exploit case 4x64 and 16x64 agree to 1e-9.
29
+ XGF, WGF = composite(32, 1) # fitting
30
+ XG2, WG2 = composite(64, 4) # re-scoring
31
+
32
+
33
+ def all_instances():
34
+ out = [("tt", j, k, 5.0) for j, k in enumerate(sorted(TT))]
35
+ for name, (n, seed) in SETS.items():
36
+ ks, ss = sample_family(n, seed)
37
+ out += [(name, j, float(k), float(s)) for j, (k, s) in enumerate(zip(ks, ss))]
38
+ return out
39
+
40
+
41
+ def affine(k, s):
42
+ f = lambda l: k * k * (l - 1) ** 2 * s * s + l * l * s * s / (l * l * s * s + 1)
43
+ g = np.linspace(0, 1.2, 120001)
44
+ l0 = g[np.argmin(f(g))]
45
+ r = minimize_scalar(f, bounds=(max(0.0, l0 - 1e-4), l0 + 1e-4), method="bounded", options=dict(xatol=1e-13))
46
+ return float(min(r.fun, f(l0))), float(r.x)
47
+
48
+
49
+ def pmax(s):
50
+ return int(np.clip(np.ceil(4.5 * s / 5) + 1, 2, 8))
51
+
52
+
53
+ def fit_b(k, s, P, odd, d, degs=(0, 1), th0=None, ftol=1e-12):
54
+ """free_edge.fit with box bounds: unbounded edges let L-BFGS stretch a segment until its Gauss-Legendre nodes miss
55
+ the Gaussian mass (J -> 0, huge y grids). Edge gaps <= 3 sigma, levels and slopes bounded; mass checked by caller."""
56
+ lev = (np.arange(P) + (0.0 if odd else 0.5)) * d
57
+ edges = (np.arange(1, P) + (0.5 if odd else 0.0)) * d
58
+ th = np.concatenate([lev, np.log(np.diff(np.r_[0.0, edges])), np.zeros(P), np.zeros(P)])
59
+ if odd:
60
+ th[2 * P - 1] = 0.05
61
+ lo = np.r_[np.full(P, -2 * s - 10), np.full(P - 1, np.log(0.02)), np.full(P, -1.0), np.full(P, -1.0)]
62
+ hi = np.r_[np.full(P, 12 * s + 40), np.full(P - 1, np.log(3 * s)), np.full(P, 1.5), np.full(P, 1.0)]
63
+ th = np.clip(th if th0 is None else np.array(th0, float), lo, hi)
64
+ out = {}
65
+ for deg in degs: # continuation: flat -> sloped -> curved
66
+ free = np.ones_like(th, bool)
67
+ if deg < 1: free[2 * P - 1:3 * P - 1] = False
68
+ if deg < 2: free[3 * P - 1:] = False
69
+ if odd: free[0] = False
70
+ def fg(x):
71
+ full = th.copy(); full[free] = x
72
+ t = torch.tensor(full, requires_grad=True)
73
+ j = J_torch(t, P, odd, k, s, xg=XGF, wg=WGF); j.backward()
74
+ return float(j.detach()), t.grad.numpy()[free]
75
+ try:
76
+ r = minimize(fg, th[free], jac=True, method="L-BFGS-B", bounds=list(zip(lo[free], hi[free])),
77
+ options=dict(maxiter=1500, ftol=ftol, gtol=1e-10))
78
+ th[free] = r.x
79
+ except Exception:
80
+ break
81
+ out[deg] = th.copy()
82
+ return out
83
+
84
+
85
+ def solve(inst):
86
+ name, j, k, s = inst
87
+ torch.set_num_threads(1)
88
+ t0 = time.time()
89
+ Ja, lam = affine(k, s)
90
+ fits = []
91
+ for P in range(2, pmax(s) + 1):
92
+ for odd in (False, True):
93
+ for d in DS:
94
+ for deg, th in fit_b(k, s, P, odd, d).items():
95
+ t = torch.tensor(th)
96
+ mass = float(nodes(t, P, odd, s, XG2, WG2)[1].sum())
97
+ J = float(J_torch(t, P, odd, k, s, hy=0.05, xg=XG2, wg=WG2))
98
+ if abs(mass - 1) > 1e-7 or not np.isfinite(J):
99
+ continue # quadrature lost mass: reject
100
+ fits.append(dict(P=P, odd=odd, d=d, deg=deg, J=J, th=th.tolist()))
101
+ if fits: # polish the best start to record precision (sloped, then curved)
102
+ b = min(fits, key=lambda f: f["J"])
103
+ for deg, th in fit_b(k, s, b["P"], b["odd"], b["d"], degs=(1, 2), th0=b["th"], ftol=1e-15).items():
104
+ t = torch.tensor(th)
105
+ mass = float(nodes(t, b["P"], b["odd"], s, XG2, WG2)[1].sum())
106
+ J = float(J_torch(t, b["P"], b["odd"], k, s, hy=0.05, xg=XG2, wg=WG2))
107
+ if abs(mass - 1) <= 1e-7 and np.isfinite(J):
108
+ fits.append(dict(P=b["P"], odd=b["odd"], d=b["d"], deg=deg, J=J, th=th.tolist(), polish=True))
109
+ b = min(fits, key=lambda f: f["J"]) if fits else None
110
+ # J_dense is a midpoint rule, O(1/n) at the map's jumps: Richardson on n and 2n (checked to 1e-7 on bank:88)
111
+ Jd = (2 * J_dense(np.array(b["th"]), b["P"], b["odd"], k, s, n=800001)
112
+ - J_dense(np.array(b["th"]), b["P"], b["odd"], k, s, n=400001)) if b else float("nan")
113
+ return dict(set=name, j=j, k=k, sigma=s, J_affine=Ja, lam_affine=lam, J_free=b["J"] if b else float("inf"),
114
+ J_dense_free=float(Jd), J_best=min(Ja, b["J"] if b else Ja), n_fits=len(fits), sec=time.time() - t0,
115
+ fits=fits)
116
+
117
+
118
+ if __name__ == "__main__":
119
+ if sys.argv[1] == "selfcheck": # benchmark must reproduce the review's 0.1669223, affine closed form sane
120
+ Ja, lam = affine(0.2, 5.0)
121
+ assert abs(Ja - 0.96) < 1e-9, Ja # known affine optimum at the benchmark
122
+ r = solve(("tt", 4, 0.2, 5.0))
123
+ print(f"selfcheck: J_free {r['J_free']:.7f} dense {r['J_dense_free']:.7f} affine {Ja:.6f} fits {r['n_fits']} {r['sec']:.0f}s")
124
+ assert r["J_free"] <= 0.1669230 and abs(r["J_dense_free"] - r["J_free"]) < 2e-6
125
+ r = solve(("bank", 88, 0.1298479454262307, 6.483232538527584)) # gave J = 0 before the bounds (quadrature exploit)
126
+ print(f"exploit case: J_free {r['J_free']:.7f} dense {r['J_dense_free']:.7f} affine {r['J_affine']:.6f} {r['sec']:.0f}s")
127
+ assert 0.01 < r["J_free"] < r["J_affine"] and abs(r["J_dense_free"] - r["J_free"]) < 2e-6
128
+ sys.exit()
129
+ npart, parts, procs, out = int(sys.argv[1]), {int(p) for p in sys.argv[2].split(",")}, int(sys.argv[3]), sys.argv[4]
130
+ todo = [x for i, x in enumerate(all_instances()) if i % npart in parts]
131
+ todo.sort(key=lambda x: -x[3]) # big sigma first (most fits) for load balance
132
+ print(f"{len(todo)} instances on {procs} procs -> {out}", flush=True)
133
+ t0 = time.time()
134
+ with Pool(procs) as pool, open(out, "a") as fh:
135
+ for n, r in enumerate(pool.imap_unordered(solve, todo, chunksize=1), 1):
136
+ fh.write(json.dumps(r) + "\n"); fh.flush()
137
+ print(f"{n}/{len(todo)} {r['set']}:{r['j']} k={r['k']:.3f} s={r['sigma']:.2f} J={r['J_best']:.7f} "
138
+ f"(affine {r['J_affine']:.6f}) {r['sec']:.0f}s [{time.time() - t0:.0f}s]", flush=True)
139
+ print("DONE", flush=True)
andromeda_variants/witsenhausen/vector_2026_10_19/eval_b.py ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Evaluator B: black-box Monte Carlo for the vector Witsenhausen cost, n = 2. Shares no code with eval_a.py.
2
+
3
+ Needs only the policy as a function F: R^2 -> R^2 (no cell structure).
4
+ stage 2 estimator g(y) = E[x1|y]: tabulated on a fine y grid from a midpoint x0 grid (h = 0.1, atoms F(x0)) and interpolated
5
+ with a bicubic spline. For ANY estimator g, E|x1 - g(y)|^2 = mmse + E|g - E[x1|y]|^2 >= mmse, so a slightly wrong g
6
+ biases J upward at second order only; the MC estimate is of a real, achievable cost.
7
+ cost estimator per sample (x0, w): k^2 |x1 - x0|^2 + omega(w) |x1 - g(x1 + w)|^2,
8
+ x0 = sigma * Phi^-1(u) from a randomised (Owen-scrambled) Sobol net: stratifies x0 over elementary boxes, hence over lattice cells;
9
+ w ~ defensive mixture 1/2 N(0,I) + 1/2 mean_j N(mu_j, I), mu_j = rho e_j toward the neighbouring decision regions;
10
+ omega = N(w;0,I)/q(w) <= 2. Decoding errors (rare, cost ~ d^2 each) are then sampled about half the time.
11
+ honest standard error: R independent scrambles, SE = sd(replicate means)/sqrt(R).
12
+ """
13
+ import math, sys, time, json
14
+ import numpy as np
15
+ from scipy.stats import qmc, norm
16
+ from scipy.interpolate import RectBivariateSpline
17
+
18
+ K, SIG = 0.2, 5.0
19
+ SQ3 = math.sqrt(3.0)
20
+
21
+
22
+ def F_hex(x0, d, alpha, s):
23
+ """nearest point c of d*A2 by rounding fractional coordinates and testing the 3x3 neighbourhood."""
24
+ G = d * np.array([[1.0, 0.0], [0.5, SQ3 / 2]]); i0 = np.round(x0 @ np.linalg.inv(G))
25
+ best = np.full(len(x0), np.inf); c = np.zeros_like(x0)
26
+ for di in (-1, 0, 1):
27
+ for dj in (-1, 0, 1):
28
+ cc = (i0 + np.array([di, dj])) @ G; dist = ((x0 - cc) ** 2).sum(1); b = dist < best
29
+ best = np.where(b, dist, best); c = np.where(b[:, None], cc, c)
30
+ return alpha * c + s * (x0 - c)
31
+
32
+
33
+ def F_scalar(x, a, e, s, sigma=SIG):
34
+ """free_edge.py class, odd, P segments, sloped: x1 = sign(x) f(|x|)."""
35
+ P = len(a); ax = np.abs(x); j = np.searchsorted(e, ax, side='right')
36
+ lo = np.r_[0.0, e]; hi = np.r_[e, e[-1] + 8 * sigma]
37
+ mid = np.where(j < P - 1, 0.5 * (lo[j] + hi[j]), lo[j] + sigma)
38
+ f = np.where(j == 0, s[0] * ax, a[j] + s[j] * (ax - mid))
39
+ return np.sign(x) * f
40
+
41
+
42
+ def make_F(case, par):
43
+ if case == 'hex':
44
+ return lambda x0: F_hex(x0, *par)
45
+ if case == 'prod':
46
+ a, e, s = (np.array(v) for v in par)
47
+ return lambda x0: np.stack([F_scalar(x0[:, 0], a, e, s), F_scalar(x0[:, 1], a, e, s)], 1)
48
+ if case == 'ident':
49
+ return lambda x0: x0.copy()
50
+ raise ValueError(case)
51
+
52
+
53
+ def shifts_for(case, rho):
54
+ ang = np.radians(60 * np.arange(6)) if case == 'hex' else np.radians(90 * np.arange(4))
55
+ return rho * np.stack([np.cos(ang), np.sin(ang)], 1)
56
+
57
+
58
+ def tabulate_g(F, h=0.1, Lx=7 * SIG, hy=0.05, pad=6.0, chunk=4000, log=print):
59
+ v = np.arange(-Lx, Lx + h / 2, h)
60
+ X0 = np.stack(np.meshgrid(v, v, indexing='ij'), -1).reshape(-1, 2); X0 = X0[(X0 ** 2).sum(1) <= Lx ** 2]
61
+ W = np.exp(-0.5 * (X0 ** 2).sum(1) / SIG ** 2) * h * h / (2 * math.pi * SIG ** 2); X1 = F(X0)
62
+ L = float(np.abs(X1).max()) + pad; yv = np.arange(-L, L + hy / 2, hy); ny = len(yv)
63
+ p = np.zeros((ny, ny)); m1 = np.zeros((ny, ny)); m2 = np.zeros((ny, ny)); t0 = time.time()
64
+ for c in range(0, len(W), chunk):
65
+ w, x = W[c:c + chunk], X1[c:c + chunk]
66
+ A0 = np.exp(-0.5 * (yv[:, None] - x[None, :, 0]) ** 2); A1 = np.exp(-0.5 * (yv[:, None] - x[None, :, 1]) ** 2)
67
+ p += (A0 * w) @ A1.T; m1 += (A0 * (w * x[:, 0])) @ A1.T; m2 += (A0 * (w * x[:, 1])) @ A1.T
68
+ if (c // chunk) % 20 == 0:
69
+ log(f' tabulate {c}/{len(W)} {time.time() - t0:.0f}s')
70
+ ok = p > 1e-250; g1 = np.where(ok, m1 / np.where(ok, p, 1), 0.0); g2 = np.where(ok, m2 / np.where(ok, p, 1), 0.0)
71
+ info = dict(atoms=len(W), mass=float(W.sum()), L=L, hy=hy, h=h)
72
+ return (RectBivariateSpline(yv, yv, g1, kx=3, ky=3, s=0), RectBivariateSpline(yv, yv, g2, kx=3, ky=3, s=0)), (-L, L), info
73
+
74
+
75
+ def cost_samples(F, g, lim, mu, u, k=K, use_is=True):
76
+ """u: (N,5) uniforms. returns per-sample stage-1 and stage-2 cost arrays."""
77
+ u = np.clip(u, 1e-13, 1 - 1e-13)
78
+ x0 = SIG * norm.ppf(u[:, :2]); x1 = F(x0); z = norm.ppf(u[:, 3:5]); N = len(u)
79
+ if use_is:
80
+ J = len(mu); sel = np.where(u[:, 2] < 0.5, -1, np.minimum(((u[:, 2] - 0.5) * 2 * J).astype(int), J - 1))
81
+ w = z + np.where(sel[:, None] >= 0, mu[np.maximum(sel, 0)], 0.0)
82
+ mw = w @ mu.T - 0.5 * (mu ** 2).sum(1)[None] # log N(w;mu_j)/N(w;0)
83
+ om = 1.0 / (0.5 + 0.5 / J * np.exp(mw).sum(1))
84
+ else:
85
+ w, om = z, np.ones(N)
86
+ y = np.clip(x1 + w, lim[0], lim[1]); gh = np.stack([g[0].ev(y[:, 0], y[:, 1]), g[1].ev(y[:, 0], y[:, 1])], 1)
87
+ return k * k * ((x1 - x0) ** 2).sum(1), om * ((x1 - gh) ** 2).sum(1), float(np.mean((x1 + w < lim[0]) | (x1 + w > lim[1])))
88
+
89
+
90
+ def run_rqmc(F, g, lim, mu, log2n, R, seed, k=K):
91
+ est = []; clip = 0.0
92
+ for r in range(R):
93
+ u = qmc.Sobol(d=5, scramble=True, seed=seed + r).random_base2(log2n)
94
+ s1, s2, cl = cost_samples(F, g, lim, mu, u, k); clip = max(clip, cl)
95
+ est.append((s1.mean() / 2, s2.mean() / 2))
96
+ est = np.array(est); tot = est.sum(1)
97
+ return dict(Jn=float(tot.mean()), se=float(tot.std(ddof=1) / math.sqrt(R)), stage1=float(est[:, 0].mean()),
98
+ stage2=float(est[:, 1].mean()), se1=float(est[:, 0].std(ddof=1) / math.sqrt(R)),
99
+ se2=float(est[:, 1].std(ddof=1) / math.sqrt(R)), N=R * 2 ** log2n, R=R, clip=clip)
100
+
101
+
102
+ def run_iid(F, g, lim, mu, N, R, seed, use_is):
103
+ rng = np.random.default_rng(seed); est = []
104
+ for r in range(R):
105
+ s1, s2, _ = cost_samples(F, g, lim, mu, rng.random((N, 5)), use_is=use_is); est.append((s1.mean() + s2.mean()) / 2)
106
+ est = np.array(est)
107
+ return dict(Jn=float(est.mean()), sd_single=float(est.std(ddof=1)), se=float(est.std(ddof=1) / math.sqrt(R)), N=N, R=R)
108
+
109
+
110
+ if __name__ == '__main__':
111
+ # usage: eval_b.py CASE PARAMS_JSON LOG2N R SEED OUT.json
112
+ case, par, log2n, R, seed, out = sys.argv[1], json.loads(sys.argv[2]), int(sys.argv[3]), int(sys.argv[4]), int(sys.argv[5]), sys.argv[6]
113
+ t0 = time.time(); F = make_F(case, par)
114
+ rho = 3.5 if case == 'hex' else 3.4; mu = shifts_for(case, rho)
115
+ g, lim, info = tabulate_g(F); print('table', info, f'{time.time() - t0:.0f}s', flush=True)
116
+ res = dict(case=case, par=par, table=info, rho=rho)
117
+ res['rqmc_is'] = run_rqmc(F, g, lim, mu, log2n, R, seed); print('RQMC+IS', res['rqmc_is'], f'{time.time() - t0:.0f}s', flush=True)
118
+ res['iid_is'] = run_iid(F, g, lim, mu, 2 ** 16, 32, seed + 1000, True); print('iid+IS 2^16', res['iid_is'], flush=True)
119
+ res['iid_plain_2e4'] = run_iid(F, g, lim, mu, 20000, 200, seed + 2000, False); print('iid plain 2e4', res['iid_plain_2e4'], flush=True)
120
+ json.dump(res, open(out, 'w'), indent=1); print('done', f'{time.time() - t0:.0f}s')
andromeda_variants/witsenhausen/vector_2026_10_19/v2_lattice/make_table.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """markdown table from logs/final_*.json (+ optional logs/bias_*.json)."""
2
+ import json, glob, os, sys
3
+ rows = []
4
+ for f in sorted(glob.glob(sys.argv[1] if len(sys.argv) > 1 else 'logs/final_*.json')):
5
+ o = json.load(open(f)); m = {r['M']: r for r in o['main']}; hi = m[max(m)]; lo = m[min(m)]
6
+ n = int(''.join(c for c in o['lat'] if c.isdigit()))
7
+ rows.append((n, hi['Jn'], o, hi, lo))
8
+ rows.sort(key=lambda r: (r[0], r[1]))
9
+ print('| n | lattice | offset | d | alpha | s | J/n (M=%d) | SE | stage 1 /n | stage 2 /n | J(M=%d) - J(M=%d) | N |' % (max(m), min(m), max(m)))
10
+ print('|---|---|---|---|---|---|---|---|---|---|---|---|')
11
+ for n, _, o, hi, lo in rows:
12
+ print(f"| {n} | {o['lat']} | {o['off']} | {o['d']:.4f} | {o['a']:.5f} | {o['s']:.5f} | {hi['Jn']:.6f} | {hi['se']:.1e} | {hi['stage1']:.6f} | {hi['stage2']:.6f} | {lo['d_vs_last']:+.1e} +- {lo['d_vs_last_se']:.0e} | {hi['N']:.1e} |")
13
+ for f in sorted(glob.glob('logs/bias_*.json')):
14
+ o = json.load(open(f)); print(f"\nbias scan {o['lat']} {o['off']} (same samples, N={o['main'][0]['N']:.1e}): " +
15
+ ', '.join(f"M={r['M']}: {r['d_vs_last']:+.2e}+-{r['d_vs_last_se']:.0e}" for r in o['main']))
cbar.log ADDED
The diff for this file is too large to render. See raw diff
 
cbar_eval.log ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /home/cercola/DiffusionControl/.venv/lib/python3.12/site-packages/cvxpy/problems/problem.py:1539: UserWarning: Solution may be inaccurate. Try another solver, adjusting the solver settings, or solve with verbose=True for more information.
2
+ warnings.warn(
3
+
4
+ === rho=0.7 (ISE <= 0.7*ISE_ref, oracle found 40/40) ===
5
+ cond_singleshot : {'spec_met': 0.95, 'certified': 0.85, 'energy_regret': 8.246473273131759, 'n': 34}
6
+ cond_bestofK : {'spec_met': 1.0, 'certified': 1.0, 'energy_regret': 0.8267481140780466, 'n': 40, 'K': 8}
7
+ posthoc : {'spec_met': 0.375, 'certified': 0.375, 'energy_regret': 0.18879793163140582, 'n': 15}
8
+
9
+ === rho=0.8 (ISE <= 0.8*ISE_ref, oracle found 40/40) ===
10
+ cond_singleshot : {'spec_met': 0.9, 'certified': 0.875, 'energy_regret': 6.167389800836868, 'n': 35}
11
+ cond_bestofK : {'spec_met': 1.0, 'certified': 1.0, 'energy_regret': 0.6647373817862725, 'n': 40, 'K': 8}
12
+ posthoc : {'spec_met': 0.8, 'certified': 0.8, 'energy_regret': 0.04796385021600549, 'n': 32}
13
+
14
+ === rho=0.9 (ISE <= 0.9*ISE_ref, oracle found 40/40) ===
15
+ cond_singleshot : {'spec_met': 0.85, 'certified': 0.85, 'energy_regret': 5.221356699653172, 'n': 34}
16
+ cond_bestofK : {'spec_met': 1.0, 'certified': 1.0, 'energy_regret': 1.511379904754083, 'n': 40, 'K': 8}
17
+ posthoc : {'spec_met': 1.0, 'certified': 1.0, 'energy_regret': 0.05018168323100235, 'n': 40}
18
+
19
+ saved -> results/pendulum/cbar_eval.json
costcond.log ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ dataset N=12000 target_scale=14.595 cond=(a,b,logρ) dev=cuda
2
+ step 0 loss 0.9989
3
+ step 2000 loss 0.0117
4
+ step 4000 loss 0.0177
5
+ step 6000 loss 0.0146
6
+ step 8000 loss 0.0111
7
+ step 10000 loss 0.0058
8
+ trained in 8.3s final loss 0.0113
9
+
10
+ === reference plant G=1/(s+1): cost-CONDITIONED single-shot generation vs analytic ===
11
+ rho=0.1 single-shot +0.43% best-of-16 +0.21% RMSE(φ-φ*)=0.240
12
+ rho=0.3 single-shot +0.43% best-of-16 +0.18% RMSE(φ-φ*)=0.168
13
+ rho=1 single-shot +1.75% best-of-16 +0.26% RMSE(φ-φ*)=0.175
14
+ rho=3 single-shot +3.12% best-of-16 +1.29% RMSE(φ-φ*)=0.157
15
+ rho=10 single-shot +5.09% best-of-16 +1.62% RMSE(φ-φ*)=0.150
16
+
17
+ held-out plants (a,b~U[0.5,2]) single-shot median regret @rho=1: +1.48%
18
+ saved -> results/siso_coherent/costcond_siso.json, models/costcond_siso.pth
data/x2_bank2x.npz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:71d9470144020153a2c9144b239fb39f77b7fff6705bcf2e0cb2569fbf219124
3
+ size 3582112
data/x2_bank3000.npz.keep_idx.npy ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c4e68e59ef7abf042971a87e97c114280b766b18676a9a33e0807d5986200dbb
3
+ size 23368
data/x2_bank3000.npz.state.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:739901e441cbc333ca95645af49c0d289a59842182ee079b0d2a142626e7870d
3
+ size 3536599
data/x2_bank_b.npz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0344f5e8d4723ed7bfb0da1f9b489369a0134901ba3b41971eb9a6eb103b3967
3
+ size 1792632
data/x2_bank_b.npz.keep_idx.npy ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:873618ce1ab81bc91619398d66f9b16a307480298c62a02a6cfec9e12b0a9d68
3
+ size 23384
data/x2_bank_b.npz.partial.npz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0344f5e8d4723ed7bfb0da1f9b489369a0134901ba3b41971eb9a6eb103b3967
3
+ size 1792632
data/x2_bank_b.npz.state.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ba03a8ed05c232b2ea3a0b25899f8c7caa5b196b0d091ba39bf6ae9ac7dc32dc
3
+ size 3528570
logs/train_f2L_s0.log ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ f2L_s0 arch=unet params=3747792 N=9662 steps=16000
2
+ step 2000 loss 0.0330 434s
3
+ step 4000 loss 0.0276 1483s
4
+ step 6000 loss 0.0223 1845s
5
+ step 8000 loss 0.0192 2735s
6
+ step 10000 loss 0.0193 4484s
logs/train_f2L_s1.log ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ f2L_s1 arch=unet params=3747792 N=9662 steps=16000
2
+ step 2000 loss 0.0290 480s
3
+ step 4000 loss 0.0280 1492s
4
+ step 6000 loss 0.0217 1860s
5
+ step 8000 loss 0.0194 2925s
6
+ step 10000 loss 0.0150 4545s
logs/train_f2L_s2.log ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ f2L_s2 arch=unet params=3747792 N=9662 steps=16000
2
+ step 2000 loss 0.0251 467s
3
+ step 4000 loss 0.0234 1491s
4
+ step 6000 loss 0.0243 1857s
5
+ step 8000 loss 0.0214 2867s
6
+ step 10000 loss 0.0166 4533s
logs/train_f2_4c_s2.log ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ f2_4c_s2 arch=unet params=3747792 N=8861 steps=24000
2
+ step 2000 loss 0.0299 1572s
logs/train_f2_s2.log ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ f2_s2 arch=unet params=3747792 N=9662 steps=8000
2
+ step 2000 loss 0.0251 867s
3
+ step 4000 loss 0.0227 1306s
4
+ step 6000 loss 0.0220 1380s
5
+ step 8000 loss 0.0195 1454s
models/Last_pend_cbar.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:37ff5dfc15b7ac8bbb6d47b2a5408b7142a604223e84cd3711cc1a688b565121
3
+ size 61290662
models/mimou/asinh_diff_s0_resume.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9f02be6e49e2954454da13a308cb3a3b66031a0560f7041b893b8509faa42923
3
+ size 76701245
models/mimou/asinh_diff_s1_resume.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7f69cbdb4d0a758317b8c1f1fde2bf51a3cb60d05c4fce0957216806054229bb
3
+ size 76701245
models/mimou/asinh_diff_s2_resume.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:13007f97f9d331b4f54e14c9b99e460de6f8282a29223a05eaf45d96d3bd811c
3
+ size 76701245
models/mimou/asinh_reg_s0_resume.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:163ba5a933013601abe9ce5b7f8b2a3b8db3f376341caf9c2579a0e8d72cdf8f
3
+ size 76700903
models/mimou/asinh_reg_s1_resume.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f63692ae81b1ddcc61d3341ecec5321d9df60e3eecdd346f3c7daaa20f15959c
3
+ size 76700903
models/mimou/asinh_reg_s2_resume.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:52dc48b160af8370140b25a13150d0a0a54aff661731d8282ca446da8c64024e
3
+ size 76700903
models/mimou/c3a_diff_s0_resume.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7c64ec13f69490c986b345b34a22314793c15162e33149fc0555b9441be5cbf7
3
+ size 76700561
models/mimou/c3a_diff_s1_resume.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e2ce9e033c80a3ba349a876dcb954d416e9a53eff1c6e8ef8da78b77f9ed8264
3
+ size 76700561
models/mimou/c3a_diff_s2_resume.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2c840af0124a79c90374fe22b86af09189967bbf6769693f551ec7b49b20c2ef
3
+ size 76700561
models/mimou/c3a_reg_s0_resume.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a45f60d79e9e232484ac86c30d3d53345e4c1502db3cf2d269e273c1f695b372
3
+ size 76700219