WitneyWW commited on
Commit
533b8a8
·
verified ·
1 Parent(s): bdae779

Flow-weighted LoRA vs 6fps control: recon, diff, motion split (clip + 32 val clips)

Browse files
Files changed (13) hide show
  1. .gitattributes +8 -0
  2. README.md +34 -4
  3. diff_base.mp4 +3 -0
  4. diff_flow.mp4 +3 -0
  5. diff_fps6.mp4 +3 -0
  6. index.html +134 -18
  7. metrics.json +50 -0
  8. motion_weight.mp4 +3 -0
  9. original.mp4 +3 -0
  10. recon_base.mp4 +3 -0
  11. recon_flow.mp4 +3 -0
  12. recon_fps6.mp4 +3 -0
  13. val_split.json +14 -0
.gitattributes CHANGED
@@ -33,3 +33,11 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ diff_base.mp4 filter=lfs diff=lfs merge=lfs -text
37
+ diff_flow.mp4 filter=lfs diff=lfs merge=lfs -text
38
+ diff_fps6.mp4 filter=lfs diff=lfs merge=lfs -text
39
+ motion_weight.mp4 filter=lfs diff=lfs merge=lfs -text
40
+ original.mp4 filter=lfs diff=lfs merge=lfs -text
41
+ recon_base.mp4 filter=lfs diff=lfs merge=lfs -text
42
+ recon_flow.mp4 filter=lfs diff=lfs merge=lfs -text
43
+ recon_fps6.mp4 filter=lfs diff=lfs merge=lfs -text
README.md CHANGED
@@ -1,10 +1,40 @@
1
  ---
2
- title: Wan22 Vae Flow Vs Control
3
- emoji: 📈
4
  colorFrom: indigo
5
- colorTo: green
6
  sdk: static
7
  pinned: false
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ title: Wan2.2 VAE Flow-Weighted LoRA vs Control
3
+ emoji: 🌊
4
  colorFrom: indigo
5
+ colorTo: pink
6
  sdk: static
7
  pinned: false
8
  ---
9
 
10
+ # Wan2.2 VAE flow-weighted LoRA vs control
11
+
12
+ A GelSight tactile clip (`CutTofu_1_tactile_left.mp4`) reconstructed through the
13
+ Wan2.2 causal 3D VAE three ways: the **frozen base**, a **control** LoRA, and a
14
+ **flow-weighted** LoRA.
15
+
16
+ The two adapters' training configs differ in exactly one field — `flow_weight` (0 vs 1).
17
+ Everything else is identical: 6fps (stride 5 from 30fps sources),
18
+ r=32 α=32, all conv targets, 4000 steps, edge-gradient L1 + LPIPS 0.1. Holding fps fixed
19
+ matters: fps alone is worth ~4 dB and confounded the earlier comparison.
20
+
21
+ Flow weighting multiplies the L1 term by optical-flow magnitude, spending capacity on
22
+ moving regions at the expense of static ones. **Overall PSNR cannot show this** — it
23
+ averages every pixel, so a pure redistribution nets out. The page therefore splits PSNR by
24
+ the same motion magnitude the loss was weighted with (`m̂ ≥ 0.5` moving,
25
+ `≤ 0.1` static), which is the measurement with the power to discriminate.
26
+
27
+ ## Result: it didn't work
28
+
29
+ Over **32 held-out val clips**, the flow-weighted adapter is **-0.28 dB** on moving regions — the regions it was built to improve — while static regions gain +0.20 dB. The intended trade ran backwards.
30
+
31
+ The single clip on this page happens to disagree (+0.12 dB on moving), which is exactly why both are shown: a tenth of a dB on one clip is not separable from clip-to-clip variation.
32
+
33
+ Caveat in the other direction: one training run per arm (seed 0), so a 0.28 dB gap does not rule out run-to-run variance. The honest claim is *no evidence flow weighting helps moving regions*, not proof that it hurts.
34
+
35
+ Files: `original.mp4`, `recon_{base,fps6,flow}.mp4`, `diff_{base,fps6,flow}.mp4`
36
+ (|original − recon| ×20, hot colormap), `motion_weight.mp4` (the m̂ map),
37
+ `metrics.json`.
38
+
39
+ Reconstruction is at **6fps** — the rate the adapters trained at. Evaluating them at the
40
+ source's native 30fps would measure a domain mismatch instead of the adapter.
diff_base.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:38dcd8d8f95d6efcdc0d7d77bd282402af4494614c78c64e2b8e541100dc6ac6
3
+ size 3187276
diff_flow.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:03c7756778317bd1825d3ddff1fcb9210f1431bff36574f1a987826567424d2f
3
+ size 3050378
diff_fps6.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6b2c8fc6490294eb740f3c961d871a32d9190d9158ddbe192e4ec80993257c98
3
+ size 3056291
index.html CHANGED
@@ -1,19 +1,135 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  </html>
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
6
+ <title>Wan2.2 VAE — Flow-Weighted LoRA vs Control</title>
7
+ <style>
8
+ :root {
9
+ --bg:#0f1115; --card:#191c23; --border:#2a2f3a; --text:#e8eaed; --muted:#9aa1ac;
10
+ --accent:#a78bfa; --head:#12141a; --good:#34d399; --bad:#f87171; --warn:#fbbf24;
11
+ }
12
+ @media (prefers-color-scheme: light) {
13
+ :root { --bg:#f6f7f9; --card:#fff; --border:#e3e6eb; --text:#1a1d23; --muted:#5c6472;
14
+ --accent:#7c3aed; --head:#eef0f4; --good:#059669; --bad:#dc2626; --warn:#b45309; }
15
+ }
16
+ * { box-sizing: border-box; }
17
+ body { margin:0; background:var(--bg); color:var(--text); line-height:1.5;
18
+ font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
19
+ header { padding:32px 24px 4px; max-width:1200px; margin:0 auto; }
20
+ h1 { margin:0 0 4px; font-size:1.5rem; }
21
+ .sub { color:var(--muted); font-size:0.95rem; }
22
+ .bar { max-width:1200px; margin:12px auto 0; padding:0 24px; display:flex; gap:8px; align-items:center; }
23
+ .spacer { flex:1; }
24
+ button.action { background:transparent; color:var(--text); border:1px solid var(--border);
25
+ border-radius:8px; padding:6px 14px; font-size:0.88rem; cursor:pointer; }
26
+ button.action:hover { border-color:var(--accent); color:var(--accent); }
27
+ .meta { max-width:1200px; margin:8px auto 0; padding:0 24px; color:var(--muted); font-size:0.85rem; }
28
+ .meta code, .finding code { font-family:ui-monospace, SFMono-Regular, Menlo, monospace; color:var(--accent); }
29
+ section { max-width:1200px; margin:0 auto; padding:4px 24px; }
30
+ h2 { font-size:0.8rem; text-transform:uppercase; letter-spacing:0.06em; color:var(--muted);
31
+ margin:22px 0 10px; padding-bottom:6px; border-bottom:1px solid var(--border); }
32
+ .grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(300px, 1fr)); gap:18px; }
33
+ .card { background:var(--card); border:1px solid var(--border); border-radius:12px;
34
+ overflow:hidden; display:flex; flex-direction:column; }
35
+ .card .head { background:var(--head); padding:9px 14px; border-bottom:1px solid var(--border);
36
+ display:flex; align-items:baseline; gap:8px; flex-wrap:wrap; }
37
+ .card .head .name { font-weight:700; font-size:0.95rem;
38
+ font-family:ui-monospace, SFMono-Regular, Menlo, monospace; }
39
+ .card .head .desc { color:var(--muted); font-size:0.8rem; }
40
+ .card video { width:100%; display:block; background:#000; aspect-ratio:1/1; }
41
+ .card .metric { padding:8px 14px; font-size:0.82rem; color:var(--muted);
42
+ font-family:ui-monospace, SFMono-Regular, Menlo, monospace;
43
+ border-top:1px solid var(--border); }
44
+ .card .metric b { color:var(--text); }
45
+ .delta.up { color:var(--good); } .delta.down { color:var(--bad); } .delta.flat { color:var(--muted); }
46
+ .tag { display:inline-block; font-size:0.68rem; padding:1px 8px; border-radius:999px;
47
+ border:1px solid var(--border); color:var(--accent); }
48
+ .finding { background:var(--card); border:1px solid var(--border); border-left:3px solid var(--warn);
49
+ border-radius:8px; padding:14px 16px; margin:16px 0; font-size:0.9rem; }
50
+ .finding h3 { margin:0 0 6px; font-size:0.9rem; }
51
+ .tbl-wrap { overflow-x:auto; }
52
+ table { border-collapse:collapse; width:100%; font-size:0.86rem;
53
+ font-family:ui-monospace, SFMono-Regular, Menlo, monospace; }
54
+ th, td { text-align:right; padding:8px 12px; border-bottom:1px solid var(--border); white-space:nowrap; }
55
+ th:first-child, td:first-child { text-align:left; }
56
+ thead th { color:var(--muted); font-weight:600; font-size:0.76rem;
57
+ text-transform:uppercase; letter-spacing:0.05em; }
58
+ tbody tr:last-child td { border-bottom:none; }
59
+ tr.delta-row td { border-top:1px solid var(--border); font-weight:700; }
60
+ footer { max-width:1200px; margin:0 auto; padding:24px; color:var(--muted); font-size:0.8rem; }
61
+ </style>
62
+ </head>
63
+ <body>
64
+ <header>
65
+ <h1>Wan2.2 VAE — Flow-Weighted LoRA <span class="tag">A/B vs control</span></h1>
66
+ <div class="sub">Does weighting the reconstruction loss by optical-flow magnitude buy
67
+ sharper <em>moving</em> regions? Two adapters whose configs differ in exactly one field.</div>
68
+ </header>
69
+
70
+ <div class="bar">
71
+ <div class="spacer"></div>
72
+ <button class="action" id="toggle">⏯ Play / pause all</button>
73
+ </div>
74
+
75
+ <div class="meta">
76
+ Source: <code>CutTofu_1_tactile_left.mp4</code> ·
77
+ Clip: <code>77 frames · 256×256 · 6fps
78
+ (stride 5 from 390 native @ 30fps)</code> ·
79
+ Adapters: <code>lora_last.pt · r32 α32 targets=all · step 4000</code>
80
+ </div>
81
+
82
+ <section><div class="finding"><h3>Flow weighting did not do what it was built to do</h3>Across <b>32 held-out val clips</b>, the flow-weighted adapter is <b>-0.28 dB worse</b> on exactly the moving regions it was supposed to improve, while static regions gain +0.20 dB. That is the intended trade <em>running backwards</em>: capacity moved away from motion, not toward it.<br><br>This single clip disagrees — it shows moving +0.12 dB. That is the point of quoting both: one clip is not enough to separate a tenth of a dB from clip-to-clip variation, and picking the clip that agrees with the hypothesis would have manufactured a positive result.<br><br><b>Caveat that cuts the other way:</b> this is one training run per arm (seed 0). A 0.28 dB gap is small enough that run-to-run variance is not ruled out. The honest reading is <em>no evidence flow weighting helps moving regions</em> — not proof that it hurts.<br><br>Overall PSNR was never going to settle this: it averages every pixel, so a pure redistribution nets out. Only the <b>moving</b> column can discriminate.</div></section>
83
+
84
+ <section>
85
+ <h2>Reconstruction</h2>
86
+ <div class="grid"><div class="card"><div class="head"><span class="name">original</span><span class="desc">resized + subsampled input</span></div><video src="original.mp4" muted loop playsinline controls preload="metadata"></video><div class="metric">reference · 77 frames @ 256×256</div></div><div class="card"><div class="head"><span class="name">base Wan2.2</span><span class="desc">frozen VAE, no adapter</span></div><video src="recon_base.mp4" muted loop playsinline controls preload="metadata"></video><div class="metric">PSNR <b>35.84 dB</b> · MSE <b>2.61e-04</b></div></div><div class="card"><div class="head"><span class="name">control · flow_weight 0</span><span class="desc">6fps, edge+LPIPS only</span></div><video src="recon_fps6.mp4" muted loop playsinline controls preload="metadata"></video><div class="metric">PSNR <b>38.61 dB</b> · MSE <b>1.38e-04</b> · <span class="delta up">+2.77 dB vs base</span></div></div><div class="card"><div class="head"><span class="name">treatment · flow_weight 1</span><span class="desc">6fps, L1 weighted by motion</span></div><video src="recon_flow.mp4" muted loop playsinline controls preload="metadata"></video><div class="metric">PSNR <b>38.64 dB</b> · MSE <b>1.37e-04</b> · <span class="delta up">+2.80 dB vs base</span></div></div></div>
87
+ </section>
88
+
89
+ <section>
90
+ <h2>Error maps</h2>
91
+ <div class="grid"><div class="card"><div class="head"><span class="name">diff ×20</span><span class="desc">|original − base Wan2.2|</span></div><video src="diff_base.mp4" muted loop playsinline controls preload="metadata"></video><div class="metric">brighter = larger error</div></div><div class="card"><div class="head"><span class="name">diff ×20</span><span class="desc">|original − control · flow_weight 0|</span></div><video src="diff_fps6.mp4" muted loop playsinline controls preload="metadata"></video><div class="metric">brighter = larger error</div></div><div class="card"><div class="head"><span class="name">diff ×20</span><span class="desc">|original − treatment · flow_weight 1|</span></div><video src="diff_flow.mp4" muted loop playsinline controls preload="metadata"></video><div class="metric">brighter = larger error</div></div><div class="card"><div class="head"><span class="name">motion weight</span><span class="desc">m̂ from optical flow</span></div><video src="motion_weight.mp4" muted loop playsinline controls preload="metadata"></video><div class="metric">what <b>flow</b> up-weighted · 5.1% of pixels are “moving”</div></div></div>
92
+ </section>
93
+
94
+ <section>
95
+ <h2>PSNR split by motion · this clip</h2>
96
+ <div class="tbl-wrap"><table>
97
+ <thead><tr><th>adapter</th><th>moving (m̂≥0.5)</th>
98
+ <th>static (m̂≤0.1)</th><th>all pixels</th></tr></thead>
99
+ <tbody><tr><td>base (frozen)</td><td>31.43</td><td>37.14</td><td>35.84</td></tr><tr><td>control (flow_weight 0)</td><td>34.30</td><td>39.87</td><td>38.61</td></tr><tr><td>flow (flow_weight 1)</td><td>34.42</td><td>39.87</td><td>38.64</td></tr><tr class="delta-row"><td>flow − control</td><td class="delta up">+0.12 dB</td><td class="delta flat">-0.00 dB</td><td class="delta up">+0.04 dB</td></tr></tbody>
100
+ </table></div>
101
+ </section>
102
+
103
+ <section>
104
+ <h2>Val set · 32 held-out clips</h2>
105
+ <div class="meta" style="padding:0 0 10px">
106
+ The clip above is one sample; this is the population. Same motion split, same
107
+ <code>lora_last.pt</code> adapters, 32 val clips at 6fps
108
+ (4.8% of pixels moving) ·
109
+ <code>compare_flow_adapters.py</code>
110
+ </div>
111
+ <div class="tbl-wrap"><table>
112
+ <thead><tr><th>adapter</th><th>moving (m̂≥0.5)</th>
113
+ <th>static (m̂≤0.1)</th><th>all pixels</th></tr></thead>
114
+ <tbody><tr><td>base (frozen)</td><td>34.04</td><td>36.77</td><td>36.48</td></tr><tr><td>control (flow_weight 0)</td><td>36.83</td><td>39.96</td><td>39.62</td></tr><tr><td>flow (flow_weight 1)</td><td>36.55</td><td>40.16</td><td>39.84</td></tr><tr class="delta-row"><td>flow − control</td><td class="delta down">-0.28 dB</td><td class="delta up">+0.20 dB</td><td class="delta up">+0.22 dB</td></tr></tbody>
115
+ </table></div>
116
+ </section>
117
+
118
+ <footer>
119
+ Both adapters: LoRA on the Wan2.2 causal 3D VAE (<code>Wan-AI/Wan2.2-TI2V-5B</code>),
120
+ r=32 α=32, all conv targets, 4000 steps at 6fps, edge-gradient L1 + LPIPS 0.1.
121
+ The only difference is <code>flow_weight</code> (0 vs 1); fps is held fixed, so the
122
+ ~4 dB fps effect is not a confound here. Judged from <code>lora_last.pt</code> because
123
+ <code>lora_best.pt</code> is selected on <em>unweighted</em> val MSE, which works against
124
+ the flow objective. Diff videos are |original − recon| amplified ×20
125
+ through a hot colormap.
126
+ </footer>
127
+ <script>
128
+ document.getElementById('toggle').addEventListener('click', () => {
129
+ const vids = [...document.querySelectorAll('video')];
130
+ const anyPaused = vids.some(v => v.paused);
131
+ vids.forEach(v => anyPaused ? v.play().catch(() => {}) : v.pause());
132
+ });
133
+ </script>
134
+ </body>
135
  </html>
metrics.json ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "input": "/group2/ct/weihanx/world_model/data/videos/freetacman/CutTofu/CutTofu_1_tactile_left.mp4",
3
+ "n_native_frames": 390,
4
+ "stride": 5,
5
+ "num_frames": 77,
6
+ "fps": 6.0,
7
+ "src_fps": 30.0,
8
+ "height": 256,
9
+ "width": 256,
10
+ "diff_amp": 20.0,
11
+ "flow_floor": 1.5,
12
+ "hi": 0.5,
13
+ "lo": 0.1,
14
+ "moving_pixel_frac": 0.051228512078523636,
15
+ "arms": [
16
+ {
17
+ "name": "base",
18
+ "adapter": null,
19
+ "step": null,
20
+ "mse": 0.0002605195331852883,
21
+ "psnr": 35.8415970869247,
22
+ "split": {
23
+ "moving": 31.427666249287004,
24
+ "static": 37.143628060008346
25
+ }
26
+ },
27
+ {
28
+ "name": "fps6",
29
+ "adapter": "./lora_out_fps6/lora_last.pt",
30
+ "step": 4000,
31
+ "mse": 0.00013778584252577275,
32
+ "psnr": 38.60795403827545,
33
+ "split": {
34
+ "moving": 34.299859705201655,
35
+ "static": 39.87059917677676
36
+ }
37
+ },
38
+ {
39
+ "name": "flow",
40
+ "adapter": "./lora_out_flow/lora_last.pt",
41
+ "step": 4000,
42
+ "mse": 0.00013665476581081748,
43
+ "psnr": 38.6437521776387,
44
+ "split": {
45
+ "moving": 34.4247495927023,
46
+ "static": 39.86891655585387
47
+ }
48
+ }
49
+ ]
50
+ }
motion_weight.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2199c4d7b31979a1bfa89b184b601172b5ad56ec5c88b100bb125d803200a082
3
+ size 131181
original.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2f49987779bac0426c6656e4e2a5c3b5ae4aa76787800a13f40381356132322a
3
+ size 409379
recon_base.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fd004e9be5fb2b1a6605ed953370293ab9a0613400e7961c26ad60fef8401b71
3
+ size 315528
recon_flow.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:689f3e2b5b10103bc90bcb23249036bc0425c19f919f8b48612988c26d8566a7
3
+ size 268690
recon_fps6.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:adfad78bad4982a5d6b32f0e140221215405087f0a1803d068568f04a8b138c9
3
+ size 268259
val_split.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "source": "compare_flow_adapters.py --adapters ./lora_out_fps6/lora_last.pt ./lora_out_flow/lora_last.pt --fps 6 --num-clips 32",
3
+ "log": "slurm-logs/cmp_flow_val.log",
4
+ "num_clips": 32,
5
+ "fps": 6,
6
+ "hi": 0.5,
7
+ "lo": 0.1,
8
+ "moving_pixel_frac": 0.048,
9
+ "arms": [
10
+ {"name": "base", "label": "base (frozen)", "moving": 34.04, "static": 36.77, "all": 36.48},
11
+ {"name": "fps6", "label": "control (flow_weight 0)", "moving": 36.83, "static": 39.96, "all": 39.62},
12
+ {"name": "flow", "label": "flow (flow_weight 1)", "moving": 36.55, "static": 40.16, "all": 39.84}
13
+ ]
14
+ }