rli14 commited on
Commit
eb545d3
·
verified ·
1 Parent(s): 93fa29b

rsm_rise code snapshot (HF_PUSH_ALL) (part 4)

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +1 -0
  2. gen_q_rsm/ogbench_genq/experiments/humanoidmaze-medium-navigate-v0/results/0/rsm_a1_g995.json +32 -0
  3. gen_q_rsm/ogbench_genq/experiments/humanoidmaze-medium-navigate-v0/results/0/rsm_a3_g99.json +32 -0
  4. gen_q_rsm/ogbench_genq/experiments/humanoidmaze-medium-navigate-v0/results/0/rsm_a3_g995.json +32 -0
  5. gen_q_rsm/ogbench_genq/experiments/humanoidmaze-medium-navigate-v0/results/0/snapshots_ei25k/rsm_a1_g995.json +32 -0
  6. gen_q_rsm/ogbench_genq/experiments/humanoidmaze-medium-navigate-v0/results/0/snapshots_ei25k/rsm_a3_g99.json +32 -0
  7. gen_q_rsm/ogbench_genq/experiments/humanoidmaze-medium-navigate-v0/results/0/snapshots_ei25k/rsm_a3_g995.json +32 -0
  8. gen_q_rsm/ogbench_genq/experiments/humanoidmaze-medium-navigate-v0/results/1/gcbc.json +47 -0
  9. gen_q_rsm/ogbench_genq/experiments/humanoidmaze-medium-navigate-v0/results/1/gciql.json +66 -0
  10. gen_q_rsm/ogbench_genq/experiments/humanoidmaze-medium-navigate-v0/results/1/gciql_genq.json +55 -0
  11. gen_q_rsm/ogbench_genq/experiments/humanoidmaze-medium-navigate-v0/results/1/gciql_genq_rec_b09.json +59 -0
  12. gen_q_rsm/ogbench_genq/experiments/humanoidmaze-medium-navigate-v0/results/1/gciql_genq_rec_b09.json.done +0 -0
  13. gen_q_rsm/ogbench_genq/experiments/humanoidmaze-medium-navigate-v0/results/1/gciql_genq_rec_b095.json +59 -0
  14. gen_q_rsm/ogbench_genq/experiments/humanoidmaze-medium-navigate-v0/results/1/gciql_genq_rec_b095.json.done +0 -0
  15. gen_q_rsm/ogbench_genq/experiments/humanoidmaze-medium-navigate-v0/results/2/gcbc.json +47 -0
  16. gen_q_rsm/ogbench_genq/experiments/humanoidmaze-medium-navigate-v0/results/2/gciql.json +66 -0
  17. gen_q_rsm/ogbench_genq/experiments/humanoidmaze-medium-navigate-v0/results/2/gciql_genq.json +55 -0
  18. gen_q_rsm/ogbench_genq/experiments/humanoidmaze-medium-navigate-v0/results/2/gciql_genq_rec_b09.json +59 -0
  19. gen_q_rsm/ogbench_genq/experiments/humanoidmaze-medium-navigate-v0/results/2/gciql_genq_rec_b09.json.done +0 -0
  20. gen_q_rsm/ogbench_genq/experiments/humanoidmaze-medium-navigate-v0/results/2/gciql_genq_rec_b095.json +59 -0
  21. gen_q_rsm/ogbench_genq/experiments/humanoidmaze-medium-navigate-v0/results/2/gciql_genq_rec_b095.json.done +0 -0
  22. gen_q_rsm/ogbench_genq/experiments/pack8_ogbench.sh +72 -0
  23. gen_q_rsm/ogbench_genq/experiments/pack_combined_pxonly.sh +42 -0
  24. gen_q_rsm/ogbench_genq/experiments/pack_eval_visual_rsm_empirical_20k.sh +86 -0
  25. gen_q_rsm/ogbench_genq/experiments/pack_fair_px_awr.sh +106 -0
  26. gen_q_rsm/ogbench_genq/experiments/pack_gate_visual_rsm_gamma_beta.sh +73 -0
  27. gen_q_rsm/ogbench_genq/experiments/pack_goalcls_e2e.sh +44 -0
  28. gen_q_rsm/ogbench_genq/experiments/pack_goalclsbin_e2e.sh +44 -0
  29. gen_q_rsm/ogbench_genq/experiments/pack_goalpred_fair_px_awr.sh +100 -0
  30. gen_q_rsm/ogbench_genq/experiments/pack_qfilter_fast.sh +41 -0
  31. gen_q_rsm/ogbench_genq/experiments/pack_qfilter_recon.sh +49 -0
  32. gen_q_rsm/ogbench_genq/experiments/pack_rdec_e2e.sh +35 -0
  33. gen_q_rsm/ogbench_genq/experiments/pack_smooth_e2e.sh +60 -0
  34. gen_q_rsm/ogbench_genq/experiments/pack_smooth_enc.sh +41 -0
  35. gen_q_rsm/ogbench_genq/experiments/pack_valrew_enc.sh +49 -0
  36. gen_q_rsm/ogbench_genq/experiments/pack_valrew_rsm.sh +67 -0
  37. gen_q_rsm/ogbench_genq/experiments/pack_visual_cube_coordfree.sh +38 -0
  38. gen_q_rsm/ogbench_genq/experiments/pack_visual_cube_recononly.sh +61 -0
  39. gen_q_rsm/ogbench_genq/experiments/pack_visual_cube_recononly_cal.sh +36 -0
  40. gen_q_rsm/ogbench_genq/experiments/pack_visual_cube_recursion.sh +94 -0
  41. gen_q_rsm/ogbench_genq/experiments/pack_visual_rsm_fair_training.sh +298 -0
  42. gen_q_rsm/ogbench_genq/experiments/pack_visual_rsm_occupancy_recipe_ablation.sh +222 -0
  43. gen_q_rsm/ogbench_genq/experiments/pack_visual_rsm_onehop_30k_eval.sh +147 -0
  44. gen_q_rsm/ogbench_genq/experiments/pack_visual_rsm_onehop_v2.sh +346 -0
  45. gen_q_rsm/ogbench_genq/experiments/pack_visual_rsm_protected_endpoint_ablation.sh +95 -0
  46. gen_q_rsm/ogbench_genq/experiments/pack_visual_rsm_recursion_continuation.sh +412 -0
  47. gen_q_rsm/ogbench_genq/experiments/pack_visual_rsm_recursion_sweep.sh +353 -0
  48. gen_q_rsm/ogbench_genq/experiments/pointmaze-giant-navigate-v0/results/0/rsm_newcov_g995.json +195 -0
  49. gen_q_rsm/ogbench_genq/experiments/pointmaze-large-navigate-v0/results/0/rsm_s1.json +194 -0
  50. gen_q_rsm/ogbench_genq/experiments/pointmaze-medium-navigate-v0/figures/suc.png +0 -0
.gitattributes CHANGED
@@ -61,3 +61,4 @@ gen_q_rsm/misc/lewm/fig_compute_vs_perf.png filter=lfs diff=lfs merge=lfs -text
61
  gen_q_rsm/misc/lewm/fig_cost_heatmap.png filter=lfs diff=lfs merge=lfs -text
62
  gen_q_rsm/misc/lewm/fig_horizon.png filter=lfs diff=lfs merge=lfs -text
63
  gen_q_rsm/misc/lewm/fig_mechanism.png filter=lfs diff=lfs merge=lfs -text
 
 
61
  gen_q_rsm/misc/lewm/fig_cost_heatmap.png filter=lfs diff=lfs merge=lfs -text
62
  gen_q_rsm/misc/lewm/fig_horizon.png filter=lfs diff=lfs merge=lfs -text
63
  gen_q_rsm/misc/lewm/fig_mechanism.png filter=lfs diff=lfs merge=lfs -text
64
+ gen_q_rsm/ogbench_genq/experiments/puzzle-3x3-play-v0/figures/fix_sweep.png filter=lfs diff=lfs merge=lfs -text
gen_q_rsm/ogbench_genq/experiments/humanoidmaze-medium-navigate-v0/results/0/rsm_a1_g995.json ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "method": "rsm",
3
+ "readout": "elbo",
4
+ "env": "humanoidmaze-medium-navigate-v0",
5
+ "seed": 0,
6
+ "alpha": 1.0,
7
+ "gamma": 0.995,
8
+ "recursion": "prob",
9
+ "rec_after": 100000,
10
+ "rec_beta": 0.98,
11
+ "rec_guard": "tails",
12
+ "gamma_spectrum_lo": 0.95,
13
+ "latent": false,
14
+ "success_rate": 0.21333333333333332,
15
+ "best_sr": 0.21333333333333332,
16
+ "per_task": [
17
+ 0.4,
18
+ 0.4,
19
+ 0.06666666666666667,
20
+ 0.0,
21
+ 0.2
22
+ ],
23
+ "curve": [
24
+ [
25
+ 50000,
26
+ 0.21333333333333332
27
+ ]
28
+ ],
29
+ "train_steps": 1000000,
30
+ "wall_clock_sec": 10202.2,
31
+ "wandb_url": "https://wandb.ai/improbableai_zwh/gen-q-policy-improvement/runs/ije7uysp"
32
+ }
gen_q_rsm/ogbench_genq/experiments/humanoidmaze-medium-navigate-v0/results/0/rsm_a3_g99.json ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "method": "rsm",
3
+ "readout": "elbo",
4
+ "env": "humanoidmaze-medium-navigate-v0",
5
+ "seed": 0,
6
+ "alpha": 3.0,
7
+ "gamma": 0.99,
8
+ "recursion": "prob",
9
+ "rec_after": 100000,
10
+ "rec_beta": 0.98,
11
+ "rec_guard": "tails",
12
+ "gamma_spectrum_lo": 0.95,
13
+ "latent": false,
14
+ "success_rate": 0.05333333333333333,
15
+ "best_sr": 0.05333333333333333,
16
+ "per_task": [
17
+ 0.06666666666666667,
18
+ 0.13333333333333333,
19
+ 0.0,
20
+ 0.0,
21
+ 0.06666666666666667
22
+ ],
23
+ "curve": [
24
+ [
25
+ 50000,
26
+ 0.05333333333333333
27
+ ]
28
+ ],
29
+ "train_steps": 1000000,
30
+ "wall_clock_sec": 10423.2,
31
+ "wandb_url": "https://wandb.ai/improbableai_zwh/gen-q-policy-improvement/runs/sd33nr9p"
32
+ }
gen_q_rsm/ogbench_genq/experiments/humanoidmaze-medium-navigate-v0/results/0/rsm_a3_g995.json ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "method": "rsm",
3
+ "readout": "elbo",
4
+ "env": "humanoidmaze-medium-navigate-v0",
5
+ "seed": 0,
6
+ "alpha": 3.0,
7
+ "gamma": 0.995,
8
+ "recursion": "prob",
9
+ "rec_after": 100000,
10
+ "rec_beta": 0.98,
11
+ "rec_guard": "tails",
12
+ "gamma_spectrum_lo": 0.95,
13
+ "latent": false,
14
+ "success_rate": 0.06666666666666668,
15
+ "best_sr": 0.06666666666666668,
16
+ "per_task": [
17
+ 0.0,
18
+ 0.0,
19
+ 0.2,
20
+ 0.0,
21
+ 0.13333333333333333
22
+ ],
23
+ "curve": [
24
+ [
25
+ 50000,
26
+ 0.06666666666666668
27
+ ]
28
+ ],
29
+ "train_steps": 1000000,
30
+ "wall_clock_sec": 10527.5,
31
+ "wandb_url": "https://wandb.ai/improbableai_zwh/gen-q-policy-improvement/runs/xfdrqb5y"
32
+ }
gen_q_rsm/ogbench_genq/experiments/humanoidmaze-medium-navigate-v0/results/0/snapshots_ei25k/rsm_a1_g995.json ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "method": "rsm",
3
+ "readout": "elbo",
4
+ "env": "humanoidmaze-medium-navigate-v0",
5
+ "seed": 0,
6
+ "alpha": 1.0,
7
+ "gamma": 0.995,
8
+ "recursion": "prob",
9
+ "rec_after": 100000,
10
+ "rec_beta": 0.98,
11
+ "rec_guard": "tails",
12
+ "gamma_spectrum_lo": 0.95,
13
+ "latent": false,
14
+ "success_rate": 0.24000000000000005,
15
+ "best_sr": 0.24000000000000005,
16
+ "per_task": [
17
+ 0.3333333333333333,
18
+ 0.2,
19
+ 0.2,
20
+ 0.0,
21
+ 0.4666666666666667
22
+ ],
23
+ "curve": [
24
+ [
25
+ 25000,
26
+ 0.24000000000000005
27
+ ]
28
+ ],
29
+ "train_steps": 1000000,
30
+ "wall_clock_sec": 10403.8,
31
+ "wandb_url": "https://wandb.ai/improbableai_zwh/gen-q-policy-improvement/runs/wtwg3iu0"
32
+ }
gen_q_rsm/ogbench_genq/experiments/humanoidmaze-medium-navigate-v0/results/0/snapshots_ei25k/rsm_a3_g99.json ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "method": "rsm",
3
+ "readout": "elbo",
4
+ "env": "humanoidmaze-medium-navigate-v0",
5
+ "seed": 0,
6
+ "alpha": 3.0,
7
+ "gamma": 0.99,
8
+ "recursion": "prob",
9
+ "rec_after": 100000,
10
+ "rec_beta": 0.98,
11
+ "rec_guard": "tails",
12
+ "gamma_spectrum_lo": 0.95,
13
+ "latent": false,
14
+ "success_rate": 0.08,
15
+ "best_sr": 0.08,
16
+ "per_task": [
17
+ 0.06666666666666667,
18
+ 0.0,
19
+ 0.13333333333333333,
20
+ 0.0,
21
+ 0.2
22
+ ],
23
+ "curve": [
24
+ [
25
+ 25000,
26
+ 0.08
27
+ ]
28
+ ],
29
+ "train_steps": 1000000,
30
+ "wall_clock_sec": 11003.8,
31
+ "wandb_url": "https://wandb.ai/improbableai_zwh/gen-q-policy-improvement/runs/2k7urwdm"
32
+ }
gen_q_rsm/ogbench_genq/experiments/humanoidmaze-medium-navigate-v0/results/0/snapshots_ei25k/rsm_a3_g995.json ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "method": "rsm",
3
+ "readout": "elbo",
4
+ "env": "humanoidmaze-medium-navigate-v0",
5
+ "seed": 0,
6
+ "alpha": 3.0,
7
+ "gamma": 0.995,
8
+ "recursion": "prob",
9
+ "rec_after": 100000,
10
+ "rec_beta": 0.98,
11
+ "rec_guard": "tails",
12
+ "gamma_spectrum_lo": 0.95,
13
+ "latent": false,
14
+ "success_rate": 0.10666666666666666,
15
+ "best_sr": 0.10666666666666666,
16
+ "per_task": [
17
+ 0.13333333333333333,
18
+ 0.0,
19
+ 0.13333333333333333,
20
+ 0.0,
21
+ 0.26666666666666666
22
+ ],
23
+ "curve": [
24
+ [
25
+ 25000,
26
+ 0.10666666666666666
27
+ ]
28
+ ],
29
+ "train_steps": 1000000,
30
+ "wall_clock_sec": 11113.8,
31
+ "wandb_url": "https://wandb.ai/improbableai_zwh/gen-q-policy-improvement/runs/qajff9cq"
32
+ }
gen_q_rsm/ogbench_genq/experiments/humanoidmaze-medium-navigate-v0/results/1/gcbc.json ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "method": "gcbc",
3
+ "env": "humanoidmaze-medium-navigate-v0",
4
+ "seed": 1,
5
+ "success_rate": 0.048,
6
+ "best_sr": 0.09333333333333334,
7
+ "per_task": [
8
+ 0.02,
9
+ 0.02,
10
+ 0.06,
11
+ 0.0,
12
+ 0.14
13
+ ],
14
+ "curve": [
15
+ [
16
+ 50000,
17
+ 0.08
18
+ ],
19
+ [
20
+ 100000,
21
+ 0.08
22
+ ],
23
+ [
24
+ 150000,
25
+ 0.05333333333333333
26
+ ],
27
+ [
28
+ 200000,
29
+ 0.05333333333333333
30
+ ],
31
+ [
32
+ 250000,
33
+ 0.09333333333333334
34
+ ],
35
+ [
36
+ 300000,
37
+ 0.06666666666666667
38
+ ],
39
+ [
40
+ 300000,
41
+ 0.048
42
+ ]
43
+ ],
44
+ "train_steps": 300000,
45
+ "wall_clock_sec": 4902.5,
46
+ "wandb_url": "https://wandb.ai/dashora7/gen-q-policy-improvement/runs/on41idk9"
47
+ }
gen_q_rsm/ogbench_genq/experiments/humanoidmaze-medium-navigate-v0/results/1/gciql.json ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "method": "gciql",
3
+ "env": "humanoidmaze-medium-navigate-v0",
4
+ "seed": 1,
5
+ "actor_loss": "ddpgbc",
6
+ "alpha": 0.3,
7
+ "expectile": 0.9,
8
+ "success_rate": 0.096,
9
+ "best_sr": 0.14666666666666667,
10
+ "per_task": [
11
+ 0.06,
12
+ 0.1,
13
+ 0.18,
14
+ 0.02,
15
+ 0.12
16
+ ],
17
+ "curve": [
18
+ [
19
+ 50000,
20
+ 0.05333333333333333
21
+ ],
22
+ [
23
+ 100000,
24
+ 0.10666666666666666
25
+ ],
26
+ [
27
+ 150000,
28
+ 0.09333333333333334
29
+ ],
30
+ [
31
+ 200000,
32
+ 0.10666666666666669
33
+ ],
34
+ [
35
+ 250000,
36
+ 0.13333333333333336
37
+ ],
38
+ [
39
+ 300000,
40
+ 0.06666666666666667
41
+ ],
42
+ [
43
+ 350000,
44
+ 0.06666666666666667
45
+ ],
46
+ [
47
+ 400000,
48
+ 0.08
49
+ ],
50
+ [
51
+ 450000,
52
+ 0.08
53
+ ],
54
+ [
55
+ 500000,
56
+ 0.14666666666666667
57
+ ],
58
+ [
59
+ 500000,
60
+ 0.096
61
+ ]
62
+ ],
63
+ "train_steps": 500000,
64
+ "wall_clock_sec": 6944.8,
65
+ "wandb_url": "https://wandb.ai/dashora7/gen-q-policy-improvement/runs/7p4kwtkr"
66
+ }
gen_q_rsm/ogbench_genq/experiments/humanoidmaze-medium-navigate-v0/results/1/gciql_genq.json ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "method": "gciql_genq",
3
+ "env": "humanoidmaze-medium-navigate-v0",
4
+ "seed": 1,
5
+ "actor_loss": "awr",
6
+ "alpha": 30.0,
7
+ "expectile": 0.9,
8
+ "n_occ": 64,
9
+ "sigma": 5.0,
10
+ "ensemble": true,
11
+ "latent": false,
12
+ "genq_npz": "m9_genq_humanoidmaze_medium_navigate_v0.genqjax.npz",
13
+ "success_rate": 0.22400000000000003,
14
+ "best_sr": 0.2533333333333333,
15
+ "per_task": [
16
+ 0.22,
17
+ 0.26,
18
+ 0.14,
19
+ 0.12,
20
+ 0.38
21
+ ],
22
+ "curve": [
23
+ [
24
+ 50000,
25
+ 0.16
26
+ ],
27
+ [
28
+ 100000,
29
+ 0.17333333333333334
30
+ ],
31
+ [
32
+ 150000,
33
+ 0.12
34
+ ],
35
+ [
36
+ 200000,
37
+ 0.24
38
+ ],
39
+ [
40
+ 250000,
41
+ 0.18666666666666668
42
+ ],
43
+ [
44
+ 300000,
45
+ 0.2533333333333333
46
+ ],
47
+ [
48
+ 300000,
49
+ 0.22400000000000003
50
+ ]
51
+ ],
52
+ "train_steps": 300000,
53
+ "wall_clock_sec": 16822.0,
54
+ "wandb_url": "https://wandb.ai/dashora7/gen-q-policy-improvement/runs/ikzc9zvk"
55
+ }
gen_q_rsm/ogbench_genq/experiments/humanoidmaze-medium-navigate-v0/results/1/gciql_genq_rec_b09.json ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "method": "gciql_genq_rec",
3
+ "env": "humanoidmaze-medium-navigate-v0",
4
+ "seed": 1,
5
+ "actor_loss": "awr",
6
+ "alpha": 30.0,
7
+ "expectile": 0.9,
8
+ "n_occ": 16,
9
+ "sigma": 5.0,
10
+ "beta": 0.9,
11
+ "gamma": 0.99,
12
+ "stop_prob": 0.09090909090909101,
13
+ "max_depth": 33,
14
+ "steps_per_jump": 10,
15
+ "midpoint_bc_loss": 0.39999082684516907,
16
+ "genq_npz": "m9_genq_rec_humanoidmaze_medium_navigate_v0_b09.genqjax.npz",
17
+ "success_rate": 0.06,
18
+ "best_sr": 0.10666666666666666,
19
+ "per_task": [
20
+ 0.04,
21
+ 0.04,
22
+ 0.08,
23
+ 0.02,
24
+ 0.12
25
+ ],
26
+ "curve": [
27
+ [
28
+ 50000,
29
+ 0.05333333333333333
30
+ ],
31
+ [
32
+ 100000,
33
+ 0.05333333333333333
34
+ ],
35
+ [
36
+ 150000,
37
+ 0.05333333333333333
38
+ ],
39
+ [
40
+ 200000,
41
+ 0.10666666666666666
42
+ ],
43
+ [
44
+ 250000,
45
+ 0.07999999999999999
46
+ ],
47
+ [
48
+ 300000,
49
+ 0.06666666666666668
50
+ ],
51
+ [
52
+ 300000,
53
+ 0.06
54
+ ]
55
+ ],
56
+ "train_steps": 300000,
57
+ "wall_clock_sec": 19820.3,
58
+ "wandb_url": "https://wandb.ai/dashora7/gen-q-policy-improvement/runs/3y392rbj"
59
+ }
gen_q_rsm/ogbench_genq/experiments/humanoidmaze-medium-navigate-v0/results/1/gciql_genq_rec_b09.json.done ADDED
File without changes
gen_q_rsm/ogbench_genq/experiments/humanoidmaze-medium-navigate-v0/results/1/gciql_genq_rec_b095.json ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "method": "gciql_genq_rec",
3
+ "env": "humanoidmaze-medium-navigate-v0",
4
+ "seed": 1,
5
+ "actor_loss": "awr",
6
+ "alpha": 30.0,
7
+ "expectile": 0.9,
8
+ "n_occ": 16,
9
+ "sigma": 5.0,
10
+ "beta": 0.95,
11
+ "gamma": 0.99,
12
+ "stop_prob": 0.1919191919191919,
13
+ "max_depth": 16,
14
+ "steps_per_jump": 10,
15
+ "midpoint_bc_loss": 0.40003451704978943,
16
+ "genq_npz": "m9_genq_rec_humanoidmaze_medium_navigate_v0_b095.genqjax.npz",
17
+ "success_rate": 0.088,
18
+ "best_sr": 0.10666666666666666,
19
+ "per_task": [
20
+ 0.08,
21
+ 0.04,
22
+ 0.26,
23
+ 0.0,
24
+ 0.06
25
+ ],
26
+ "curve": [
27
+ [
28
+ 50000,
29
+ 0.07999999999999999
30
+ ],
31
+ [
32
+ 100000,
33
+ 0.10666666666666666
34
+ ],
35
+ [
36
+ 150000,
37
+ 0.05333333333333333
38
+ ],
39
+ [
40
+ 200000,
41
+ 0.06666666666666667
42
+ ],
43
+ [
44
+ 250000,
45
+ 0.05333333333333333
46
+ ],
47
+ [
48
+ 300000,
49
+ 0.06666666666666668
50
+ ],
51
+ [
52
+ 300000,
53
+ 0.088
54
+ ]
55
+ ],
56
+ "train_steps": 300000,
57
+ "wall_clock_sec": 11702.1,
58
+ "wandb_url": "https://wandb.ai/dashora7/gen-q-policy-improvement/runs/x4u7q8cy"
59
+ }
gen_q_rsm/ogbench_genq/experiments/humanoidmaze-medium-navigate-v0/results/1/gciql_genq_rec_b095.json.done ADDED
File without changes
gen_q_rsm/ogbench_genq/experiments/humanoidmaze-medium-navigate-v0/results/2/gcbc.json ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "method": "gcbc",
3
+ "env": "humanoidmaze-medium-navigate-v0",
4
+ "seed": 2,
5
+ "success_rate": 0.068,
6
+ "best_sr": 0.08,
7
+ "per_task": [
8
+ 0.04,
9
+ 0.1,
10
+ 0.08,
11
+ 0.0,
12
+ 0.12
13
+ ],
14
+ "curve": [
15
+ [
16
+ 50000,
17
+ 0.05333333333333333
18
+ ],
19
+ [
20
+ 100000,
21
+ 0.05333333333333333
22
+ ],
23
+ [
24
+ 150000,
25
+ 0.08
26
+ ],
27
+ [
28
+ 200000,
29
+ 0.05333333333333333
30
+ ],
31
+ [
32
+ 250000,
33
+ 0.08
34
+ ],
35
+ [
36
+ 300000,
37
+ 0.04
38
+ ],
39
+ [
40
+ 300000,
41
+ 0.068
42
+ ]
43
+ ],
44
+ "train_steps": 300000,
45
+ "wall_clock_sec": 4765.9,
46
+ "wandb_url": "https://wandb.ai/dashora7/gen-q-policy-improvement/runs/oyoge1vd"
47
+ }
gen_q_rsm/ogbench_genq/experiments/humanoidmaze-medium-navigate-v0/results/2/gciql.json ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "method": "gciql",
3
+ "env": "humanoidmaze-medium-navigate-v0",
4
+ "seed": 2,
5
+ "actor_loss": "ddpgbc",
6
+ "alpha": 0.3,
7
+ "expectile": 0.9,
8
+ "success_rate": 0.076,
9
+ "best_sr": 0.10666666666666666,
10
+ "per_task": [
11
+ 0.04,
12
+ 0.04,
13
+ 0.08,
14
+ 0.0,
15
+ 0.22
16
+ ],
17
+ "curve": [
18
+ [
19
+ 50000,
20
+ 0.09333333333333334
21
+ ],
22
+ [
23
+ 100000,
24
+ 0.06666666666666667
25
+ ],
26
+ [
27
+ 150000,
28
+ 0.10666666666666666
29
+ ],
30
+ [
31
+ 200000,
32
+ 0.05333333333333333
33
+ ],
34
+ [
35
+ 250000,
36
+ 0.04
37
+ ],
38
+ [
39
+ 300000,
40
+ 0.08
41
+ ],
42
+ [
43
+ 350000,
44
+ 0.06666666666666667
45
+ ],
46
+ [
47
+ 400000,
48
+ 0.05333333333333333
49
+ ],
50
+ [
51
+ 450000,
52
+ 0.06666666666666667
53
+ ],
54
+ [
55
+ 500000,
56
+ 0.04
57
+ ],
58
+ [
59
+ 500000,
60
+ 0.076
61
+ ]
62
+ ],
63
+ "train_steps": 500000,
64
+ "wall_clock_sec": 6964.0,
65
+ "wandb_url": "https://wandb.ai/dashora7/gen-q-policy-improvement/runs/t6otc77q"
66
+ }
gen_q_rsm/ogbench_genq/experiments/humanoidmaze-medium-navigate-v0/results/2/gciql_genq.json ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "method": "gciql_genq",
3
+ "env": "humanoidmaze-medium-navigate-v0",
4
+ "seed": 2,
5
+ "actor_loss": "awr",
6
+ "alpha": 30.0,
7
+ "expectile": 0.9,
8
+ "n_occ": 64,
9
+ "sigma": 5.0,
10
+ "ensemble": true,
11
+ "latent": false,
12
+ "genq_npz": "m9_genq_humanoidmaze_medium_navigate_v0.genqjax.npz",
13
+ "success_rate": 0.25200000000000006,
14
+ "best_sr": 0.2533333333333333,
15
+ "per_task": [
16
+ 0.2,
17
+ 0.32,
18
+ 0.3,
19
+ 0.06,
20
+ 0.38
21
+ ],
22
+ "curve": [
23
+ [
24
+ 50000,
25
+ 0.16
26
+ ],
27
+ [
28
+ 100000,
29
+ 0.2
30
+ ],
31
+ [
32
+ 150000,
33
+ 0.24
34
+ ],
35
+ [
36
+ 200000,
37
+ 0.18666666666666668
38
+ ],
39
+ [
40
+ 250000,
41
+ 0.2533333333333333
42
+ ],
43
+ [
44
+ 300000,
45
+ 0.2
46
+ ],
47
+ [
48
+ 300000,
49
+ 0.25200000000000006
50
+ ]
51
+ ],
52
+ "train_steps": 300000,
53
+ "wall_clock_sec": 16264.8,
54
+ "wandb_url": "https://wandb.ai/dashora7/gen-q-policy-improvement/runs/kxwpsq7r"
55
+ }
gen_q_rsm/ogbench_genq/experiments/humanoidmaze-medium-navigate-v0/results/2/gciql_genq_rec_b09.json ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "method": "gciql_genq_rec",
3
+ "env": "humanoidmaze-medium-navigate-v0",
4
+ "seed": 2,
5
+ "actor_loss": "awr",
6
+ "alpha": 30.0,
7
+ "expectile": 0.9,
8
+ "n_occ": 16,
9
+ "sigma": 5.0,
10
+ "beta": 0.9,
11
+ "gamma": 0.99,
12
+ "stop_prob": 0.09090909090909101,
13
+ "max_depth": 33,
14
+ "steps_per_jump": 10,
15
+ "midpoint_bc_loss": 0.40774068236351013,
16
+ "genq_npz": "m9_genq_rec_humanoidmaze_medium_navigate_v0_b09.genqjax.npz",
17
+ "success_rate": 0.044,
18
+ "best_sr": 0.10666666666666666,
19
+ "per_task": [
20
+ 0.02,
21
+ 0.0,
22
+ 0.12,
23
+ 0.02,
24
+ 0.06
25
+ ],
26
+ "curve": [
27
+ [
28
+ 50000,
29
+ 0.026666666666666665
30
+ ],
31
+ [
32
+ 100000,
33
+ 0.08
34
+ ],
35
+ [
36
+ 150000,
37
+ 0.08
38
+ ],
39
+ [
40
+ 200000,
41
+ 0.10666666666666666
42
+ ],
43
+ [
44
+ 250000,
45
+ 0.026666666666666665
46
+ ],
47
+ [
48
+ 300000,
49
+ 0.06666666666666668
50
+ ],
51
+ [
52
+ 300000,
53
+ 0.044
54
+ ]
55
+ ],
56
+ "train_steps": 300000,
57
+ "wall_clock_sec": 19894.1,
58
+ "wandb_url": "https://wandb.ai/dashora7/gen-q-policy-improvement/runs/uaz7gkr3"
59
+ }
gen_q_rsm/ogbench_genq/experiments/humanoidmaze-medium-navigate-v0/results/2/gciql_genq_rec_b09.json.done ADDED
File without changes
gen_q_rsm/ogbench_genq/experiments/humanoidmaze-medium-navigate-v0/results/2/gciql_genq_rec_b095.json ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "method": "gciql_genq_rec",
3
+ "env": "humanoidmaze-medium-navigate-v0",
4
+ "seed": 2,
5
+ "actor_loss": "awr",
6
+ "alpha": 30.0,
7
+ "expectile": 0.9,
8
+ "n_occ": 16,
9
+ "sigma": 5.0,
10
+ "beta": 0.95,
11
+ "gamma": 0.99,
12
+ "stop_prob": 0.1919191919191919,
13
+ "max_depth": 16,
14
+ "steps_per_jump": 10,
15
+ "midpoint_bc_loss": 0.40774068236351013,
16
+ "genq_npz": "m9_genq_rec_humanoidmaze_medium_navigate_v0_b095.genqjax.npz",
17
+ "success_rate": 0.052000000000000005,
18
+ "best_sr": 0.08,
19
+ "per_task": [
20
+ 0.1,
21
+ 0.02,
22
+ 0.04,
23
+ 0.0,
24
+ 0.1
25
+ ],
26
+ "curve": [
27
+ [
28
+ 50000,
29
+ 0.06666666666666668
30
+ ],
31
+ [
32
+ 100000,
33
+ 0.06666666666666667
34
+ ],
35
+ [
36
+ 150000,
37
+ 0.06666666666666667
38
+ ],
39
+ [
40
+ 200000,
41
+ 0.04
42
+ ],
43
+ [
44
+ 250000,
45
+ 0.08
46
+ ],
47
+ [
48
+ 300000,
49
+ 0.026666666666666665
50
+ ],
51
+ [
52
+ 300000,
53
+ 0.052000000000000005
54
+ ]
55
+ ],
56
+ "train_steps": 300000,
57
+ "wall_clock_sec": 11608.2,
58
+ "wandb_url": "https://wandb.ai/dashora7/gen-q-policy-improvement/runs/1lscrkjb"
59
+ }
gen_q_rsm/ogbench_genq/experiments/humanoidmaze-medium-navigate-v0/results/2/gciql_genq_rec_b095.json.done ADDED
File without changes
gen_q_rsm/ogbench_genq/experiments/pack8_ogbench.sh ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Consolidate the OGBench campaign onto EXACTLY 8 packed GPUs (user directive:
3
+ # restrict to 8 GPUs, pack multiple cells/GPU where memory allows). All 8 existing
4
+ # state cells RESUME from their resume_*.pkl (zero progress lost); new seed + scene
5
+ # rec-ON arms start fresh. Per-bundle XLA mem fraction keeps cells from OOM-ing each
6
+ # other (memory: over-packing caused OOM — so small cells 2-4/GPU, giants solo).
7
+ set -uo pipefail
8
+ cd /proj/inf-scaling/zwhong/projs/gen_q/.claude/worktrees/rsm-ogbench-matrix
9
+ mkdir -p ogbench_genq/experiments/sweeps/pack8 logs
10
+ EXC="select[hname!='p4-r15-n2' && hname!='p6-r29-n1' && hname!='p3-r09-n3' && hname!='p2-r13-n4' && hname!='p2-r28-n4' && hname!='p3-r30-n4']"
11
+ CE="--ckpt_every 25000"
12
+
13
+ # ---- kill the scattered single-cell my-branch jobs (all have resume ckpts) ----
14
+ for J in 273670 257673 257674 275231; do bkill "$J" 2>/dev/null; done
15
+ sleep 8
16
+
17
+ P=ogbench_genq/experiments/sweeps/pack8
18
+ # each plan line: <env> <seed> <flags...> (run_sweep2.sh -> run_rsm.sh, flags forwarded to rsm.py)
19
+
20
+ # G1: humanoidmaze-large (giant, solo)
21
+ cat > $P/b1.txt <<EOF
22
+ humanoidmaze-large-navigate-v0 0 --train_steps 1000000 --alpha 0.03 --gamma 0.995 --variant_tag newcov_g995 --ckpt ckpt/resume_hml.pkl $CE
23
+ EOF
24
+ # G2: humanoidmaze-giant (giant, solo)
25
+ cat > $P/b2.txt <<EOF
26
+ humanoidmaze-giant-navigate-v0 0 --train_steps 1000000 --alpha 0.03 --gamma 0.995 --variant_tag newcov_g995 --ckpt ckpt/resume_hmg.pkl $CE
27
+ EOF
28
+ # G3: pointmaze-giant + antmaze-teleport
29
+ cat > $P/b3.txt <<EOF
30
+ pointmaze-giant-navigate-v0 0 --train_steps 1000000 --alpha 0.03 --gamma 0.995 --variant_tag newcov_g995 --ckpt ckpt/resume_pmg.pkl $CE
31
+ antmaze-teleport-navigate-v0 0 --train_steps 1000000 --alpha 3.0 --variant_tag newcov_a3 --ckpt ckpt/resume_amt.pkl $CE
32
+ EOF
33
+ # G4: cube-triple + cube-quadruple
34
+ cat > $P/b4.txt <<EOF
35
+ cube-triple-play-v0 0 --train_steps 1000000 --alpha 3.0 --variant_tag newcov_a3 --ckpt ckpt/resume_ct.pkl $CE
36
+ cube-quadruple-play-v0 0 --train_steps 1000000 --alpha 3.0 --variant_tag newcov_a3 --ckpt ckpt/resume_cq.pkl $CE
37
+ EOF
38
+ # G5: puzzle-4x5 + puzzle-4x6
39
+ cat > $P/b5.txt <<EOF
40
+ puzzle-4x5-play-v0 0 --train_steps 1000000 --variant_tag newcov --ckpt ckpt/resume_p45.pkl $CE
41
+ puzzle-4x6-play-v0 0 --train_steps 1000000 --variant_tag newcov --ckpt ckpt/resume_p46.pkl $CE
42
+ EOF
43
+ # G6: scene rec-ON (continuous probe, untried lever) + puzzle-3x3 seeds 1,2
44
+ cat > $P/b6.txt <<EOF
45
+ scene-play-v0 0 --train_steps 1000000 --alpha 3.0 --recursion on --rec_guard tails --rec_beta 0.98 --rec_after 100000 --variant_tag reconA3 --ckpt ckpt/resume_scene_reconA3.pkl $CE
46
+ puzzle-3x3-play-v0 1 --train_steps 1000000 --variant_tag seed1 --ckpt ckpt/resume_puz3_s1.pkl $CE
47
+ puzzle-3x3-play-v0 2 --train_steps 1000000 --variant_tag seed2 --ckpt ckpt/resume_puz3_s2.pkl $CE
48
+ EOF
49
+ # G7: antmaze-medium a3 seeds 1,2 + antsoccer-a0.3 seed1
50
+ cat > $P/b7.txt <<EOF
51
+ antmaze-medium-navigate-v0 1 --train_steps 1000000 --alpha 3.0 --variant_tag a3_s1 --ckpt ckpt/resume_amed_s1.pkl $CE
52
+ antmaze-medium-navigate-v0 2 --train_steps 1000000 --alpha 3.0 --variant_tag a3_s2 --ckpt ckpt/resume_amed_s2.pkl $CE
53
+ antsoccer-arena-navigate-v0 1 --train_steps 1000000 --alpha 0.3 --variant_tag a03_s1 --ckpt ckpt/resume_asoc_s1.pkl $CE
54
+ EOF
55
+ # G8: antsoccer-a0.3 seed2 + pointmaze-teleport seeds 1,2 (all small)
56
+ cat > $P/b8.txt <<EOF
57
+ antsoccer-arena-navigate-v0 2 --train_steps 1000000 --alpha 0.3 --variant_tag a03_s2 --ckpt ckpt/resume_asoc_s2.pkl $CE
58
+ pointmaze-teleport-navigate-v0 1 --train_steps 1000000 --alpha 0.03 --variant_tag s1 --ckpt ckpt/resume_pmt_s1.pkl $CE
59
+ pointmaze-teleport-navigate-v0 2 --train_steps 1000000 --alpha 0.03 --variant_tag s2 --ckpt ckpt/resume_pmt_s2.pkl $CE
60
+ EOF
61
+
62
+ # ---- submit 8 bundles; mem fraction ~ 0.85/(cells) with headroom ----
63
+ declare -A MEM=( [b1]=0.85 [b2]=0.85 [b3]=0.42 [b4]=0.42 [b5]=0.42 [b6]=0.28 [b7]=0.28 [b8]=0.20 )
64
+ for b in b1 b2 b3 b4 b5 b6 b7 b8; do
65
+ mf=${MEM[$b]}
66
+ bsub -q preemptable -G grp_preemptable -J "rsm_pack_$b" \
67
+ -gpu "num=1/task:mode=shared:j_exclusive=yes" -R "$EXC" \
68
+ -o "logs/pack8_${b}.log" \
69
+ bash -c "export XLA_PYTHON_CLIENT_MEM_FRACTION=$mf WANDB_MODE=disabled; bash ogbench_genq/experiments/run_sweep2.sh ogbench_genq/experiments/sweeps/pack8/$b.txt"
70
+ echo "[pack8] submitted $b (mem_frac=$mf)"
71
+ done
72
+ echo "[pack8] 8 bundles submitted (<=8 GPUs)."
gen_q_rsm/ogbench_genq/experiments/pack_combined_pxonly.sh ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Ground-truth check: does strictly-pixels-only (--drop_proprio) work at all?
3
+ # Uses the EXISTING combined encoder+latents (SR 0.592 WITH proprio). Two arms:
4
+ # prop: concat(proprio,z) -- reproduces the 0.592 control
5
+ # px: z alone (--drop_proprio) -- strictly pixels-only; tests the new code +
6
+ # whether proprio was load-bearing for the combined win.
7
+ # combined uses the cube COORDINATE (not fair) -- this is purely a plumbing + ablation
8
+ # check, not the fair headline.
9
+ set -uo pipefail
10
+ CF=/proj/inf-scaling/zwhong/projs/gen_q/.claude/worktrees/rsm-visual-coordfree
11
+ REC=/proj/inf-scaling/zwhong/projs/gen_q/.claude/worktrees/rsm-visual-recursion
12
+ cd "$CF"
13
+ [ -f .env ] && set -a && . ./.env && set +a
14
+ export OGBENCH_IMPLS=${OGBENCH_IMPLS:-$HOME/ogbench_ref/impls}
15
+ export XLA_PYTHON_CLIENT_PREALLOCATE=false XLA_PYTHON_CLIENT_MEM_FRACTION=0.40
16
+ export MUJOCO_GL=egl WANDB_MODE=disabled
17
+ PY=$REC/.ogbench_venv/bin/python
18
+ ENV=visual-cube-single-play-v0
19
+ ENC=$REC/ckpt/pixel_enc_visual_cube_single_play_v0_combined.npz
20
+ LAT=$REC/ckpt/visual_cube_single_combined_latents.npz
21
+ MODE=${1:-full}
22
+ mkdir -p bsub_out ckpt
23
+ if [ "$MODE" = "smoke" ]; then RSTEPS=800; REV=400; else RSTEPS=1000000; REV=25000; fi
24
+ [ -f "$ENC" ] && [ -f "$LAT" ] || { echo "FATAL: combined enc/lat missing"; exit 1; }
25
+
26
+ $PY ogbench_genq/rsm.py --env "$ENV" --latent_npz "$LAT" --pixel_encoder "$ENC" \
27
+ --recursion off --alpha 0.3 --train_steps "$RSTEPS" --eval_interval "$REV" \
28
+ --ckpt ckpt/rsm_comb_prop.pkl --ckpt_every "$REV" \
29
+ --variant_tag combined_prop_recoff --wandb_mode disabled \
30
+ > bsub_out/rsm_comb_prop.log 2>&1 &
31
+ A=$!
32
+ $PY ogbench_genq/rsm.py --env "$ENV" --latent_npz "$LAT" --pixel_encoder "$ENC" --drop_proprio \
33
+ --recursion off --alpha 0.3 --train_steps "$RSTEPS" --eval_interval "$REV" \
34
+ --ckpt ckpt/rsm_comb_px.pkl --ckpt_every "$REV" \
35
+ --variant_tag combined_px_recoff --wandb_mode disabled \
36
+ > bsub_out/rsm_comb_px.log 2>&1 &
37
+ B=$!
38
+ echo "[comb-pxonly] prop pid=$A px pid=$B ; waiting"
39
+ wait "$A" || true; wait "$B" || true
40
+ echo "[comb-pxonly] DONE"
41
+ grep -aoE "success_rate[^,]*|SR [0-9.]+" bsub_out/rsm_comb_prop.log 2>/dev/null | tail -1
42
+ grep -aoE "success_rate[^,]*|SR [0-9.]+" bsub_out/rsm_comb_px.log 2>/dev/null | tail -1
gen_q_rsm/ogbench_genq/experiments/pack_eval_visual_rsm_empirical_20k.sh ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Strict 10-episode/task diagnostic rollouts for the immutable empirical-index
3
+ # visual RSM step-20k checkpoints. The evaluator reconstructs only the raw-RGB
4
+ # actor and independently validates the pixels-only, non-TD training contract.
5
+ set -euo pipefail
6
+
7
+ ROOT=/proj/inf-scaling/zwhong/projs/gen_q/.claude/worktrees/rsm-gate-9164a62
8
+ cd "$ROOT"
9
+
10
+ PY=${PY:-/proj/inf-scaling/zwhong/projs/gen_q/.ogbench_venv/bin/python}
11
+ OUT_ROOT=${OUT_ROOT:-/proj/inf-scaling/zwhong/visual_rsm_empirical_rollouts/step20000_diag10}
12
+ EPISODES=${EPISODES:-10}
13
+ REFERENCE_ROOT=${REFERENCE_ROOT:-/u/zwhong/ogbench_ref/impls}
14
+
15
+ case "$EPISODES" in
16
+ ''|*[!0-9]*) echo "EPISODES must be a positive integer" >&2; exit 2 ;;
17
+ 0) echo "EPISODES must be positive" >&2; exit 2 ;;
18
+ esac
19
+
20
+ cells=(
21
+ frozen_w1
22
+ frozen_w05
23
+ joint_w1
24
+ )
25
+ checkpoints=(
26
+ /proj/inf-scaling/zwhong/visual_rsm_empirical_absorb_frozen_w1_s0/rsm_fair_visual_rsm_empirical_absorb_w1_protected_frozen_warm10k_jointtrain50k_a51b23d_s0_step20000.pkl
27
+ /proj/inf-scaling/zwhong/visual_rsm_empirical_absorb_frozen_w05_s0/rsm_fair_visual_rsm_empirical_absorb_w05_protected_frozen_warm10k_jointtrain50k_a51b23d_s0_step20000.pkl
28
+ /proj/inf-scaling/zwhong/visual_rsm_empirical_absorb_joint_w1_s0/rsm_fair_visual_rsm_empirical_absorb_w1_protected_joint_warm10k_jointtrain50k_a51b23d_s0_step20000.pkl
29
+ )
30
+ digests=(
31
+ 20eae75d3c532530616fb5667dbc30e37a37ddcce8ea4157e8730d32ee459a54
32
+ 1ee6cf7660a4519962fb5cbee403b1e9dabb91b1b1fff36b4be1c3bc6dca90e8
33
+ 20a9002e5d0cd90a9edbcd3689180e1254d792f3ec2bad0092e3c37cb9997d71
34
+ )
35
+
36
+ mkdir -p "$OUT_ROOT"
37
+ declare -a pids=()
38
+
39
+ for index in "${!cells[@]}"; do
40
+ cell=${cells[$index]}
41
+ checkpoint=${checkpoints[$index]}
42
+ digest=${digests[$index]}
43
+ output="$OUT_ROOT/${cell}.json"
44
+ log="$OUT_ROOT/${cell}.log"
45
+
46
+ actual=$(sha256sum "$checkpoint")
47
+ actual=${actual%% *}
48
+ [ "$actual" = "$digest" ] || {
49
+ echo "[empirical-20k-eval] checkpoint checksum mismatch: $cell" >&2
50
+ exit 1
51
+ }
52
+
53
+ env \
54
+ JAX_PLATFORMS=cpu \
55
+ CUDA_VISIBLE_DEVICES= \
56
+ MUJOCO_GL=egl \
57
+ XLA_PYTHON_CLIENT_PREALLOCATE=false \
58
+ PYTHONUNBUFFERED=1 \
59
+ "$PY" -u ogbench_genq/genq/eval_visual_rsm_pixel_actor.py \
60
+ --checkpoint "$checkpoint" \
61
+ --out "$output" \
62
+ --actor ema \
63
+ --episodes "$EPISODES" \
64
+ --expected_checkpoint_sha256 "$digest" \
65
+ --ogbench_impls "$REFERENCE_ROOT" \
66
+ >"$log" 2>&1 &
67
+ pids+=("$!")
68
+ echo "[empirical-20k-eval] launched cell=$cell pid=${pids[-1]}"
69
+ done
70
+
71
+ failed=()
72
+ for index in "${!pids[@]}"; do
73
+ if wait "${pids[$index]}"; then
74
+ echo "[empirical-20k-eval] complete cell=${cells[$index]}"
75
+ else
76
+ status=$?
77
+ failed+=("${cells[$index]}:$status")
78
+ fi
79
+ done
80
+
81
+ if [ "${#failed[@]}" -gt 0 ]; then
82
+ printf '[empirical-20k-eval] failed:' >&2
83
+ printf ' %s' "${failed[@]}" >&2
84
+ printf '\n' >&2
85
+ exit 1
86
+ fi
gen_q_rsm/ogbench_genq/experiments/pack_fair_px_awr.sh ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Strictly pixels-only visual-cube retraining pipeline.
3
+ #
4
+ # Training diet:
5
+ # 1. reconstruction-only encoder from pixels (cube xyz is diagnostic-only);
6
+ # 2. index/at-goal reward decoder from latent pairs and trajectory order;
7
+ # 3. reward-free diffusion occupancy on z with --drop_proprio;
8
+ # 4. advantage-weighted regression (AWR) actor from stop-gradient occupancy Q.
9
+ #
10
+ # Recursion is OFF: the fair visual gate forbids the completion/forward-model
11
+ # machinery used by recursive RSM. The full RSM checkpoint is resumable.
12
+ set -euo pipefail
13
+
14
+ CF=/proj/inf-scaling/zwhong/projs/gen_q/.claude/worktrees/rsm-visual-coordfree
15
+ REC=/proj/inf-scaling/zwhong/projs/gen_q/.claude/worktrees/rsm-visual-recursion
16
+ cd "$CF"
17
+ [ -f .env ] && set -a && . ./.env && set +a
18
+
19
+ export OGBENCH_IMPLS=${OGBENCH_IMPLS:-/u/zwhong/ogbench_ref/impls}
20
+ export XLA_PYTHON_CLIENT_PREALLOCATE=false
21
+ export XLA_PYTHON_CLIENT_MEM_FRACTION=0.85
22
+ export MUJOCO_GL=egl
23
+ export WANDB_MODE=disabled
24
+ export PYTHONUNBUFFERED=1
25
+
26
+ PY=$REC/.ogbench_venv/bin/python
27
+ ENV=visual-cube-single-play-v0
28
+ TAG=fair_px_recon_index_awr_s0
29
+ ENC=ckpt/pixel_enc_${TAG}.npz
30
+ LAT=ckpt/latents_${TAG}.npz
31
+ RDEC=ckpt/rdec_${TAG}.npz
32
+ SMOKE_CKPT=ckpt/rsm_${TAG}_smoke.pkl
33
+ FULL_CKPT=ckpt/rsm_${TAG}.pkl
34
+ mkdir -p bsub_out ckpt
35
+
36
+ echo "[fair-px-awr] host=$(hostname) cwd=$PWD"
37
+
38
+ # Stage 1: fresh coordinate-free encoder. This filename is unique to the
39
+ # strict run, so no earlier proprioceptive RSM artifact can be reused.
40
+ if [ ! -f "$ENC" ]; then
41
+ echo "[fair-px-awr] stage1 reconstruction-only pixel encoder"
42
+ "$PY" -u ogbench_genq/genq/train_latent_variants_jax.py \
43
+ --env "$ENV" --variant "$TAG" \
44
+ --w_reward 0 --w_recon 1 --w_consistency 0 \
45
+ --w_tempcon 0 --w_stepsto 0 --w_goalcls 0 --w_goalcls_bin 0 --w_smooth 0 \
46
+ --z_dim 8 --train_steps 100000 --eval_every 5000 --out "$ENC"
47
+ fi
48
+ [ -f "$ENC" ] || { echo "[fair-px-awr] FATAL encoder missing"; exit 1; }
49
+
50
+ # Stage 2: encode the entire offline pixel dataset once.
51
+ if [ ! -f "$LAT" ]; then
52
+ echo "[fair-px-awr] stage2 precompute frozen latents"
53
+ "$PY" -u ogbench_genq/genq/precompute_pixel_latents.py \
54
+ --env "$ENV" --encoder "$ENC" --out "$LAT"
55
+ fi
56
+ [ -f "$LAT" ] || { echo "[fair-px-awr] FATAL latents missing"; exit 1; }
57
+
58
+ # Stage 3: coordinate-free at-goal decoder. Cube coordinates are not labels;
59
+ # train_reward_decoder.py uses them only for the printed diagnostic.
60
+ if [ ! -f "$RDEC" ]; then
61
+ echo "[fair-px-awr] stage3 index/at-goal reward decoder"
62
+ "$PY" -u ogbench_genq/genq/train_reward_decoder.py \
63
+ --latents "$LAT" --out "$RDEC" --target index --index_delta 8 \
64
+ --steps 20000 --seed 0
65
+ fi
66
+ [ -f "$RDEC" ] || { echo "[fair-px-awr] FATAL reward decoder missing"; exit 1; }
67
+
68
+ COMMON=(
69
+ --env "$ENV"
70
+ --latent_npz "$LAT"
71
+ --pixel_encoder "$ENC"
72
+ --drop_proprio
73
+ --reward_decoder "$RDEC"
74
+ --actor_loss awr
75
+ --alpha 30
76
+ --expectile 0.7
77
+ --recursion off
78
+ --wandb_mode disabled
79
+ )
80
+
81
+ # Stage 4a: compile and execute the exact pixels-only AWR training path before
82
+ # the long run. Rendering is deliberately deferred to a separate verified-host
83
+ # job because EGL failures are process aborts, not catchable Python errors.
84
+ echo "[fair-px-awr] stage4a exact-path smoke"
85
+ "$PY" -u ogbench_genq/rsm.py "${COMMON[@]}" \
86
+ --rdec_samples 2 --actor_after 50 \
87
+ --batch_size 64 --occ_batch 64 \
88
+ --train_steps 100 --eval_interval 1000 \
89
+ --eval_episodes 1 --eval_episodes_periodic 1 \
90
+ --train_only \
91
+ --ckpt "$SMOKE_CKPT" --ckpt_every 100 \
92
+ --variant_tag "${TAG}_smoke"
93
+
94
+ # Stage 4b: full resumable, render-free fit. The official 50-episode-per-task
95
+ # evaluation is a separate job pinned to a verified renderer host.
96
+ echo "[fair-px-awr] stage4b full pixels-only occupancy + AWR retrain"
97
+ "$PY" -u ogbench_genq/rsm.py "${COMMON[@]}" \
98
+ --rdec_samples 4 --actor_after 100000 \
99
+ --batch_size 1024 --occ_batch 2048 \
100
+ --train_steps 1000000 --eval_interval 100000 \
101
+ --eval_episodes 50 --eval_episodes_periodic 3 \
102
+ --train_only \
103
+ --ckpt "$FULL_CKPT" --ckpt_every 10000 \
104
+ --variant_tag "$TAG"
105
+
106
+ echo "[fair-px-awr] DONE"
gen_q_rsm/ogbench_genq/experiments/pack_gate_visual_rsm_gamma_beta.sh ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Sequential diagnostics for the six exact-step gamma/beta/depth calibration
3
+ # checkpoints. This performs no training and deliberately omits
4
+ # --fail_on_gate so every scientifically failed cell still writes its complete
5
+ # diagnostic JSON.
6
+ set -euo pipefail
7
+
8
+ ROOT=$(cd "$(dirname "$0")/../.." && pwd)
9
+ cd "$ROOT"
10
+
11
+ PY=${PY:-/proj/inf-scaling/zwhong/projs/gen_q/.ogbench_venv/bin/python}
12
+ ARTIFACT_ROOT=${ARTIFACT_ROOT:-/proj/inf-scaling/zwhong/projs/gen_q/.claude/worktrees/rsm-visual-coordfree}
13
+ OUT_ROOT=${OUT_ROOT:-/proj/inf-scaling/zwhong/visual_rsm_gamma_beta_gates}
14
+ LATENTS=${LATENTS:-$ARTIFACT_ROOT/ckpt/latents_fair_px_gpred_gciql_z8_w003_gciqlret_stateh256.npz}
15
+ READER=${READER:-$ARTIFACT_ROOT/ckpt/rdec_fair_px_gpred_gciql_z8_w003_gciqlret_indexd4_diagmetric.npz}
16
+
17
+ export OGBENCH_IMPLS=${OGBENCH_IMPLS:-/u/zwhong/ogbench_ref/impls}
18
+ export XLA_PYTHON_CLIENT_PREALLOCATE=false
19
+ export XLA_PYTHON_CLIENT_MEM_FRACTION=${XLA_PYTHON_CLIENT_MEM_FRACTION:-0.85}
20
+ export PYTHONUNBUFFERED=1
21
+
22
+ mkdir -p "$OUT_ROOT"
23
+
24
+ cells=(
25
+ rec_g099_b0985_d08_bm025
26
+ rec_g099_b0980_d12_bm025
27
+ rec_g099_b0970_d20_bm025
28
+ rec_g098_b0960_d12_bm025
29
+ ctrl_g099_b0980_d12_bm025_nocomp
30
+ abl_g099_b0980_d12_bm040
31
+ )
32
+ betas=(0.985 0.98 0.97 0.96 0.98 0.98)
33
+ digests=(
34
+ ffba1a9cc33eec16d395c302fcc5eb4ef3e1b97dc826ece77e4e2e8186ef1644
35
+ e3dede23014d23adfbf5837ec09e5712cc26a8e31d68c2be62d615e14ddd6994
36
+ a4d62e00d981d919456632262ff862109f4616b5fe69998d986c41b0a562dac5
37
+ ba62ed24accfcf49819e50fc5f63803cdddd7a607584e8c2136e05a810403641
38
+ 20b19de7c82237b89529e2fe1555466ab2b29b8200d54be9e27b2c5e123441a7
39
+ 08219197dc38c36abe58412fe4e87d039323afef6f3c5792d61e607f474fe789
40
+ )
41
+
42
+ for index in "${!cells[@]}"; do
43
+ cell=${cells[$index]}
44
+ checkpoint=$ARTIFACT_ROOT/ckpt/rsm_fair_visual_rsm_hidden_onehop_gb_calib_v1_${cell}_s0_step50000.pkl
45
+ output=$OUT_ROOT/${cell}_s0_step50000_occupancy_gate.json
46
+ actual=$(sha256sum "$checkpoint")
47
+ actual=${actual%% *}
48
+ [ "$actual" = "${digests[$index]}" ] || {
49
+ echo "[gamma-beta-gate] checkpoint checksum mismatch: $cell" >&2
50
+ exit 1
51
+ }
52
+ echo "[gamma-beta-gate] start cell=$cell beta=${betas[$index]}"
53
+ "$PY" -u ogbench_genq/genq/gate_visual_occupancy.py \
54
+ --ckpt "$checkpoint" \
55
+ --latents "$LATENTS" \
56
+ --reward_decoder "$READER" \
57
+ --out "$output" \
58
+ --rows 96 \
59
+ --samples 16 \
60
+ --loss_draws 4 \
61
+ --episodes 100 \
62
+ --actor ema \
63
+ --local_k 4 \
64
+ --local_sigma 0.3 \
65
+ --actor_local_k 2 \
66
+ --actor_local_sigma 0.3 \
67
+ --support_reference_rows 20000 \
68
+ --sample_steps 25 \
69
+ --rec_beta "${betas[$index]}"
70
+ echo "[gamma-beta-gate] complete cell=$cell output=$output"
71
+ done
72
+
73
+ echo "[gamma-beta-gate] complete all six cells"
gen_q_rsm/ogbench_genq/experiments/pack_goalcls_e2e.sh ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # recon + GOAL-REACHING CLASSIFIER encoder, then RSM -- test whether jointly shaping the
3
+ # encoder with a goal classifier (GCIQL's mechanism, minus TD) makes the occupancy
4
+ # read-out discriminative (q_self >> q_rand) and breaks the 0.000 wall on visual-cube.
5
+ # Single-arm RSM (no GPU contention), on a good render node. Reads the CALIBRATION gap
6
+ # directly (proxy spearman does NOT predict RSM success -- slow-feature proved that).
7
+ # Usage: pack_goalcls_e2e.sh <TAG> <w_goalcls> <goalcls_tau>
8
+ set -uo pipefail
9
+ CF=/proj/inf-scaling/zwhong/projs/gen_q/.claude/worktrees/rsm-visual-coordfree
10
+ REC=/proj/inf-scaling/zwhong/projs/gen_q/.claude/worktrees/rsm-visual-recursion
11
+ cd "$CF"; [ -f .env ] && set -a && . ./.env && set +a
12
+ export OGBENCH_IMPLS=${OGBENCH_IMPLS:-$HOME/ogbench_ref/impls}
13
+ export XLA_PYTHON_CLIENT_PREALLOCATE=false XLA_PYTHON_CLIENT_MEM_FRACTION=0.6
14
+ export MUJOCO_GL=egl WANDB_MODE=disabled PYTHONUNBUFFERED=1
15
+ PY=$REC/.ogbench_venv/bin/python
16
+ ENV=visual-cube-single-play-v0
17
+ TAG=${1:-goalcls_w1_t1}; WG=${2:-1.0}; TAU=${3:-1.0}
18
+ ENC=ckpt/pixel_enc_visual_cube_single_play_v0_${TAG}.npz
19
+ LAT=ckpt/valrew_${TAG}_latents.npz
20
+ mkdir -p bsub_out ckpt
21
+ echo "[goalcls-e2e] host $(hostname); TAG=$TAG w_goalcls=$WG tau=$TAU"
22
+
23
+ # stage 1: encoder (recon + goal classifier, jointly), render-free
24
+ if [ ! -f "$ENC" ]; then
25
+ $PY -u ogbench_genq/genq/train_latent_variants_jax.py --env "$ENV" \
26
+ --variant "$TAG" --w_reward 0 --w_recon 1 --w_goalcls "$WG" --goalcls_tau "$TAU" \
27
+ --z_dim 8 --train_steps 25000 --eval_every 5000 2>&1 | tee "bsub_out/enc_${TAG}.log"
28
+ fi
29
+ [ -f "$ENC" ] || { echo "[goalcls-e2e] FATAL encoder"; exit 1; }
30
+
31
+ # stage 2: precompute latents
32
+ if [ ! -f "$LAT" ]; then
33
+ $PY -u ogbench_genq/genq/precompute_pixel_latents.py --env "$ENV" --encoder "$ENC" --out "$LAT" \
34
+ 2>&1 | tee "bsub_out/precompute_${TAG}.log"
35
+ fi
36
+ [ -f "$LAT" ] || { echo "[goalcls-e2e] FATAL latents"; exit 1; }
37
+
38
+ # stage 3: single-arm RSM (prop), 200k, eval@25k -> read q_self/q_rand gap + SR
39
+ echo "[goalcls-e2e] RSM prop 200k eval@25k"
40
+ $PY -u ogbench_genq/rsm.py --env "$ENV" --latent_npz "$LAT" --pixel_encoder "$ENC" \
41
+ --recursion off --alpha 0.3 --train_steps 200000 --eval_interval 25000 \
42
+ --ckpt ckpt/rsm_${TAG}_prop.pkl --ckpt_every 25000 \
43
+ --variant_tag "${TAG}_prop_recoff" --wandb_mode disabled
44
+ echo "[goalcls-e2e] EXIT $?"
gen_q_rsm/ogbench_genq/experiments/pack_goalclsbin_e2e.sh ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # recon + GOAL-REACHING CLASSIFIER encoder, then RSM -- test whether jointly shaping the
3
+ # encoder with a goal classifier (GCIQL's mechanism, minus TD) makes the occupancy
4
+ # read-out discriminative (q_self >> q_rand) and breaks the 0.000 wall on visual-cube.
5
+ # Single-arm RSM (no GPU contention), on a good render node. Reads the CALIBRATION gap
6
+ # directly (proxy spearman does NOT predict RSM success -- slow-feature proved that).
7
+ # Usage: pack_goalcls_e2e.sh <TAG> <w_goalcls> <goalcls_tau>
8
+ set -uo pipefail
9
+ CF=/proj/inf-scaling/zwhong/projs/gen_q/.claude/worktrees/rsm-visual-coordfree
10
+ REC=/proj/inf-scaling/zwhong/projs/gen_q/.claude/worktrees/rsm-visual-recursion
11
+ cd "$CF"; [ -f .env ] && set -a && . ./.env && set +a
12
+ export OGBENCH_IMPLS=${OGBENCH_IMPLS:-$HOME/ogbench_ref/impls}
13
+ export XLA_PYTHON_CLIENT_PREALLOCATE=false XLA_PYTHON_CLIENT_MEM_FRACTION=0.6
14
+ export MUJOCO_GL=egl WANDB_MODE=disabled PYTHONUNBUFFERED=1
15
+ PY=$REC/.ogbench_venv/bin/python
16
+ ENV=visual-cube-single-play-v0
17
+ TAG=${1:-goalcls_w1_t1}; WG=${2:-1.0}; TAU=${3:-1.0}
18
+ ENC=ckpt/pixel_enc_visual_cube_single_play_v0_${TAG}.npz
19
+ LAT=ckpt/valrew_${TAG}_latents.npz
20
+ mkdir -p bsub_out ckpt
21
+ echo "[goalclsbin-e2e] host $(hostname); TAG=$TAG w_goalcls=$WG tau=$TAU"
22
+
23
+ # stage 1: encoder (recon + goal classifier, jointly), render-free
24
+ if [ ! -f "$ENC" ]; then
25
+ $PY -u ogbench_genq/genq/train_latent_variants_jax.py --env "$ENV" \
26
+ --variant "$TAG" --w_reward 0 --w_recon 1 --w_goalcls_bin "$WG" \
27
+ --z_dim 8 --train_steps 25000 --eval_every 5000 2>&1 | tee "bsub_out/enc_${TAG}.log"
28
+ fi
29
+ [ -f "$ENC" ] || { echo "[goalclsbin-e2e] FATAL encoder"; exit 1; }
30
+
31
+ # stage 2: precompute latents
32
+ if [ ! -f "$LAT" ]; then
33
+ $PY -u ogbench_genq/genq/precompute_pixel_latents.py --env "$ENV" --encoder "$ENC" --out "$LAT" \
34
+ 2>&1 | tee "bsub_out/precompute_${TAG}.log"
35
+ fi
36
+ [ -f "$LAT" ] || { echo "[goalclsbin-e2e] FATAL latents"; exit 1; }
37
+
38
+ # stage 3: single-arm RSM (prop), 200k, eval@25k -> read q_self/q_rand gap + SR
39
+ echo "[goalclsbin-e2e] RSM prop 200k eval@25k"
40
+ $PY -u ogbench_genq/rsm.py --env "$ENV" --latent_npz "$LAT" --pixel_encoder "$ENC" \
41
+ --recursion off --alpha 0.3 --train_steps 200000 --eval_interval 25000 \
42
+ --ckpt ckpt/rsm_${TAG}_prop.pkl --ckpt_every 25000 \
43
+ --variant_tag "${TAG}_prop_recoff" --wandb_mode disabled
44
+ echo "[goalclsbin-e2e] EXIT $?"
gen_q_rsm/ogbench_genq/experiments/pack_goalpred_fair_px_awr.sh ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Train a strictly pixels-only RSM from one completed goal-prediction encoder.
3
+ #
4
+ # Usage:
5
+ # bash ogbench_genq/experiments/pack_goalpred_fair_px_awr.sh gpred_idx_z8_w003
6
+ #
7
+ # The selected encoder is frozen. Cube coordinates and proprioception are never
8
+ # inputs to reward-decoder, occupancy, value, or actor training.
9
+ set -euo pipefail
10
+
11
+ CF=/proj/inf-scaling/zwhong/projs/gen_q/.claude/worktrees/rsm-visual-coordfree
12
+ REC=/proj/inf-scaling/zwhong/projs/gen_q/.claude/worktrees/rsm-visual-recursion
13
+ cd "$CF"
14
+ [ -f .env ] && set -a && . ./.env && set +a
15
+
16
+ export OGBENCH_IMPLS=${OGBENCH_IMPLS:-/u/zwhong/ogbench_ref/impls}
17
+ export XLA_PYTHON_CLIENT_PREALLOCATE=false
18
+ export XLA_PYTHON_CLIENT_MEM_FRACTION=0.85
19
+ export MUJOCO_GL=egl
20
+ export WANDB_MODE=disabled
21
+ export PYTHONUNBUFFERED=1
22
+
23
+ if [ "$#" -ne 1 ]; then
24
+ echo "usage: $0 ENCODER_TAG" >&2
25
+ exit 2
26
+ fi
27
+
28
+ PY=$REC/.ogbench_venv/bin/python
29
+ ENV=visual-cube-single-play-v0
30
+ ENC_TAG=$1
31
+ TAG=fair_px_${ENC_TAG}_index_awr_s0
32
+ ENC=ckpt/pixel_enc_visual_cube_single_play_v0_${ENC_TAG}.npz
33
+ LAT=ckpt/latents_${TAG}.npz
34
+ RDEC=ckpt/rdec_${TAG}.npz
35
+ SMOKE_CKPT=ckpt/rsm_${TAG}_smoke.pkl
36
+ FULL_CKPT=ckpt/rsm_${TAG}.pkl
37
+ mkdir -p bsub_out ckpt
38
+
39
+ echo "[goalpred-fair-px-awr] host=$(hostname) encoder=$ENC_TAG tag=$TAG"
40
+ [ -f "$ENC" ] || {
41
+ echo "[goalpred-fair-px-awr] FATAL encoder missing: $ENC" >&2
42
+ exit 1
43
+ }
44
+
45
+ if [ ! -f "$LAT" ]; then
46
+ echo "[goalpred-fair-px-awr] stage1 precompute frozen image latents"
47
+ "$PY" -u ogbench_genq/genq/precompute_pixel_latents.py \
48
+ --env "$ENV" --encoder "$ENC" --out "$LAT"
49
+ fi
50
+ [ -f "$LAT" ] || {
51
+ echo "[goalpred-fair-px-awr] FATAL latents missing: $LAT" >&2
52
+ exit 1
53
+ }
54
+
55
+ if [ ! -f "$RDEC" ]; then
56
+ echo "[goalpred-fair-px-awr] stage2 coordinate-free index reward decoder"
57
+ "$PY" -u ogbench_genq/genq/train_reward_decoder.py \
58
+ --latents "$LAT" --out "$RDEC" --target index --index_delta 8 \
59
+ --neg_gap 64 --cross_neg_frac 0.5 --features symmetric --activation relu \
60
+ --steps 20000 --seed 0
61
+ fi
62
+ [ -f "$RDEC" ] || {
63
+ echo "[goalpred-fair-px-awr] FATAL reward decoder missing: $RDEC" >&2
64
+ exit 1
65
+ }
66
+
67
+ COMMON=(
68
+ --env "$ENV"
69
+ --latent_npz "$LAT"
70
+ --pixel_encoder "$ENC"
71
+ --drop_proprio
72
+ --reward_decoder "$RDEC"
73
+ --actor_loss awr
74
+ --alpha 30
75
+ --expectile 0.7
76
+ --recursion off
77
+ --wandb_mode disabled
78
+ )
79
+
80
+ echo "[goalpred-fair-px-awr] stage3 exact-path smoke"
81
+ "$PY" -u ogbench_genq/rsm.py "${COMMON[@]}" \
82
+ --rdec_samples 2 --actor_after 50 \
83
+ --batch_size 64 --occ_batch 64 \
84
+ --train_steps 100 --eval_interval 1000 \
85
+ --eval_episodes 1 --eval_episodes_periodic 1 \
86
+ --train_only \
87
+ --ckpt "$SMOKE_CKPT" --ckpt_every 100 \
88
+ --variant_tag "${TAG}_smoke"
89
+
90
+ echo "[goalpred-fair-px-awr] stage4 full resumable occupancy + AWR fit"
91
+ "$PY" -u ogbench_genq/rsm.py "${COMMON[@]}" \
92
+ --rdec_samples 4 --actor_after 100000 \
93
+ --batch_size 1024 --occ_batch 2048 \
94
+ --train_steps 1000000 --eval_interval 100000 \
95
+ --eval_episodes 50 --eval_episodes_periodic 3 \
96
+ --train_only \
97
+ --ckpt "$FULL_CKPT" --ckpt_every 10000 \
98
+ --variant_tag "$TAG"
99
+
100
+ echo "[goalpred-fair-px-awr] DONE tag=$TAG"
gen_q_rsm/ogbench_genq/experiments/pack_qfilter_fast.sh ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # HISTORICAL DIAGNOSTIC ONLY. The saved recon occupancy was trained with
3
+ # concat(proprio19,z), so this is NOT the strictly pixels-only fair test even
4
+ # though its encoder is coordinate-free. Two read-outs:
5
+ # (A) DENSITY q_elbo (cheap, no per-candidate sampling) -- fast, K sweep.
6
+ # (B) CLASSIFIER R_psi with rdec_samples=2 (fast) -- the index-reward read-out.
7
+ # Small eval (episodes) for a directional signal: does Q-filter (K>1) beat plain actor (K=1)?
8
+ set -uo pipefail
9
+ if [ "${ALLOW_PROPRIO_DIAG:-0}" != "1" ]; then
10
+ echo "Refusing ineligible proprioceptive Q-filter. Set ALLOW_PROPRIO_DIAG=1 for diagnostics."
11
+ exit 2
12
+ fi
13
+ CF=/proj/inf-scaling/zwhong/projs/gen_q/.claude/worktrees/rsm-visual-coordfree
14
+ REC=/proj/inf-scaling/zwhong/projs/gen_q/.claude/worktrees/rsm-visual-recursion
15
+ cd "$CF"; [ -f .env ] && set -a && . ./.env && set +a
16
+ export OGBENCH_IMPLS=${OGBENCH_IMPLS:-$HOME/ogbench_ref/impls}
17
+ export XLA_PYTHON_CLIENT_PREALLOCATE=false XLA_PYTHON_CLIENT_MEM_FRACTION=0.6
18
+ export MUJOCO_GL=egl WANDB_MODE=disabled PYTHONUNBUFFERED=1
19
+ PY=$REC/.ogbench_venv/bin/python
20
+ ENV=visual-cube-single-play-v0
21
+ LAT=$REC/ckpt/visual_cube_single_recononly_latents.npz
22
+ ENC=$REC/ckpt/pixel_enc_visual_cube_single_play_v0_recononly.npz
23
+ CKPT=$REC/ckpt/rsm_cube_recononly_recoff.pkl
24
+ RDEC=ckpt/rdec_recon_index.npz
25
+ EP=${1:-12}
26
+ BASE="--env $ENV --latent_npz $LAT --pixel_encoder $ENC --ckpt $CKPT \
27
+ --recursion off --alpha 0.3 --gamma 0.99 --train_steps 1000000 --eval_only \
28
+ --wandb_mode disabled --elbo_K 8 --qfilter_sigma 0.3 --eval_episodes $EP"
29
+
30
+ echo "=== (A) DENSITY read-out Q-filter ==="
31
+ for K in 1 8 32; do
32
+ $PY -u ogbench_genq/rsm.py $BASE --qfilter $K --variant_tag qfd_recon_k${K} \
33
+ 2>&1 | grep -aE "Q-FILTER|FINAL sr|Traceback|Error" | tail -2
34
+ done
35
+ echo "=== (B) CLASSIFIER read-out (index R_psi, rdec_samples=2) Q-filter ==="
36
+ for K in 1 8 32; do
37
+ $PY -u ogbench_genq/rsm.py $BASE --reward_decoder $RDEC --rdec_samples 2 \
38
+ --qfilter $K --variant_tag qfc_recon_k${K} \
39
+ 2>&1 | grep -aE "Q-FILTER|FINAL sr|Traceback|Error" | tail -2
40
+ done
41
+ echo "[qf-fast] DONE"
gen_q_rsm/ogbench_genq/experiments/pack_qfilter_recon.sh ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # HISTORICAL DIAGNOSTIC ONLY: the saved coordinate-free RECON occupancy was
3
+ # trained on concat(proprio19,z). It is therefore NOT eligible for the strictly
4
+ # pixels-only comparison despite using no cube-coordinate encoder supervision.
5
+ # The replacement is pack_fair_px_awr.sh, which retrains with --drop_proprio.
6
+ set -uo pipefail
7
+ if [ "${ALLOW_PROPRIO_DIAG:-0}" != "1" ]; then
8
+ echo "Refusing ineligible proprioceptive Q-filter. Set ALLOW_PROPRIO_DIAG=1 for diagnostics."
9
+ exit 2
10
+ fi
11
+ CF=/proj/inf-scaling/zwhong/projs/gen_q/.claude/worktrees/rsm-visual-coordfree
12
+ REC=/proj/inf-scaling/zwhong/projs/gen_q/.claude/worktrees/rsm-visual-recursion
13
+ cd "$CF"; [ -f .env ] && set -a && . ./.env && set +a
14
+ export OGBENCH_IMPLS=${OGBENCH_IMPLS:-$HOME/ogbench_ref/impls}
15
+ export XLA_PYTHON_CLIENT_PREALLOCATE=false XLA_PYTHON_CLIENT_MEM_FRACTION=0.6
16
+ export MUJOCO_GL=egl WANDB_MODE=disabled PYTHONUNBUFFERED=1
17
+ PY=$REC/.ogbench_venv/bin/python
18
+ ENV=visual-cube-single-play-v0
19
+ LAT=$REC/ckpt/visual_cube_single_recononly_latents.npz
20
+ ENC=$REC/ckpt/pixel_enc_visual_cube_single_play_v0_recononly.npz
21
+ CKPT=$REC/ckpt/rsm_cube_recononly_recoff.pkl
22
+ RDEC=ckpt/rdec_recon_index.npz
23
+ mkdir -p bsub_out ckpt
24
+ echo "[qf] host $(hostname)"
25
+
26
+ # stage 1: INDEX-reward goal classifier R_psi on the frozen recon latent (render-free)
27
+ if [ ! -f "$RDEC" ]; then
28
+ $PY -u ogbench_genq/genq/train_reward_decoder.py --latents "$LAT" --out "$RDEC" \
29
+ --target index --index_delta 8 --steps 20000 2>&1 | tee "bsub_out/rdec_recon_index.log"
30
+ fi
31
+ [ -f "$RDEC" ] || { echo "[qf] FATAL R_psi"; exit 1; }
32
+
33
+ QF_ARGS="--env $ENV --latent_npz $LAT --pixel_encoder $ENC --ckpt $CKPT \
34
+ --reward_decoder $RDEC --rdec_samples 8 --recursion off --alpha 0.3 --gamma 0.99 \
35
+ --train_steps 1000000 --eval_only --wandb_mode disabled"
36
+
37
+ # stage 2: SMOKE the eval-only Q-filter path (K=1, 3 episodes) before the real sweep
38
+ echo "[qf] smoke (K=1, 3 ep)"
39
+ $PY -u ogbench_genq/rsm.py $QF_ARGS --qfilter 1 --qfilter_sigma 0.3 --eval_episodes 3 \
40
+ --variant_tag qf_recon_smoke 2>&1 | tail -8
41
+ echo "[qf] smoke rc=$?"
42
+
43
+ # stage 3: Q-filter K sweep, 50-ep official (K=1 ~ plain actor baseline; K>1 = search)
44
+ for K in 1 8 32; do
45
+ echo "[qf] === Q-filter K=$K, 50-ep ==="
46
+ $PY -u ogbench_genq/rsm.py $QF_ARGS --qfilter $K --qfilter_sigma 0.3 --eval_episodes 50 \
47
+ --variant_tag qf_recon_k${K} 2>&1 | grep -aE "Q-FILTER|FINAL sr|Error|Traceback" | tail -4
48
+ done
49
+ echo "[qf] DONE"
gen_q_rsm/ogbench_genq/experiments/pack_rdec_e2e.sh ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Test the CLASSIFIER read-out (user's idea): Q=E_{z'~occ}[sigmoid(R_psi(z',g))] instead
3
+ # of the mass-at-goal density (q_elbo). Train R_psi (goal classifier) on a frozen latent,
4
+ # then RSM with --reward_decoder. Single-arm, good render node. Reads q_self/q_rand + SR.
5
+ # Usage: pack_rdec_e2e.sh <LAT> <ENC> <TAG>
6
+ set -uo pipefail
7
+ CF=/proj/inf-scaling/zwhong/projs/gen_q/.claude/worktrees/rsm-visual-coordfree
8
+ REC=/proj/inf-scaling/zwhong/projs/gen_q/.claude/worktrees/rsm-visual-recursion
9
+ cd "$CF"; [ -f .env ] && set -a && . ./.env && set +a
10
+ export OGBENCH_IMPLS=${OGBENCH_IMPLS:-$HOME/ogbench_ref/impls}
11
+ export XLA_PYTHON_CLIENT_PREALLOCATE=false XLA_PYTHON_CLIENT_MEM_FRACTION=0.6
12
+ export MUJOCO_GL=egl WANDB_MODE=disabled PYTHONUNBUFFERED=1
13
+ PY=$REC/.ogbench_venv/bin/python
14
+ ENV=visual-cube-single-play-v0
15
+ LAT=${1:?need LAT}; ENC=${2:?need ENC}; TAG=${3:?need TAG}
16
+ RDEC=ckpt/rdec_${TAG}.npz
17
+ mkdir -p bsub_out ckpt
18
+ echo "[rdec-e2e] host $(hostname); TAG=$TAG"
19
+ echo "[rdec-e2e] LAT=$LAT"; echo "[rdec-e2e] ENC=$ENC"
20
+
21
+ # stage 1: train the goal classifier R_psi on the frozen latent (render-free)
22
+ if [ ! -f "$RDEC" ]; then
23
+ $PY -u ogbench_genq/genq/train_reward_decoder.py --latents "$LAT" --out "$RDEC" \
24
+ 2>&1 | tee "bsub_out/rdec_train_${TAG}.log"
25
+ fi
26
+ [ -f "$RDEC" ] || { echo "[rdec-e2e] FATAL: R_psi not produced"; exit 1; }
27
+
28
+ # stage 2: RSM with the CLASSIFIER read-out (single arm, 200k, eval@25k)
29
+ echo "[rdec-e2e] RSM classifier read-out, 200k eval@25k"
30
+ $PY -u ogbench_genq/rsm.py --env "$ENV" --latent_npz "$LAT" --pixel_encoder "$ENC" \
31
+ --reward_decoder "$RDEC" --rdec_samples 8 \
32
+ --recursion off --alpha 0.3 --train_steps 200000 --eval_interval 25000 \
33
+ --ckpt ckpt/rsm_rdec_${TAG}.pkl --ckpt_every 25000 \
34
+ --variant_tag "rdec_${TAG}_recoff" --wandb_mode disabled
35
+ echo "[rdec-e2e] EXIT $?"
gen_q_rsm/ogbench_genq/experiments/pack_smooth_e2e.sh ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # END-TO-END fast test of the slow-feature FAIR encoder -> RSM, on ONE good render node.
3
+ # Encoder (25k, render-free) -> precompute latents -> RSM two arms (recursion OFF, 1M):
4
+ # prop: concat(proprio,z) -- isolates the ENCODER vs combined 0.592 / recon 0.000
5
+ # px: z alone (--drop_proprio) -- strictly pixels-only, headline vs GCIQL 0.30
6
+ # All coordinate-free (latent never saw cube xyz). Slow-feature proxy at 25k ~0.69
7
+ # (>> the 0.55 gate; combined=0.56). This job proves whether the fair encoder breaks
8
+ # the 0.000 wall. Runs whole pipeline on a good node so EGL eval completes.
9
+ set -uo pipefail
10
+ CF=/proj/inf-scaling/zwhong/projs/gen_q/.claude/worktrees/rsm-visual-coordfree
11
+ REC=/proj/inf-scaling/zwhong/projs/gen_q/.claude/worktrees/rsm-visual-recursion
12
+ cd "$CF"
13
+ [ -f .env ] && set -a && . ./.env && set +a
14
+ export OGBENCH_IMPLS=${OGBENCH_IMPLS:-$HOME/ogbench_ref/impls}
15
+ export XLA_PYTHON_CLIENT_PREALLOCATE=false XLA_PYTHON_CLIENT_MEM_FRACTION=0.40
16
+ export MUJOCO_GL=egl WANDB_MODE=disabled
17
+ PY=$REC/.ogbench_venv/bin/python
18
+ ENV=visual-cube-single-play-v0
19
+ TAG=smooth_s10_fast
20
+ ENC=ckpt/pixel_enc_visual_cube_single_play_v0_${TAG}.npz
21
+ LAT=ckpt/valrew_${TAG}_latents.npz # (reuse the valrew_* latents naming the RSM pack expects)
22
+ mkdir -p bsub_out ckpt
23
+
24
+ # ---- stage 1: slow-feature encoder (25k, render-free) ----
25
+ if [ ! -f "$ENC" ]; then
26
+ echo "[e2e] stage1: slow-feature encoder $TAG (w_smooth=10 w_recon=1 dt=1, 25k)"
27
+ $PY ogbench_genq/genq/train_latent_variants_jax.py --env "$ENV" \
28
+ --variant "$TAG" --w_reward 0 --w_recon 1 --w_smooth 10 --smooth_dt 1 \
29
+ --z_dim 8 --train_steps 25000 --eval_every 5000 \
30
+ 2>&1 | tee "bsub_out/enc_${TAG}.log"
31
+ fi
32
+ [ -f "$ENC" ] || { echo "[e2e] FATAL: encoder not produced"; exit 1; }
33
+
34
+ # ---- stage 2: precompute frozen latents ----
35
+ if [ ! -f "$LAT" ]; then
36
+ echo "[e2e] stage2: precompute latents"
37
+ $PY ogbench_genq/genq/precompute_pixel_latents.py --env "$ENV" --encoder "$ENC" --out "$LAT" \
38
+ 2>&1 | tee "bsub_out/precompute_${TAG}.log"
39
+ fi
40
+ [ -f "$LAT" ] || { echo "[e2e] FATAL: latents not produced"; exit 1; }
41
+
42
+ # ---- stage 3: RSM two arms (recursion OFF, 1M, --ckpt resumable) ----
43
+ echo "[e2e] stage3: RSM prop + px (pixels-only), recursion OFF"
44
+ $PY ogbench_genq/rsm.py --env "$ENV" --latent_npz "$LAT" --pixel_encoder "$ENC" \
45
+ --recursion off --alpha 0.3 --train_steps 1000000 --eval_interval 100000 \
46
+ --ckpt ckpt/rsm_${TAG}_prop.pkl --ckpt_every 100000 \
47
+ --variant_tag "${TAG}_prop_recoff" --wandb_mode disabled \
48
+ > "bsub_out/rsm_${TAG}_prop.log" 2>&1 &
49
+ A=$!
50
+ $PY ogbench_genq/rsm.py --env "$ENV" --latent_npz "$LAT" --pixel_encoder "$ENC" --drop_proprio \
51
+ --recursion off --alpha 0.3 --train_steps 1000000 --eval_interval 100000 \
52
+ --ckpt ckpt/rsm_${TAG}_px.pkl --ckpt_every 100000 \
53
+ --variant_tag "${TAG}_px_recoff" --wandb_mode disabled \
54
+ > "bsub_out/rsm_${TAG}_px.log" 2>&1 &
55
+ B=$!
56
+ echo "[e2e] RSM prop pid=$A px pid=$B ; waiting"
57
+ wait "$A" || true; wait "$B" || true
58
+ echo "[e2e] DONE"
59
+ grep -aoE "success_rate[^,}]*" bsub_out/rsm_${TAG}_prop.log 2>/dev/null | tail -1
60
+ grep -aoE "success_rate[^,}]*" bsub_out/rsm_${TAG}_px.log 2>/dev/null | tail -1
gen_q_rsm/ogbench_genq/experiments/pack_smooth_enc.sh ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # FAIR slow-feature (temporal-smoothness) encoder sweep for visual-cube-single.
3
+ #
4
+ # Diagnosis: arm->cube R2=0.90 (cube info present) but recon spearman(z,xy)=0.47 --
5
+ # the recon latent's metric follows the FAST 19-D arm, not the SLOW 3-D cube. Fix:
6
+ # penalize latent velocity ||E(x_{t+dt})-E(x_t)||^2 (slow-feature) + recon (retain
7
+ # info / prevent collapse) -> suppress fast arm variance, expose slow cube -> metric
8
+ # cube-dominant. Fair: time-order only, no coordinate, no action, no dynamics model.
9
+ #
10
+ # Sweep the w_smooth/w_recon tension (recon forces arm-encoding; smooth suppresses it).
11
+ # Gate: proxy spearman(z-dist, xy-dist) >= 0.55 [DIAGNOSTIC ONLY -- xy never trains].
12
+ set -uo pipefail
13
+ CF=/proj/inf-scaling/zwhong/projs/gen_q/.claude/worktrees/rsm-visual-coordfree
14
+ cd "$CF"
15
+ [ -f .env ] && set -a && . ./.env && set +a
16
+ export OGBENCH_IMPLS=${OGBENCH_IMPLS:-$HOME/ogbench_ref/impls}
17
+ export XLA_PYTHON_CLIENT_PREALLOCATE=false XLA_PYTHON_CLIENT_MEM_FRACTION=0.22
18
+ export MUJOCO_GL=egl
19
+ PY=/proj/inf-scaling/zwhong/projs/gen_q/.claude/worktrees/rsm-visual-recursion/.ogbench_venv/bin/python
20
+ ENV=visual-cube-single-play-v0
21
+ TR=100000
22
+ mkdir -p bsub_out ckpt
23
+ # tag w_smooth w_recon smooth_dt
24
+ run() {
25
+ local tag=$1 ws=$2 wr=$3 dt=$4
26
+ echo "[smooth] launch $tag (w_smooth=$ws w_recon=$wr dt=$dt)"
27
+ $PY ogbench_genq/genq/train_latent_variants_jax.py --env "$ENV" \
28
+ --variant "$tag" --w_reward 0 --w_recon "$wr" --w_smooth "$ws" --smooth_dt "$dt" \
29
+ --z_dim 8 --train_steps "$TR" --eval_every 5000 \
30
+ > "bsub_out/enc_$tag.log" 2>&1 &
31
+ }
32
+ run smooth_s10_r1_dt1 10 1 1
33
+ run smooth_s3_r1_dt1 3 1 1
34
+ run smooth_s3_r1_dt3 3 1 3
35
+ run smooth_s30_r1_dt1 30 1 1
36
+ wait
37
+ echo "[smooth] ALL DONE — proxy spearman (bar: combined=0.56, recon=0.47):"
38
+ for tag in smooth_s10_r1_dt1 smooth_s3_r1_dt1 smooth_s3_r1_dt3 smooth_s30_r1_dt1; do
39
+ echo -n " $tag: "
40
+ grep -aoE "FINAL proxy spearman=[0-9.]+ xy_R2=[0-9.]+" "bsub_out/enc_$tag.log" 2>/dev/null | tail -1
41
+ done
gen_q_rsm/ogbench_genq/experiments/pack_valrew_enc.sh ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # FAIR value-reward encoder sweep for visual-cube-single (issue: fair image RSM > GCIQL 0.30).
3
+ #
4
+ # Root cause (verified): the fair recon-only latent's variance is NOT cube-dominated,
5
+ # so the RSM ELBO read-out Q=exp(-denoise_loss(z_g|s,a)) is action-non-discriminative
6
+ # -> SR 0.000. The `combined` encoder fixes this by shaping the latent with the
7
+ # cube-proximity reward kernel exp(-||z-z_g||^2/2sz^2) ~ reward -> SR 0.592 (but uses
8
+ # the cube COORDINATE -> unfair).
9
+ #
10
+ # value_reward is combined's FAIR analog: SAME kernel form, but the target is the
11
+ # coordinate-free hindsight temporal value gamma_v^(steps-to-goal) (trajectory index
12
+ # structure only, NO cube xyz). On EXPERT data temporal-distance ~ cube-progress, so
13
+ # this shapes the latent onto the cube WITHOUT the coordinate.
14
+ #
15
+ # Stage 1 only: train the sweep, report proxy spearman(z-dist, xy-dist) [DIAGNOSTIC
16
+ # ONLY -- xy never enters training]. Gate: advance variants with spearman >= 0.55
17
+ # (the combined bar) to precompute + RSM.
18
+ set -uo pipefail
19
+ CF=/proj/inf-scaling/zwhong/projs/gen_q/.claude/worktrees/rsm-visual-coordfree
20
+ cd "$CF"
21
+ [ -f .env ] && set -a && . ./.env && set +a
22
+ export OGBENCH_IMPLS=${OGBENCH_IMPLS:-$HOME/ogbench_ref/impls}
23
+ export XLA_PYTHON_CLIENT_PREALLOCATE=false XLA_PYTHON_CLIENT_MEM_FRACTION=0.22
24
+ export MUJOCO_GL=egl
25
+ PY=/proj/inf-scaling/zwhong/projs/gen_q/.claude/worktrees/rsm-visual-recursion/.ogbench_venv/bin/python
26
+ ENV=visual-cube-single-play-v0
27
+ TR=100000
28
+ mkdir -p bsub_outputs ckpt
29
+
30
+ # tag z_dim value_gamma
31
+ run() {
32
+ local tag=$1 zd=$2 gv=$3
33
+ echo "[valrew] launch $tag (z_dim=$zd value_gamma=$gv)"
34
+ $PY ogbench_genq/genq/train_latent_variants_jax.py --env "$ENV" \
35
+ --variant "$tag" --w_reward 1 --w_recon 1 --reward_on both \
36
+ --value_reward --value_gamma "$gv" \
37
+ --z_dim "$zd" --train_steps "$TR" --eval_every 5000 \
38
+ > "bsub_outputs/enc_$tag.log" 2>&1 &
39
+ }
40
+ run valrew_z8_g98 8 0.98
41
+ run valrew_z8_g95 8 0.95
42
+ run valrew_z8_g90 8 0.90
43
+ run valrew_z6_g95 6 0.95
44
+ wait
45
+ echo "[valrew] ALL DONE — proxy spearman per variant (bar: combined=0.56, recon=0.47):"
46
+ for tag in valrew_z8_g98 valrew_z8_g95 valrew_z8_g90 valrew_z6_g95; do
47
+ echo -n " $tag: "
48
+ grep -aoE "FINAL proxy spearman=[0-9.]+ xy_R2=[0-9.]+" "bsub_outputs/enc_$tag.log" 2>/dev/null | tail -1
49
+ done
gen_q_rsm/ogbench_genq/experiments/pack_valrew_rsm.sh ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Stage 2+3 for a FAIR value_reward encoder: precompute latents, then RSM two arms.
3
+ # Usage: pack_valrew_rsm.sh <ENC_TAG> [full|smoke]
4
+ # ENC_TAG e.g. valrew_z8_g95 -> ckpt/pixel_enc_visual_cube_single_play_v0_<TAG>.npz
5
+ #
6
+ # Arm A (prop): state = concat(proprio, z) -- isolates the ENCODER change vs the
7
+ # combined result (0.592) and recon-only (0.000): same pipeline, only
8
+ # the coordinate-free latent differs.
9
+ # Arm B (px): state = E(pixels) alone (--drop_proprio) -- STRICTLY pixels-only, the
10
+ # headline fair comparison vs GCIQL's 30% (matched input diet).
11
+ # Both coordinate-free (the latent never saw cube xyz), both RSM (occupancy + ELBO
12
+ # read-out, no TD/planner), recursion OFF (combined's headline setting), --ckpt resumable.
13
+ set -uo pipefail
14
+ CF=/proj/inf-scaling/zwhong/projs/gen_q/.claude/worktrees/rsm-visual-coordfree
15
+ cd "$CF"
16
+ [ -f .env ] && set -a && . ./.env && set +a
17
+ export OGBENCH_IMPLS=${OGBENCH_IMPLS:-$HOME/ogbench_ref/impls}
18
+ export XLA_PYTHON_CLIENT_PREALLOCATE=false XLA_PYTHON_CLIENT_MEM_FRACTION=0.40
19
+ export MUJOCO_GL=egl
20
+ export WANDB_MODE=disabled
21
+ PY=/proj/inf-scaling/zwhong/projs/gen_q/.claude/worktrees/rsm-visual-recursion/.ogbench_venv/bin/python
22
+ ENV=visual-cube-single-play-v0
23
+ TAG=${1:?usage: pack_valrew_rsm.sh <ENC_TAG> [full|smoke]}
24
+ MODE=${2:-full}
25
+ mkdir -p bsub_out ckpt
26
+
27
+ ENC=ckpt/pixel_enc_visual_cube_single_play_v0_${TAG}.npz
28
+ LAT=ckpt/valrew_${TAG}_latents.npz
29
+ [ -f "$ENC" ] || { echo "[valrew-rsm] FATAL: encoder $ENC missing"; exit 1; }
30
+
31
+ if [ "$MODE" = "smoke" ]; then RSTEPS=800; REV=400; ALPHA=0.3; else RSTEPS=1000000; REV=25000; ALPHA=0.3; fi
32
+
33
+ # ---- stage 2: precompute frozen latents (encodes visual-cube pixels) --------
34
+ if [ ! -f "$LAT" ]; then
35
+ echo "[valrew-rsm] precompute latents for $TAG ..."
36
+ $PY ogbench_genq/genq/precompute_pixel_latents.py \
37
+ --env "$ENV" --encoder "$ENC" --out "$LAT" \
38
+ 2>&1 | tee "bsub_out/precompute_${TAG}.log"
39
+ fi
40
+ [ -f "$LAT" ] || { echo "[valrew-rsm] FATAL: latents not produced"; exit 1; }
41
+
42
+ # ---- stage 3: RSM arm A (with proprio) + arm B (strictly pixels-only) -------
43
+ echo "[valrew-rsm] RSM arm A (proprio) + arm B (pixels-only), recursion OFF"
44
+ $PY ogbench_genq/rsm.py --env "$ENV" \
45
+ --latent_npz "$LAT" --pixel_encoder "$ENC" \
46
+ --recursion off --alpha "$ALPHA" \
47
+ --train_steps "$RSTEPS" --eval_interval "$REV" \
48
+ --ckpt "ckpt/rsm_valrew_${TAG}_prop.pkl" --ckpt_every "$REV" \
49
+ --variant_tag "valrew_${TAG}_prop_recoff" --wandb_mode disabled \
50
+ > "bsub_out/rsm_valrew_${TAG}_prop.log" 2>&1 &
51
+ PID_A=$!
52
+
53
+ $PY ogbench_genq/rsm.py --env "$ENV" \
54
+ --latent_npz "$LAT" --pixel_encoder "$ENC" --drop_proprio \
55
+ --recursion off --alpha "$ALPHA" \
56
+ --train_steps "$RSTEPS" --eval_interval "$REV" \
57
+ --ckpt "ckpt/rsm_valrew_${TAG}_px.pkl" --ckpt_every "$REV" \
58
+ --variant_tag "valrew_${TAG}_px_recoff" --wandb_mode disabled \
59
+ > "bsub_out/rsm_valrew_${TAG}_px.log" 2>&1 &
60
+ PID_B=$!
61
+
62
+ echo "[valrew-rsm] arm A pid=$PID_A arm B pid=$PID_B ; waiting ..."
63
+ wait "$PID_A" || true
64
+ wait "$PID_B" || true
65
+ echo "[valrew-rsm] DONE. SR:"
66
+ grep -aoE "SR [0-9.]+|success_rate.*[0-9.]+" "bsub_out/rsm_valrew_${TAG}_prop.log" 2>/dev/null | tail -2
67
+ grep -aoE "SR [0-9.]+|success_rate.*[0-9.]+" "bsub_out/rsm_valrew_${TAG}_px.log" 2>/dev/null | tail -2
gen_q_rsm/ogbench_genq/experiments/pack_visual_cube_coordfree.sh ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # COORDINATE-FREE, DYNAMICS-FREE encoder sweep for visual-cube-single.
3
+ # Goal: a pixels-only latent whose EUCLIDEAN metric tracks cube-distance (spearman
4
+ # >= ~0.55, the bar the reward-coordinate 'combined' encoder hits at 0.56 -> RSM
5
+ # SR 0.592), WITHOUT the cube coordinate and WITHOUT forward dynamics (no WM
6
+ # machinery). Lever: recon (anchors + retains info) + temporal-contrastive (a
7
+ # state's own geometric-horizon future is its nearest neighbour, in the read-out's
8
+ # own euclidean metric). Proxy spearman(z-dist, xy-dist) is DIAGNOSTIC ONLY (xy
9
+ # never enters training). Ranks variants before any GPU-heavy RSM run.
10
+ set -uo pipefail
11
+ cd /proj/inf-scaling/zwhong/projs/gen_q/.claude/worktrees/rsm-visual-recursion
12
+ [ -f .env ] && set -a && . ./.env && set +a
13
+ export OGBENCH_IMPLS=${OGBENCH_IMPLS:-$HOME/ogbench_ref/impls}
14
+ export XLA_PYTHON_CLIENT_PREALLOCATE=false XLA_PYTHON_CLIENT_MEM_FRACTION=0.22
15
+ export MUJOCO_GL=egl
16
+ PY=.ogbench_venv/bin/python
17
+ ENV=visual-cube-single-play-v0
18
+ TR=100000
19
+ mkdir -p bsub_outputs
20
+ # variant: tag z_dim w_tempcon tempcon_tau
21
+ run() {
22
+ local tag=$1 zd=$2 wt=$3 tau=$4
23
+ echo "[coordfree] launch $tag (z_dim=$zd w_tempcon=$wt tau=$tau)"
24
+ $PY ogbench_genq/genq/train_latent_variants_jax.py --env "$ENV" \
25
+ --variant "$tag" --w_reward 0 --w_recon 1 --w_tempcon "$wt" --tempcon_tau "$tau" \
26
+ --z_dim "$zd" --train_steps "$TR" \
27
+ > "bsub_outputs/enc_$tag.log" 2>&1 &
28
+ }
29
+ # short-horizon IDENTITY contrastive (sn_u8 = t+delta, delta~[3,12]); sweep tau
30
+ run shz8_t1 8 1.0 1.0
31
+ run shz8_t4 8 1.0 4.0
32
+ run shz16_t4 16 1.0 4.0
33
+ run shz16_t16 16 3.0 16.0
34
+ wait
35
+ echo "[coordfree] ALL DONE — proxy spearman per variant:"
36
+ for tag in shz8_t1 shz8_t4 shz16_t4 shz16_t16; do
37
+ echo -n " $tag: "; grep -aoE "PROXY spearman=[0-9.]+ xy_R2=[0-9.]+" "bsub_outputs/enc_$tag.log" 2>/dev/null | tail -1
38
+ done
gen_q_rsm/ogbench_genq/experiments/pack_visual_cube_recononly.sh ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # RECON-ONLY visual-cube arm = the supervision-fair counterpart to LeWM's diet:
3
+ # the pixel encoder is trained on PIXELS ALONE (reconstruction, --w_reward 0), with
4
+ # NO privileged reward coordinate (no cube xyz). This removes the encoder-supervision
5
+ # asymmetry flagged in README §6.2. Then the SAME RSM occupancy (recursion off + on)
6
+ # is fit on those recon-only latents and evaluated on visual-cube-single.
7
+ # Both arms --ckpt resumable; wandb offline; render-node lottery -> exclude bad nodes at bsub.
8
+ set -uo pipefail
9
+ cd "$(dirname "$0")/../.."
10
+ [ -f .env ] && set -a && . ./.env && set +a
11
+ export OGBENCH_IMPLS=${OGBENCH_IMPLS:-$HOME/ogbench_ref/impls}
12
+ export XLA_PYTHON_CLIENT_PREALLOCATE=false
13
+ export XLA_PYTHON_CLIENT_MEM_FRACTION=${XLA_PYTHON_CLIENT_MEM_FRACTION:-0.45}
14
+ export MUJOCO_GL=egl
15
+ export WANDB_MODE=disabled
16
+ PY=.ogbench_venv/bin/python
17
+ ENV=visual-cube-single-play-v0
18
+ ESTEPS=100000; EEV=5000; RSTEPS=1000000; RAFTER=100000; REV=25000; ALPHA=0.3
19
+ ENC=ckpt/pixel_enc_visual_cube_single_play_v0_recononly.npz
20
+ LAT=ckpt/visual_cube_single_recononly_latents.npz
21
+ mkdir -p ckpt bsub_outputs
22
+
23
+ if [ ! -f "$ENC" ]; then
24
+ echo "[recononly] stage1: recon-ONLY encoder (w_reward 0, pixels only, NO reward coordinate)"
25
+ $PY ogbench_genq/genq/train_latent_variants_jax.py \
26
+ --env "$ENV" --variant recon-only --w_reward 0 --w_recon 1 --w_consistency 0 \
27
+ --train_steps "$ESTEPS" --eval_every "$EEV" --out "$ENC" \
28
+ 2>&1 | tee "bsub_outputs/cube_enc_recononly.log"
29
+ else echo "[recononly] stage1: encoder exists, skip"; fi
30
+ [ -f "$ENC" ] || { echo "[recononly] FATAL: encoder not produced"; exit 1; }
31
+
32
+ if [ ! -f "$LAT" ]; then
33
+ echo "[recononly] stage2: precompute recon-only latents"
34
+ $PY ogbench_genq/genq/precompute_pixel_latents.py \
35
+ --env "$ENV" --encoder "$ENC" --out "$LAT" \
36
+ 2>&1 | tee "bsub_outputs/cube_precompute_recononly.log"
37
+ else echo "[recononly] stage2: latents exist, skip"; fi
38
+ [ -f "$LAT" ] || { echo "[recononly] FATAL: latents not produced"; exit 1; }
39
+
40
+ echo "[recononly] stage3: RSM recursion-OFF and recursion-ON on recon-only latents"
41
+ $PY ogbench_genq/rsm.py --env "$ENV" \
42
+ --latent_npz "$LAT" --pixel_encoder "$ENC" \
43
+ --recursion off --alpha "$ALPHA" \
44
+ --train_steps "$RSTEPS" --eval_interval "$REV" \
45
+ --ckpt "ckpt/rsm_cube_recononly_recoff.pkl" --ckpt_every "$REV" \
46
+ --variant_tag "cubereconly_recoff" --wandb_mode offline \
47
+ > "bsub_outputs/rsm_cube_recononly_recoff.log" 2>&1 &
48
+ PID_OFF=$!
49
+ $PY ogbench_genq/rsm.py --env "$ENV" \
50
+ --latent_npz "$LAT" --pixel_encoder "$ENC" \
51
+ --recursion on --rec_beta 0.98 --rec_after "$RAFTER" --rec_guard tails \
52
+ --alpha "$ALPHA" \
53
+ --train_steps "$RSTEPS" --eval_interval "$REV" \
54
+ --ckpt "ckpt/rsm_cube_recononly_recon.pkl" --ckpt_every "$REV" \
55
+ --variant_tag "cubereconly_recon" --wandb_mode offline \
56
+ > "bsub_outputs/rsm_cube_recononly_recon.log" 2>&1 &
57
+ PID_ON=$!
58
+ echo "[recononly] off pid=$PID_OFF on pid=$PID_ON ; waiting ..."
59
+ wait "$PID_OFF" || true
60
+ wait "$PID_ON" || true
61
+ echo "[recononly] DONE."
gen_q_rsm/ogbench_genq/experiments/pack_visual_cube_recononly_cal.sh ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # recon-only, σ_z-RECALIBRATED. The first recon-only run got 0.000 because the
3
+ # read-out kernel bandwidth σ_z=1.0 (inherited from the reward-metric encoder) is
4
+ # ~7x the recon-only latent's own scale (median pairwise ‖z-z'‖≈0.15) → the kernel
5
+ # exp(-‖z-z_g‖²/2σ_z²) is FLAT (all pairs ≈0.99), no goal discrimination. Fix
6
+ # (coordinate-free): σ_z set to median/3 ≈ 0.051 from the latent's OWN pairwise stats
7
+ # (no reward coordinate used). Reuse the cached latents (z is independent of σ_z);
8
+ # only the read-out changes. This is the true LeWM-diet apple-to-apple test.
9
+ set -uo pipefail
10
+ cd /proj/inf-scaling/zwhong/projs/gen_q/.claude/worktrees/rsm-visual-recursion
11
+ [ -f .env ] && set -a && . ./.env && set +a
12
+ export OGBENCH_IMPLS=${OGBENCH_IMPLS:-$HOME/ogbench_ref/impls}
13
+ export XLA_PYTHON_CLIENT_PREALLOCATE=false XLA_PYTHON_CLIENT_MEM_FRACTION=0.45
14
+ export MUJOCO_GL=egl WANDB_MODE=disabled
15
+ PY=.ogbench_venv/bin/python
16
+ ENV=visual-cube-single-play-v0
17
+ ENC=ckpt/pixel_enc_visual_cube_single_play_v0_recononly_cal.npz # RECALIBRATED sigma_z
18
+ LAT=ckpt/visual_cube_single_recononly_latents.npz # cached, sigma_z-independent
19
+ RSTEPS=1000000; RAFTER=100000; REV=25000; ALPHA=0.3
20
+ mkdir -p bsub_outputs
21
+ echo "[recononly-cal] stage3 with recalibrated sigma_z; both arms"
22
+ $PY ogbench_genq/rsm.py --env "$ENV" --latent_npz "$LAT" --pixel_encoder "$ENC" \
23
+ --recursion off --alpha "$ALPHA" --train_steps "$RSTEPS" --eval_interval "$REV" \
24
+ --ckpt ckpt/rsm_cube_reconlycal_recoff.pkl --ckpt_every "$REV" \
25
+ --variant_tag cubereconlycal_recoff --wandb_mode offline \
26
+ > bsub_outputs/rsm_cube_reconlycal_recoff.log 2>&1 &
27
+ PID_OFF=$!
28
+ $PY ogbench_genq/rsm.py --env "$ENV" --latent_npz "$LAT" --pixel_encoder "$ENC" \
29
+ --recursion on --rec_beta 0.98 --rec_after "$RAFTER" --rec_guard tails --alpha "$ALPHA" \
30
+ --train_steps "$RSTEPS" --eval_interval "$REV" \
31
+ --ckpt ckpt/rsm_cube_reconlycal_recon.pkl --ckpt_every "$REV" \
32
+ --variant_tag cubereconlycal_recon --wandb_mode offline \
33
+ > bsub_outputs/rsm_cube_reconlycal_recon.log 2>&1 &
34
+ PID_ON=$!
35
+ wait "$PID_OFF" || true; wait "$PID_ON" || true
36
+ echo "[recononly-cal] DONE"
gen_q_rsm/ogbench_genq/experiments/pack_visual_cube_recursion.sh ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Visual-cube-single RSM-image-latent WITH RECURSION (builds on #68 pixel path,
3
+ # stacks on rsm-ogbench-matrix). This is the MODALITY-FAIR comparison against
4
+ # the world-model baselines in the #65 head-to-head, which were tested on
5
+ # visual-cube-single: LeWM 0.68 replay / 0.000 OGBench; DINO-WM 0.54 / 0.000.
6
+ # Both are image-observation, both 0.000 OGBench success. Here we produce a
7
+ # current-design RSM-image-latent number on the SAME env, recursion ON and OFF.
8
+ #
9
+ # Pipeline on ONE GPU (small MLP occupancy + a CNN encoder; fits one H100):
10
+ # stage 1: train the COMBINED (recon+reward) latent encoder (Dan's headline
11
+ # latent objective) on visual-cube-single pixels.
12
+ # stage 2: precompute frozen latents once (cube reads pixels from the h5).
13
+ # stage 3: RSM on the latents, TWO arms packed on the GPU:
14
+ # - recursion OFF (Dan's setup: the WM-fair baseline)
15
+ # - recursion ON (beta=0.98, tails guard, lax.cond warmup gate)
16
+ # both with --ckpt (resumable: preemptable jobs get SSUSP'd).
17
+ #
18
+ # Usage (submitted via a single-GPU preemptable bsub — see the launcher):
19
+ # bash ogbench_genq/experiments/pack_visual_cube_recursion.sh [smoke|full]
20
+ set -uo pipefail
21
+ cd "$(dirname "$0")/../.."
22
+ [ -f .env ] && set -a && . ./.env && set +a
23
+ export OGBENCH_IMPLS=${OGBENCH_IMPLS:-$HOME/ogbench_ref/impls}
24
+ export XLA_PYTHON_CLIENT_PREALLOCATE=false
25
+ export XLA_PYTHON_CLIENT_MEM_FRACTION=${XLA_PYTHON_CLIENT_MEM_FRACTION:-0.45}
26
+ export MUJOCO_GL=egl
27
+ export WANDB_MODE=${WANDB_MODE:-offline}
28
+ PY=.ogbench_venv/bin/python
29
+ ENV=visual-cube-single-play-v0
30
+ MODE=${1:-full}
31
+ mkdir -p ckpt bsub_outputs
32
+
33
+ # encoder (combined = recon+reward) and its precomputed latents
34
+ ENC=ckpt/pixel_enc_visual_cube_single_play_v0_combined.npz
35
+ LAT=ckpt/visual_cube_single_combined_latents.npz
36
+
37
+ if [ "$MODE" = "smoke" ]; then
38
+ ESTEPS=400; EEV=200; MF="--max_frames 40000"; RSTEPS=600; RAFTER=200; REV=200; ALPHA=0.3
39
+ else
40
+ ESTEPS=100000; EEV=5000; MF=""; RSTEPS=1000000; RAFTER=100000; REV=25000; ALPHA=0.3
41
+ fi
42
+
43
+ # ---- stage 1: train the combined latent encoder ----------------------------
44
+ if [ ! -f "$ENC" ]; then
45
+ echo "[cube] stage1: training combined (recon+reward) latent encoder ..."
46
+ $PY ogbench_genq/genq/train_latent_variants_jax.py \
47
+ --env "$ENV" --variant combined --w_reward 1 --w_recon 1 --w_consistency 0 \
48
+ --train_steps "$ESTEPS" --eval_every "$EEV" $MF \
49
+ 2>&1 | tee "bsub_outputs/cube_enc_combined.log"
50
+ else
51
+ echo "[cube] stage1: encoder exists ($ENC), skip"
52
+ fi
53
+ [ -f "$ENC" ] || { echo "[cube] FATAL: encoder not produced"; exit 1; }
54
+
55
+ # ---- stage 2: precompute frozen latents (cube pixels from the h5) ----------
56
+ if [ ! -f "$LAT" ]; then
57
+ echo "[cube] stage2: precomputing latents ..."
58
+ $PY ogbench_genq/genq/precompute_pixel_latents.py \
59
+ --env "$ENV" --encoder "$ENC" --out "$LAT" \
60
+ 2>&1 | tee "bsub_outputs/cube_precompute_combined.log"
61
+ else
62
+ echo "[cube] stage2: latents exist ($LAT), skip"
63
+ fi
64
+ [ -f "$LAT" ] || { echo "[cube] FATAL: latents not produced"; exit 1; }
65
+
66
+ # ---- stage 3: two RSM arms on the GPU (recursion OFF and ON) ----------------
67
+ # alpha 0.3 matches the non-visual cube-single RSM recipe.
68
+ echo "[cube] stage3: RSM recursion-OFF and recursion-ON (both --ckpt resumable)"
69
+
70
+ $PY ogbench_genq/rsm.py --env "$ENV" \
71
+ --latent_npz "$LAT" --pixel_encoder "$ENC" \
72
+ --recursion off --alpha "$ALPHA" \
73
+ --train_steps "$RSTEPS" --eval_interval "$REV" \
74
+ --ckpt "ckpt/rsm_cube_combined_recoff.pkl" --ckpt_every "$REV" \
75
+ --variant_tag "cubecomb_recoff" \
76
+ --wandb_mode offline \
77
+ > "bsub_outputs/rsm_cube_combined_recoff.log" 2>&1 &
78
+ PID_OFF=$!
79
+
80
+ $PY ogbench_genq/rsm.py --env "$ENV" \
81
+ --latent_npz "$LAT" --pixel_encoder "$ENC" \
82
+ --recursion on --rec_beta 0.98 --rec_after "$RAFTER" --rec_guard tails \
83
+ --alpha "$ALPHA" \
84
+ --train_steps "$RSTEPS" --eval_interval "$REV" \
85
+ --ckpt "ckpt/rsm_cube_combined_recon.pkl" --ckpt_every "$REV" \
86
+ --variant_tag "cubecomb_recon" \
87
+ --wandb_mode offline \
88
+ > "bsub_outputs/rsm_cube_combined_recon.log" 2>&1 &
89
+ PID_ON=$!
90
+
91
+ echo "[cube] RSM off pid=$PID_OFF on pid=$PID_ON ; waiting ..."
92
+ wait "$PID_OFF" || true
93
+ wait "$PID_ON" || true
94
+ echo "[cube] DONE. results in ogbench_genq/experiments/$ENV/results/0/"
gen_q_rsm/ogbench_genq/experiments/pack_visual_rsm_fair_training.sh ADDED
@@ -0,0 +1,298 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Pack one fair visual Recursive Successor Model (RSM) training tier into a
3
+ # single GPU allocation. Every cell is a strictly pixels-only, non-TD,
4
+ # discount-conditioned fit implemented by the canonical single-cell launchers.
5
+ #
6
+ # Usage:
7
+ # bash ogbench_genq/experiments/pack_visual_rsm_fair_training.sh \
8
+ # {nonrec-primary|nonrec-secondary|recursion} [--dry-run]
9
+ #
10
+ # Re-running the same tier resumes every cell from its stable full-state
11
+ # checkpoint. Cells are independent background processes; the pack waits for
12
+ # all of them and reports every failure before returning nonzero.
13
+ set -uo pipefail
14
+
15
+ ROOT=$(cd "$(dirname "$0")/../.." && pwd)
16
+ cd "$ROOT"
17
+
18
+ usage() {
19
+ echo "usage: $0 {nonrec-primary|nonrec-secondary|recursion} [--dry-run]" >&2
20
+ exit 2
21
+ }
22
+
23
+ PACK=${1:-}
24
+ case "$PACK" in
25
+ nonrec-primary|nonrec-secondary|recursion) ;;
26
+ *) usage ;;
27
+ esac
28
+ shift
29
+
30
+ DRY_RUN=${PACK_DRY_RUN:-0}
31
+ while [ "$#" -gt 0 ]; do
32
+ case "$1" in
33
+ --dry-run) DRY_RUN=1 ;;
34
+ *) usage ;;
35
+ esac
36
+ shift
37
+ done
38
+ case "$DRY_RUN" in 0|1) ;; *) echo "PACK_DRY_RUN must be 0 or 1" >&2; exit 2 ;; esac
39
+
40
+ MANIFEST=${MANIFEST:-ogbench_genq/experiments/visual_rsm_fair_training_manifest.tsv}
41
+ NONREC_SCRIPT=ogbench_genq/experiments/train_visual_rsm_index_distill.sh
42
+ RECURSION_SCRIPT=ogbench_genq/experiments/train_visual_rsm_occupancy_recursion.sh
43
+ for required in "$MANIFEST" "$NONREC_SCRIPT" "$RECURSION_SCRIPT"; do
44
+ [ -r "$required" ] || {
45
+ echo "[visual-rsm-pack] missing required file: $required" >&2
46
+ exit 1
47
+ }
48
+ done
49
+
50
+ SCREEN_ID=${SCREEN_ID:-fair_visual_rsm_prod_v1}
51
+ case "$SCREEN_ID" in
52
+ *[!A-Za-z0-9._-]*|'')
53
+ echo "[visual-rsm-pack] SCREEN_ID must use only A-Z, a-z, 0-9, dot, underscore, or hyphen" >&2
54
+ exit 2
55
+ ;;
56
+ esac
57
+
58
+ SEED=${SEED:-0}
59
+ TRAIN_STEPS=${TRAIN_STEPS:-150000}
60
+ ARCHIVE_EVERY=${ARCHIVE_EVERY:-25000}
61
+ ACTOR_AFTER=${ACTOR_AFTER:-50000}
62
+ RDEC_SAMPLES=${RDEC_SAMPLES:-16}
63
+ AUDIT_ARCHIVES=${AUDIT_ARCHIVES:-1}
64
+ WANDB_MODE=${WANDB_MODE:-disabled}
65
+ PY=${PY:-/proj/inf-scaling/zwhong/projs/gen_q/.claude/worktrees/rsm-visual-recursion/.ogbench_venv/bin/python}
66
+ CELL_FILTER=${CELL_FILTER:-}
67
+
68
+ case "$PACK" in
69
+ nonrec-primary) DEFAULT_MEM_FRACTION=0.10 ;;
70
+ nonrec-secondary) DEFAULT_MEM_FRACTION=0.18 ;;
71
+ recursion) DEFAULT_MEM_FRACTION=0.14 ;;
72
+ esac
73
+ CELL_MEM_FRACTION=${CELL_MEM_FRACTION:-$DEFAULT_MEM_FRACTION}
74
+ LOG_ROOT=${LOG_ROOT:-bsub_out/visual_rsm_fair/${SCREEN_ID}/${PACK}}
75
+
76
+ is_selected() {
77
+ local cell=$1
78
+ [ -z "$CELL_FILTER" ] && return 0
79
+ case ",$CELL_FILTER," in
80
+ *",$cell,"*) return 0 ;;
81
+ *) return 1 ;;
82
+ esac
83
+ }
84
+
85
+ declare -A SEEN_TAGS=()
86
+ declare -A SEEN_CKPTS=()
87
+ declare -A SEEN_LOGS=()
88
+ PIDS=()
89
+ NAMES=()
90
+ COUNT=0
91
+
92
+ launch_cell() {
93
+ local cell=$1
94
+ local script=$2
95
+ shift 2
96
+
97
+ is_selected "$cell" || return 0
98
+
99
+ local tag="${SCREEN_ID}_${cell}_s${SEED}"
100
+ local ckpt="ckpt/rsm_${tag}.pkl"
101
+ local log="${LOG_ROOT}/${cell}_s${SEED}.log"
102
+
103
+ if [ -n "${SEEN_TAGS[$tag]+x}" ] ||
104
+ [ -n "${SEEN_CKPTS[$ckpt]+x}" ] ||
105
+ [ -n "${SEEN_LOGS[$log]+x}" ]; then
106
+ echo "[visual-rsm-pack] duplicate identity for cell=$cell" >&2
107
+ exit 2
108
+ fi
109
+ SEEN_TAGS[$tag]=1
110
+ SEEN_CKPTS[$ckpt]=1
111
+ SEEN_LOGS[$log]=1
112
+ COUNT=$((COUNT + 1))
113
+
114
+ local cmd=(
115
+ env
116
+ "TAG=$tag"
117
+ "CKPT=$ckpt"
118
+ "PY=$PY"
119
+ "SEED=$SEED"
120
+ "TRAIN_STEPS=$TRAIN_STEPS"
121
+ "ARCHIVE_EVERY=$ARCHIVE_EVERY"
122
+ "ACTOR_AFTER=$ACTOR_AFTER"
123
+ "RDEC_SAMPLES=$RDEC_SAMPLES"
124
+ "WANDB_MODE=$WANDB_MODE"
125
+ "XLA_PYTHON_CLIENT_PREALLOCATE=false"
126
+ "XLA_PYTHON_CLIENT_MEM_FRACTION=$CELL_MEM_FRACTION"
127
+ "OMP_NUM_THREADS=2"
128
+ "OPENBLAS_NUM_THREADS=2"
129
+ "MKL_NUM_THREADS=2"
130
+ "$@"
131
+ bash "$script"
132
+ )
133
+
134
+ printf '[visual-rsm-pack] cell=%s tag=%s ckpt=%s log=%s\n' \
135
+ "$cell" "$tag" "$ckpt" "$log"
136
+ if [ "$DRY_RUN" = 1 ]; then
137
+ printf '[visual-rsm-pack] command='
138
+ printf ' %q' "${cmd[@]}"
139
+ printf '\n'
140
+ return 0
141
+ fi
142
+
143
+ mkdir -p "$(dirname "$log")" "$(dirname "$ckpt")"
144
+ {
145
+ printf '\n[visual-rsm-pack] attempt_utc=%s cell=%s tag=%s\n' \
146
+ "$(date -u +%Y-%m-%dT%H:%M:%SZ)" "$cell" "$tag"
147
+ printf '[visual-rsm-pack] command='
148
+ printf ' %q' "${cmd[@]}"
149
+ printf '\n'
150
+ } >>"$log"
151
+ "${cmd[@]}" >>"$log" 2>&1 &
152
+ PIDS+=("$!")
153
+ NAMES+=("$cell")
154
+ }
155
+
156
+ while IFS=$'\t' read -r pack cell kind latent_update actor_loss alpha gamma beta \
157
+ recursion_state rec_after gamma_horizons gamma_lo actor_action_support \
158
+ occ_hidden beta_mass rationale; do
159
+ [ "$pack" = "pack" ] && continue
160
+ [ "$pack" = "$PACK" ] || continue
161
+
162
+ case "$kind" in
163
+ nonrec)
164
+ [ "$gamma" = "0.99" ] || {
165
+ echo "[visual-rsm-pack] non-recursive launcher fixes gamma=0.99: $cell" >&2
166
+ exit 2
167
+ }
168
+ case "$actor_loss" in
169
+ ddpgbc_distill) expectile=0.9 ;;
170
+ awr_distill) expectile=0.9 ;;
171
+ *) echo "[visual-rsm-pack] invalid non-rec actor loss for $cell" >&2; exit 2 ;;
172
+ esac
173
+ case "$gamma_horizons" in
174
+ 2,4,8,16,32,64) ;;
175
+ *) echo "[visual-rsm-pack] invalid non-rec horizon support for $cell" >&2; exit 2 ;;
176
+ esac
177
+ sampler=$(
178
+ case "$cell" in
179
+ *strat*) echo stratified_bins ;;
180
+ *legacyhmatch*) echo legacy_log_uniform ;;
181
+ *) exit 2 ;;
182
+ esac
183
+ ) || {
184
+ echo "[visual-rsm-pack] cannot infer sampler for $cell" >&2
185
+ exit 2
186
+ }
187
+ launch_cell "$cell" "$NONREC_SCRIPT" \
188
+ "MODE=$actor_loss" \
189
+ "LATENT_UPDATE=$latent_update" \
190
+ "ALPHA=$alpha" \
191
+ "EXPECTILE=$expectile" \
192
+ "GAMMA_SAMPLER=$sampler" \
193
+ "GAMMA_HORIZONS=$gamma_horizons" \
194
+ "GAMMA_LO=$gamma_lo" \
195
+ "GAMMA_TASK_FRACTION=0.5" \
196
+ "DISTILL_ACTOR_GOALS=1" \
197
+ "DISTILL_ACTOR_ACTIONS=$actor_action_support" \
198
+ "DISTILL_ACTOR_ACTION_K=2" \
199
+ "DISTILL_ACTOR_ACTION_SIGMA=0.3" \
200
+ "DISTILL_ACTOR_ACTION_PAIRWISE_WEIGHT=1.0" \
201
+ "FLOW_STEPS=25" \
202
+ "OCC_HIDDEN=$occ_hidden" \
203
+ "OCC_LAYERS=4" \
204
+ "OCC_ACTION_CONTRAST_WEIGHT=0.5" \
205
+ "OCC_ACTION_CONTRAST_MARGIN=0.1" \
206
+ "OCC_ACTION_NEGATIVE=local" \
207
+ "OCC_ACTION_NEGATIVE_SIGMA=0.3" \
208
+ "LATENT_HIDDEN=64" \
209
+ "LATENT_LR=3e-5" \
210
+ "LATENT_GOAL_WEIGHT=0.1" \
211
+ "LATENT_ANCHOR_WEIGHT=0.01" \
212
+ "AUDIT_ARCHIVES=$AUDIT_ARCHIVES"
213
+ ;;
214
+ recursion)
215
+ [ "$latent_update" = frozen ] || {
216
+ echo "[visual-rsm-pack] recursion must freeze the latent: $cell" >&2
217
+ exit 2
218
+ }
219
+ [ "$actor_loss" = ddpgbc_distill ] || {
220
+ echo "[visual-rsm-pack] recursion requires distilled DDPG+BC: $cell" >&2
221
+ exit 2
222
+ }
223
+ if [ "$rec_after" = TRAIN_STEPS ]; then
224
+ resolved_rec_after=$TRAIN_STEPS
225
+ else
226
+ resolved_rec_after=$rec_after
227
+ fi
228
+ launch_cell "$cell" "$RECURSION_SCRIPT" \
229
+ "MODE=$actor_loss" \
230
+ "REC_STATE=$recursion_state" \
231
+ "ALPHA=$alpha" \
232
+ "EXPECTILE=0.9" \
233
+ "GAMMA=$gamma" \
234
+ "BETA=$beta" \
235
+ "REC_DEPTH=12" \
236
+ "REC_AFTER=$resolved_rec_after" \
237
+ "REC_GUARD=ema" \
238
+ "BETA_SAMPLE_PROB=$beta_mass" \
239
+ "GAMMA_SAMPLER=stratified_bins" \
240
+ "GAMMA_HORIZONS=$gamma_horizons" \
241
+ "GAMMA_LO=$gamma_lo" \
242
+ "GAMMA_TASK_FRACTION=0.5" \
243
+ "DISTILL_ACTOR_GOALS=1" \
244
+ "DISTILL_ACTOR_ACTIONS=$actor_action_support" \
245
+ "DISTILL_ACTOR_ACTION_K=2" \
246
+ "DISTILL_ACTOR_ACTION_SIGMA=0.3" \
247
+ "DISTILL_ACTOR_ACTION_PAIRWISE_WEIGHT=1.0" \
248
+ "FLOW_STEPS=25" \
249
+ "OCC_HIDDEN=$occ_hidden" \
250
+ "OCC_LAYERS=4" \
251
+ "OCC_ACTION_CONTRAST_WEIGHT=0.5" \
252
+ "OCC_ACTION_CONTRAST_MARGIN=0.1" \
253
+ "OCC_ACTION_NEGATIVE=local" \
254
+ "OCC_ACTION_NEGATIVE_SIGMA=0.3"
255
+ ;;
256
+ *)
257
+ echo "[visual-rsm-pack] invalid kind=$kind for cell=$cell" >&2
258
+ exit 2
259
+ ;;
260
+ esac
261
+ done <"$MANIFEST"
262
+
263
+ [ "$COUNT" -gt 0 ] || {
264
+ echo "[visual-rsm-pack] no cells selected for pack=$PACK CELL_FILTER=$CELL_FILTER" >&2
265
+ exit 2
266
+ }
267
+
268
+ if [ "$DRY_RUN" = 1 ]; then
269
+ echo "[visual-rsm-pack] dry-run complete pack=$PACK cells=$COUNT"
270
+ exit 0
271
+ fi
272
+
273
+ terminate_children() {
274
+ local pid
275
+ for pid in "${PIDS[@]}"; do
276
+ kill -TERM "$pid" 2>/dev/null || true
277
+ done
278
+ }
279
+ trap terminate_children INT TERM
280
+
281
+ failures=()
282
+ for i in "${!PIDS[@]}"; do
283
+ if wait "${PIDS[$i]}"; then
284
+ echo "[visual-rsm-pack] complete cell=${NAMES[$i]}"
285
+ else
286
+ rc=$?
287
+ failures+=("${NAMES[$i]}:$rc")
288
+ echo "[visual-rsm-pack] failed cell=${NAMES[$i]} rc=$rc" >&2
289
+ fi
290
+ done
291
+
292
+ if [ "${#failures[@]}" -gt 0 ]; then
293
+ printf '[visual-rsm-pack] pack=%s failed cells:' "$PACK" >&2
294
+ printf ' %s' "${failures[@]}" >&2
295
+ printf '\n' >&2
296
+ exit 1
297
+ fi
298
+ echo "[visual-rsm-pack] pack=$PACK complete cells=$COUNT"
gen_q_rsm/ogbench_genq/experiments/pack_visual_rsm_occupancy_recipe_ablation.sh ADDED
@@ -0,0 +1,222 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Two-arm, one-GPU ablation for fair visual RSM occupancy supervision.
3
+ #
4
+ # Both arms are strictly pixels-only, non-TD conditional-flow occupancies over
5
+ # frozen h256 futures. Half of each occupancy batch uses the actor's uniform
6
+ # same-trajectory future-goal distribution. The only varying factor is the
7
+ # normalized frozen index-reader metric auxiliary (lambda 0 versus 1).
8
+ # Recursive composition stays unreachable through the fixed 50k endpoint.
9
+ set -euo pipefail
10
+
11
+ ROOT=$(cd "$(dirname "$0")/../.." && pwd)
12
+ cd "$ROOT"
13
+
14
+ usage() {
15
+ echo "usage: $0 [--dry-run|--execute]" >&2
16
+ exit 2
17
+ }
18
+
19
+ DRY_RUN=${PACK_DRY_RUN:-1}
20
+ while [ "$#" -gt 0 ]; do
21
+ case "$1" in
22
+ --dry-run) DRY_RUN=1 ;;
23
+ --execute) DRY_RUN=0 ;;
24
+ *) usage ;;
25
+ esac
26
+ shift
27
+ done
28
+ case "$DRY_RUN" in
29
+ 0|1) ;;
30
+ *)
31
+ echo "[visual-rsm-occ-recipe] PACK_DRY_RUN must be 0 or 1" >&2
32
+ exit 2
33
+ ;;
34
+ esac
35
+
36
+ CF=${CF:-$ROOT}
37
+ REC=${REC:-/proj/inf-scaling/zwhong/projs/gen_q/.claude/worktrees/rsm-visual-recursion}
38
+ PY=${PY:-$REC/.ogbench_venv/bin/python}
39
+ TRAIN_SCRIPT=ogbench_genq/experiments/train_visual_rsm_occupancy_recursion.sh
40
+ RSM_IMPL=ogbench_genq/rsm.py
41
+ BASE=fair_px_gpred_gciql_z8_w003_gciqlret
42
+ READER_TAG=indexd4_diagmetric
43
+ RDEC=${RDEC:-$CF/ckpt/rdec_${BASE}_${READER_TAG}.npz}
44
+ RDEC_SHA256=9ab338b3940e4c0797b4fc419659d5907f96e745b95a8c57457c85099fdb85a7
45
+
46
+ for required in "$TRAIN_SCRIPT" "$RSM_IMPL"; do
47
+ [ -r "$required" ] || {
48
+ echo "[visual-rsm-occ-recipe] missing required file: $required" >&2
49
+ exit 1
50
+ }
51
+ done
52
+ for literal in \
53
+ '--drop_proprio' \
54
+ '--latent_update frozen' \
55
+ '--occupancy_model flow' \
56
+ '--occ_actor_goal_fraction "$OCC_ACTOR_GOAL_FRACTION"' \
57
+ '--occ_reader_metric_weight "$OCC_READER_METRIC_WEIGHT"' \
58
+ '--recursion occupancy'; do
59
+ rg -Fq -- "$literal" "$TRAIN_SCRIPT" || {
60
+ echo "[visual-rsm-occ-recipe] launcher contract missing: $literal" >&2
61
+ exit 1
62
+ }
63
+ done
64
+ for literal in \
65
+ 'occ_reader_metric_uses_reward_arrays": False' \
66
+ 'occ_reader_metric_uses_coordinates": False' \
67
+ 'occ_reader_metric_uses_td_or_bootstrap": False'; do
68
+ rg -Fq -- "$literal" "$RSM_IMPL" || {
69
+ echo "[visual-rsm-occ-recipe] implementation contract missing: $literal" >&2
70
+ exit 1
71
+ }
72
+ done
73
+
74
+ if [ -s "$RDEC" ]; then
75
+ ACTUAL_RDEC_SHA256=$(sha256sum "$RDEC")
76
+ ACTUAL_RDEC_SHA256=${ACTUAL_RDEC_SHA256%% *}
77
+ [ "$ACTUAL_RDEC_SHA256" = "$RDEC_SHA256" ] || {
78
+ echo "[visual-rsm-occ-recipe] reader checksum mismatch: expected=$RDEC_SHA256 actual=$ACTUAL_RDEC_SHA256" >&2
79
+ exit 1
80
+ }
81
+ elif [ "$DRY_RUN" = 0 ]; then
82
+ echo "[visual-rsm-occ-recipe] missing reader: $RDEC" >&2
83
+ exit 1
84
+ else
85
+ echo "[visual-rsm-occ-recipe] reader preflight deferred in dry-run: $RDEC"
86
+ fi
87
+
88
+ SCREEN_ID=${SCREEN_ID:-fair_visual_rsm_occ_recipe_v1}
89
+ case "$SCREEN_ID" in
90
+ *[!A-Za-z0-9._-]*|'')
91
+ echo "[visual-rsm-occ-recipe] SCREEN_ID contains unsafe characters" >&2
92
+ exit 2
93
+ ;;
94
+ esac
95
+ SEED=${SEED:-0}
96
+ TRAIN_STEPS=${TRAIN_STEPS:-50000}
97
+ [ "$TRAIN_STEPS" = 50000 ] || {
98
+ echo "[visual-rsm-occ-recipe] endpoint is fixed at TRAIN_STEPS=50000" >&2
99
+ exit 2
100
+ }
101
+ LOG_ROOT=${LOG_ROOT:-bsub_out/visual_rsm_occupancy_recipe/${SCREEN_ID}}
102
+ CELL_MEM_FRACTION=${CELL_MEM_FRACTION:-0.44}
103
+
104
+ PIDS=()
105
+ NAMES=()
106
+ launch_arm() {
107
+ local arm=$1
108
+ local metric_weight=$2
109
+ local tag="${SCREEN_ID}_${arm}_s${SEED}"
110
+ local checkpoint="ckpt/rsm_${tag}.pkl"
111
+ local log="${LOG_ROOT}/${arm}_s${SEED}.log"
112
+ local -a command=(
113
+ env
114
+ "CF=$CF"
115
+ "PY=$PY"
116
+ "TAG=$tag"
117
+ "CKPT=$checkpoint"
118
+ "SEED=$SEED"
119
+ "TRAIN_STEPS=$TRAIN_STEPS"
120
+ "ARCHIVE_EVERY=25000"
121
+ "MODE=ddpgbc_distill"
122
+ "REC_STATE=hidden"
123
+ "READER_DELTA=4"
124
+ "READER_TAG=$READER_TAG"
125
+ "RDEC=$RDEC"
126
+ "RDEC_SHA256=$RDEC_SHA256"
127
+ "RDEC_SAMPLES=16"
128
+ "ACTOR_AFTER=0"
129
+ "ALPHA=1.0"
130
+ "EXPECTILE=0.9"
131
+ "DISTILL_ACTOR_GOALS=1"
132
+ "DISTILL_ACTOR_ACTIONS=1"
133
+ "DISTILL_ACTOR_ACTION_K=2"
134
+ "DISTILL_ACTOR_ACTION_SIGMA=0.3"
135
+ "DISTILL_ACTOR_ACTION_PAIRWISE_WEIGHT=1.0"
136
+ "FLOW_STEPS=25"
137
+ "OCC_HIDDEN=512"
138
+ "OCC_LAYERS=4"
139
+ "OCC_ACTION_CONTRAST_WEIGHT=0.5"
140
+ "OCC_ACTION_CONTRAST_MARGIN=0.1"
141
+ "OCC_ACTION_NEGATIVE=actor_local"
142
+ "OCC_ACTION_NEGATIVE_SIGMA=0.3"
143
+ "OCC_ACTION_NEGATIVE_K=2"
144
+ "OCC_ACTOR_GOAL_FRACTION=0.5"
145
+ "OCC_READER_METRIC_WEIGHT=$metric_weight"
146
+ "GAMMA=0.99"
147
+ "BETA=0.98"
148
+ "REC_DEPTH=12"
149
+ "REC_AFTER=1000000000"
150
+ "REC_GUARD=ema"
151
+ "BETA_SAMPLE_PROB=0.25"
152
+ "GAMMA_SAMPLER=stratified_bins"
153
+ "GAMMA_HORIZONS=2,4,8,16,32,50,64"
154
+ "GAMMA_LO=0.50"
155
+ "GAMMA_TASK_FRACTION=0.5"
156
+ "WANDB_MODE=disabled"
157
+ "XLA_PYTHON_CLIENT_PREALLOCATE=false"
158
+ "XLA_PYTHON_CLIENT_MEM_FRACTION=$CELL_MEM_FRACTION"
159
+ "OMP_NUM_THREADS=3"
160
+ "OPENBLAS_NUM_THREADS=3"
161
+ "MKL_NUM_THREADS=3"
162
+ bash "$TRAIN_SCRIPT"
163
+ )
164
+ printf '[visual-rsm-occ-recipe] arm=%s actor_goal_fraction=0.5 reader_metric_weight=%s checkpoint=%s log=%s\n' \
165
+ "$arm" "$metric_weight" "$checkpoint" "$log"
166
+ if [ "$DRY_RUN" = 1 ]; then
167
+ printf '[visual-rsm-occ-recipe] command='
168
+ printf ' %q' "${command[@]}"
169
+ printf '\n'
170
+ return 0
171
+ fi
172
+ [ ! -e "$checkpoint" ] || {
173
+ echo "[visual-rsm-occ-recipe] refusing existing destination: $checkpoint" >&2
174
+ exit 1
175
+ }
176
+ mkdir -p "$(dirname "$checkpoint")" "$(dirname "$log")"
177
+ {
178
+ printf '[visual-rsm-occ-recipe] attempt_utc=%s arm=%s reader_metric_weight=%s\n' \
179
+ "$(date -u +%Y-%m-%dT%H:%M:%SZ)" "$arm" "$metric_weight"
180
+ printf '[visual-rsm-occ-recipe] command='
181
+ printf ' %q' "${command[@]}"
182
+ printf '\n'
183
+ } >>"$log"
184
+ "${command[@]}" >>"$log" 2>&1 &
185
+ PIDS+=("$!")
186
+ NAMES+=("$arm")
187
+ }
188
+
189
+ launch_arm goalmix05_metric0 0.0
190
+ launch_arm goalmix05_metric1 1.0
191
+
192
+ echo "[visual-rsm-occ-recipe] invariants arms=2 pixels_only=true drop_proprio=true frozen_encoder=true flow=true discount_conditioned=true no_td=true actor_goal_fraction=0.5 recursion_composition_inactive_through_step50000=true"
193
+ if [ "$DRY_RUN" = 1 ]; then
194
+ echo "[visual-rsm-occ-recipe] dry-run complete no_training=true no_submission=true"
195
+ exit 0
196
+ fi
197
+
198
+ terminate_children() {
199
+ local pid
200
+ for pid in "${PIDS[@]}"; do
201
+ kill -TERM "$pid" 2>/dev/null || true
202
+ done
203
+ }
204
+ trap terminate_children INT TERM
205
+
206
+ FAILURES=()
207
+ for index in "${!PIDS[@]}"; do
208
+ if wait "${PIDS[$index]}"; then
209
+ echo "[visual-rsm-occ-recipe] complete arm=${NAMES[$index]}"
210
+ else
211
+ rc=$?
212
+ FAILURES+=("${NAMES[$index]}:$rc")
213
+ echo "[visual-rsm-occ-recipe] failed arm=${NAMES[$index]} rc=$rc" >&2
214
+ fi
215
+ done
216
+ [ "${#FAILURES[@]}" -eq 0 ] || {
217
+ printf '[visual-rsm-occ-recipe] failures:' >&2
218
+ printf ' %s' "${FAILURES[@]}" >&2
219
+ printf '\n' >&2
220
+ exit 1
221
+ }
222
+ echo "[visual-rsm-occ-recipe] complete arms=2"
gen_q_rsm/ogbench_genq/experiments/pack_visual_rsm_onehop_30k_eval.sh ADDED
@@ -0,0 +1,147 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Exact official rollout of the immutable 30k frozen and jointly adapted
3
+ # compact one-hop checkpoints. Both are strictly pixels-only RSM actors.
4
+ set -euo pipefail
5
+
6
+ ROOT=/proj/inf-scaling/zwhong/projs/gen_q/.claude/worktrees/rsm-visual-coordfree
7
+ cd "$ROOT"
8
+
9
+ PREFLIGHT_ONLY=0
10
+ if [ "${1:-}" = "--preflight-only" ]; then
11
+ PREFLIGHT_ONLY=1
12
+ elif [ "$#" -ne 0 ]; then
13
+ echo "usage: $0 [--preflight-only]" >&2
14
+ exit 2
15
+ fi
16
+
17
+ PY=${PY:-/proj/inf-scaling/zwhong/projs/gen_q/.ogbench_venv/bin/python}
18
+ RDEC=ckpt/rdec_fair_px_gpred_gciql_z8_w003_gciqlret_indexd4_diagmetric.npz
19
+ RDEC_SHA256=9ab338b3940e4c0797b4fc419659d5907f96e745b95a8c57457c85099fdb85a7
20
+ LOG_ROOT=bsub_out/visual_rsm_onehop_v2/official_step30000
21
+ mkdir -p "$LOG_ROOT"
22
+
23
+ actual_reader_sha=$(sha256sum "$RDEC")
24
+ actual_reader_sha=${actual_reader_sha%% *}
25
+ [ "$actual_reader_sha" = "$RDEC_SHA256" ] || {
26
+ echo "[visual-rsm-30k-eval] reader SHA mismatch" >&2
27
+ exit 1
28
+ }
29
+
30
+ preflight() {
31
+ local checkpoint=$1
32
+ local latent_update=$2
33
+ local action_negative=$3
34
+ "$PY" - "$checkpoint" "$latent_update" "$action_negative" <<'PY'
35
+ import pickle
36
+ import sys
37
+
38
+ checkpoint, latent_update, action_negative = sys.argv[1:]
39
+ with open(checkpoint, "rb") as handle:
40
+ blob = pickle.load(handle)
41
+ meta = blob["run_meta"]
42
+ step = int(blob["carry"][9])
43
+ expected = {
44
+ "env": "visual-cube-single-play-v0",
45
+ "drop_proprio": True,
46
+ "discount_conditioned": True,
47
+ "occupancy_model": "flow",
48
+ "recursion": "off",
49
+ "uses_td_or_bootstrap": False,
50
+ "occupancy_uses_reward_labels": False,
51
+ "occupancy_uses_simulator_coordinates": False,
52
+ "uses_completion_or_forward_model": False,
53
+ "occupancy_and_actor_jointly_updated": True,
54
+ "occ_action_negative": action_negative,
55
+ "reward_decoder_model": "diag_metric",
56
+ "reward_decoder_target": "index",
57
+ "reward_decoder_index_delta": 4,
58
+ }
59
+ bad = {
60
+ key: (meta.get(key), value)
61
+ for key, value in expected.items()
62
+ if meta.get(key) != value
63
+ }
64
+ actual_latent_update = meta.get("latent_update", "frozen")
65
+ if actual_latent_update != latent_update:
66
+ bad["latent_update"] = (actual_latent_update, latent_update)
67
+ if step != 30_000 or bad:
68
+ raise SystemExit(
69
+ f"checkpoint preflight failed: step={step} bad={bad}")
70
+ print(
71
+ f"[visual-rsm-30k-eval] verified checkpoint={checkpoint} "
72
+ f"step={step} latent={latent_update} negative={action_negative}",
73
+ flush=True,
74
+ )
75
+ PY
76
+ }
77
+
78
+ launch() {
79
+ local cell=$1
80
+ local latent_update=$2
81
+ local action_negative=$3
82
+ local checkpoint="ckpt/rsm_fair_visual_rsm_onehop_v2_${cell}_s0_step30000_manual.pkl"
83
+ local tag="fair_visual_rsm_onehop_v2_${cell}_step30000_official"
84
+ local diagnostic="ogbench_genq/experiments/visual-cube-single-play-v0/${tag}_distill_audit.json"
85
+ local log="$LOG_ROOT/${cell}.log"
86
+ [ -s "$checkpoint" ] || {
87
+ echo "[visual-rsm-30k-eval] missing checkpoint $checkpoint" >&2
88
+ exit 1
89
+ }
90
+ preflight "$checkpoint" "$latent_update" "$action_negative"
91
+ if [ "$PREFLIGHT_ONLY" = 1 ]; then
92
+ return
93
+ fi
94
+ env \
95
+ PY="$PY" \
96
+ CKPT="$checkpoint" \
97
+ TAG="$tag" \
98
+ DIAG_OUT="$diagnostic" \
99
+ TRAIN_STEPS=50000 \
100
+ LATENT_UPDATE="$latent_update" \
101
+ OCC_ACTION_NEGATIVE="$action_negative" \
102
+ OCC_ACTION_NEGATIVE_K=2 \
103
+ ACTOR_AFTER=0 \
104
+ READER_DELTA=4 \
105
+ READER_TAG=indexd4_diagmetric \
106
+ RDEC="$ROOT/$RDEC" \
107
+ RDEC_SAMPLES=16 \
108
+ FLOW_STEPS=25 \
109
+ OCC_HIDDEN=256 \
110
+ OCC_LAYERS=4 \
111
+ GAMMA_SAMPLER=stratified_bins \
112
+ GAMMA_HORIZONS=2,4,8,16,32,64 \
113
+ GAMMA_TASK_FRACTION=0.5 \
114
+ XLA_PYTHON_CLIENT_PREALLOCATE=false \
115
+ XLA_PYTHON_CLIENT_MEM_FRACTION=0.45 \
116
+ WANDB_MODE=disabled \
117
+ bash ogbench_genq/experiments/eval_visual_rsm_index_distill.sh \
118
+ >"$log" 2>&1 &
119
+ PIDS+=("$!")
120
+ NAMES+=("$cell")
121
+ }
122
+
123
+ PIDS=()
124
+ NAMES=()
125
+ launch frozen_local frozen local
126
+ launch rich_adapter_actor_local rich_adapter actor_local
127
+
128
+ if [ "$PREFLIGHT_ONLY" = 1 ]; then
129
+ echo "[visual-rsm-30k-eval] preflight-only complete"
130
+ exit 0
131
+ fi
132
+
133
+ failed=()
134
+ for index in "${!PIDS[@]}"; do
135
+ if wait "${PIDS[$index]}"; then
136
+ echo "[visual-rsm-30k-eval] complete cell=${NAMES[$index]}"
137
+ else
138
+ rc=$?
139
+ failed+=("${NAMES[$index]}:$rc")
140
+ fi
141
+ done
142
+ if [ "${#failed[@]}" -gt 0 ]; then
143
+ printf '[visual-rsm-30k-eval] failed:' >&2
144
+ printf ' %s' "${failed[@]}" >&2
145
+ printf '\n' >&2
146
+ exit 1
147
+ fi
gen_q_rsm/ogbench_genq/experiments/pack_visual_rsm_onehop_v2.sh ADDED
@@ -0,0 +1,346 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Compact visual Recursive Successor Model (RSM) one-hop screen. The four
3
+ # manifest cells jointly update occupancy and actor in the canonical fused loop.
4
+ # The fixed recipe is pixels-only, non-TD, discount-conditioned conditional
5
+ # flow, index-d4 diagonal reader, stratified horizons, and DDPG+BC extraction.
6
+ #
7
+ # Usage:
8
+ # bash ogbench_genq/experiments/pack_visual_rsm_onehop_v2.sh [--dry-run]
9
+ #
10
+ # A dry run validates the complete four-cell manifest and prints every command.
11
+ # A real run first validates the reward-reader metadata, then packs the four
12
+ # independently resumable cells as background processes in one GPU allocation.
13
+ set -uo pipefail
14
+
15
+ ROOT=$(cd "$(dirname "$0")/../.." && pwd)
16
+ cd "$ROOT"
17
+
18
+ usage() {
19
+ echo "usage: $0 [--dry-run]" >&2
20
+ exit 2
21
+ }
22
+
23
+ DRY_RUN=${PACK_DRY_RUN:-0}
24
+ while [ "$#" -gt 0 ]; do
25
+ case "$1" in
26
+ --dry-run) DRY_RUN=1 ;;
27
+ *) usage ;;
28
+ esac
29
+ shift
30
+ done
31
+ case "$DRY_RUN" in
32
+ 0|1) ;;
33
+ *) echo "[visual-rsm-onehop-v2] PACK_DRY_RUN must be 0 or 1" >&2; exit 2 ;;
34
+ esac
35
+
36
+ MANIFEST=${MANIFEST:-ogbench_genq/experiments/visual_rsm_onehop_v2_manifest.tsv}
37
+ TRAIN_SCRIPT=ogbench_genq/experiments/train_visual_rsm_index_distill.sh
38
+ CF=${CF:-/proj/inf-scaling/zwhong/projs/gen_q/.claude/worktrees/rsm-visual-coordfree}
39
+ REC=${REC:-/proj/inf-scaling/zwhong/projs/gen_q/.claude/worktrees/rsm-visual-recursion}
40
+ PY=${PY:-$REC/.ogbench_venv/bin/python}
41
+ RSM_IMPL=$CF/ogbench_genq/rsm.py
42
+ BASE=fair_px_gpred_gciql_z8_w003_gciqlret
43
+ READER_DELTA=4
44
+ READER_TAG=indexd4_diagmetric
45
+ RDEC=${RDEC:-$CF/ckpt/rdec_${BASE}_${READER_TAG}.npz}
46
+ RDEC_SHA256=${RDEC_SHA256:-9ab338b3940e4c0797b4fc419659d5907f96e745b95a8c57457c85099fdb85a7}
47
+
48
+ for required in "$MANIFEST" "$TRAIN_SCRIPT" "$RSM_IMPL"; do
49
+ [ -r "$required" ] || {
50
+ echo "[visual-rsm-onehop-v2] missing required file: $required" >&2
51
+ exit 1
52
+ }
53
+ done
54
+
55
+ require_literal() {
56
+ local literal=$1
57
+ local file=$2
58
+ grep -Fq -- "$literal" "$file" || {
59
+ echo "[visual-rsm-onehop-v2] required contract '$literal' absent from $file" >&2
60
+ exit 1
61
+ }
62
+ }
63
+
64
+ # Fail closed if the canonical launcher or implementation no longer encodes the
65
+ # pixels-only, one-hop, jointly updated, non-TD contract.
66
+ require_literal '--drop_proprio' "$TRAIN_SCRIPT"
67
+ require_literal '--occupancy_model flow' "$TRAIN_SCRIPT"
68
+ require_literal '--recursion off' "$TRAIN_SCRIPT"
69
+ require_literal '--actor_after "$ACTOR_AFTER"' "$TRAIN_SCRIPT"
70
+ require_literal 'uses_td_or_bootstrap=False' "$RSM_IMPL"
71
+ require_literal 'occupancy_and_actor_jointly_updated=bool(' "$RSM_IMPL"
72
+ require_literal 'q_weight = (step >= actor_after)' "$RSM_IMPL"
73
+ if grep -Fq -- '--freeze_occupancy' "$TRAIN_SCRIPT"; then
74
+ echo "[visual-rsm-onehop-v2] canonical launcher unexpectedly freezes occupancy" >&2
75
+ exit 1
76
+ fi
77
+
78
+ SCREEN_ID=${SCREEN_ID:-fair_visual_rsm_onehop_v2}
79
+ case "$SCREEN_ID" in
80
+ *[!A-Za-z0-9._-]*|'')
81
+ echo "[visual-rsm-onehop-v2] SCREEN_ID must use only A-Z, a-z, 0-9, dot, underscore, or hyphen" >&2
82
+ exit 2
83
+ ;;
84
+ esac
85
+
86
+ SEED=${SEED:-0}
87
+ TRAIN_STEPS=${TRAIN_STEPS:-50000}
88
+ ARCHIVE_EVERY=${ARCHIVE_EVERY:-25000}
89
+ RDEC_SAMPLES=${RDEC_SAMPLES:-16}
90
+ AUDIT_ARCHIVES=${AUDIT_ARCHIVES:-1}
91
+ WANDB_MODE=${WANDB_MODE:-disabled}
92
+ CELL_MEM_FRACTION=${CELL_MEM_FRACTION:-0.20}
93
+ CELL_FILTER=${CELL_FILTER:-}
94
+ LOG_ROOT=${LOG_ROOT:-bsub_out/visual_rsm_onehop_v2/${SCREEN_ID}}
95
+
96
+ case "$AUDIT_ARCHIVES" in
97
+ 0|1) ;;
98
+ *) echo "[visual-rsm-onehop-v2] AUDIT_ARCHIVES must be 0 or 1" >&2; exit 2 ;;
99
+ esac
100
+
101
+ validate_reader() {
102
+ [ -s "$RDEC" ] || {
103
+ echo "[visual-rsm-onehop-v2] missing diagonal reader: $RDEC" >&2
104
+ exit 1
105
+ }
106
+ local actual_sha256
107
+ actual_sha256=$(sha256sum "$RDEC") || return $?
108
+ actual_sha256=${actual_sha256%% *}
109
+ [ "$actual_sha256" = "$RDEC_SHA256" ] || {
110
+ echo "[visual-rsm-onehop-v2] reader checksum mismatch: expected=$RDEC_SHA256 actual=$actual_sha256 path=$RDEC" >&2
111
+ return 1
112
+ }
113
+ PYTHONPATH="$CF${PYTHONPATH:+:$PYTHONPATH}" "$PY" - "$RDEC" <<'PY' || return $?
114
+ import sys
115
+
116
+ from ogbench_genq.genq.reward_reader import load_numpy_reward_reader
117
+
118
+ _, metadata = load_numpy_reward_reader(sys.argv[1])
119
+ expected = {
120
+ "reader_model": "diag_metric",
121
+ "target": "index",
122
+ "index_delta": 4,
123
+ "pixels_only_latents": True,
124
+ "frozen_encoder": True,
125
+ "uses_coordinates_for_training": False,
126
+ "uses_reward_arrays": False,
127
+ "uses_td_or_bootstrap": False,
128
+ }
129
+ errors = [
130
+ f"{key}: expected {value!r}, got {metadata.get(key)!r}"
131
+ for key, value in expected.items()
132
+ if metadata.get(key) != value
133
+ ]
134
+ if errors:
135
+ raise SystemExit(
136
+ "[visual-rsm-onehop-v2] reader contract mismatch:\n "
137
+ + "\n ".join(errors)
138
+ )
139
+ print(
140
+ "[visual-rsm-onehop-v2] reader verified "
141
+ f"model={metadata['reader_model']} target={metadata['target']} "
142
+ f"index_delta={metadata['index_delta']} pixels_only=true non_td=true",
143
+ flush=True,
144
+ )
145
+ PY
146
+ echo "[visual-rsm-onehop-v2] reader sha256=$actual_sha256"
147
+ }
148
+
149
+ if [ -s "$RDEC" ]; then
150
+ validate_reader || exit $?
151
+ elif [ "$DRY_RUN" = 0 ]; then
152
+ validate_reader || exit $?
153
+ else
154
+ echo "[visual-rsm-onehop-v2] reader preflight deferred in dry-run: $RDEC"
155
+ fi
156
+
157
+ is_selected() {
158
+ local cell=$1
159
+ [ -z "$CELL_FILTER" ] && return 0
160
+ case ",$CELL_FILTER," in
161
+ *",$cell,"*) return 0 ;;
162
+ *) return 1 ;;
163
+ esac
164
+ }
165
+
166
+ declare -A SEEN_ARMS=()
167
+ declare -A SEEN_TAGS=()
168
+ declare -A SEEN_CKPTS=()
169
+ declare -A SEEN_LOGS=()
170
+ PIDS=()
171
+ NAMES=()
172
+ TOTAL=0
173
+ COUNT=0
174
+
175
+ launch_cell() {
176
+ local cell=$1
177
+ local latent_update=$2
178
+ local action_negative=$3
179
+
180
+ is_selected "$cell" || return 0
181
+
182
+ local tag="${SCREEN_ID}_${cell}_s${SEED}"
183
+ local ckpt="ckpt/rsm_${tag}.pkl"
184
+ local log="${LOG_ROOT}/${cell}_s${SEED}.log"
185
+ if [ -n "${SEEN_TAGS[$tag]+x}" ] ||
186
+ [ -n "${SEEN_CKPTS[$ckpt]+x}" ] ||
187
+ [ -n "${SEEN_LOGS[$log]+x}" ]; then
188
+ echo "[visual-rsm-onehop-v2] duplicate output identity for cell=$cell" >&2
189
+ exit 2
190
+ fi
191
+ SEEN_TAGS[$tag]=1
192
+ SEEN_CKPTS[$ckpt]=1
193
+ SEEN_LOGS[$log]=1
194
+ COUNT=$((COUNT + 1))
195
+
196
+ local cmd=(
197
+ env
198
+ "TAG=$tag"
199
+ "CKPT=$ckpt"
200
+ "PY=$PY"
201
+ "SEED=$SEED"
202
+ "TRAIN_STEPS=$TRAIN_STEPS"
203
+ "ARCHIVE_EVERY=$ARCHIVE_EVERY"
204
+ "MODE=ddpgbc_distill"
205
+ "LATENT_UPDATE=$latent_update"
206
+ "READER_DELTA=$READER_DELTA"
207
+ "READER_TAG=$READER_TAG"
208
+ "RDEC=$RDEC"
209
+ "RDEC_SAMPLES=$RDEC_SAMPLES"
210
+ "ACTOR_AFTER=0"
211
+ "ALPHA=1.0"
212
+ "EXPECTILE=0.9"
213
+ "DISTILL_ACTOR_GOALS=1"
214
+ "DISTILL_ACTOR_ACTIONS=1"
215
+ "DISTILL_ACTOR_ACTION_K=2"
216
+ "DISTILL_ACTOR_ACTION_SIGMA=0.3"
217
+ "DISTILL_ACTOR_ACTION_PAIRWISE_WEIGHT=1.0"
218
+ "FLOW_STEPS=25"
219
+ "OCC_HIDDEN=256"
220
+ "OCC_LAYERS=4"
221
+ "OCC_ACTION_CONTRAST_WEIGHT=0.5"
222
+ "OCC_ACTION_CONTRAST_MARGIN=0.1"
223
+ "OCC_ACTION_NEGATIVE=$action_negative"
224
+ "OCC_ACTION_NEGATIVE_SIGMA=0.3"
225
+ "OCC_ACTION_NEGATIVE_K=2"
226
+ "GAMMA_SAMPLER=stratified_bins"
227
+ "GAMMA_HORIZONS=2,4,8,16,32,64"
228
+ "GAMMA_LO=0.50"
229
+ "GAMMA_TASK_FRACTION=0.5"
230
+ "LATENT_HIDDEN=64"
231
+ "LATENT_LR=3e-5"
232
+ "LATENT_GOAL_WEIGHT=0.1"
233
+ "LATENT_ANCHOR_WEIGHT=0.01"
234
+ "AUDIT_ARCHIVES=$AUDIT_ARCHIVES"
235
+ "WANDB_MODE=$WANDB_MODE"
236
+ "XLA_PYTHON_CLIENT_PREALLOCATE=false"
237
+ "XLA_PYTHON_CLIENT_MEM_FRACTION=$CELL_MEM_FRACTION"
238
+ "OMP_NUM_THREADS=2"
239
+ "OPENBLAS_NUM_THREADS=2"
240
+ "MKL_NUM_THREADS=2"
241
+ bash "$TRAIN_SCRIPT"
242
+ )
243
+
244
+ printf '[visual-rsm-onehop-v2] cell=%s latent=%s negative=%s tag=%s log=%s\n' \
245
+ "$cell" "$latent_update" "$action_negative" "$tag" "$log"
246
+ if [ "$DRY_RUN" = 1 ]; then
247
+ printf '[visual-rsm-onehop-v2] command='
248
+ printf ' %q' "${cmd[@]}"
249
+ printf '\n'
250
+ return 0
251
+ fi
252
+
253
+ mkdir -p "$(dirname "$log")" "$(dirname "$ckpt")"
254
+ {
255
+ printf '\n[visual-rsm-onehop-v2] attempt_utc=%s cell=%s tag=%s\n' \
256
+ "$(date -u +%Y-%m-%dT%H:%M:%SZ)" "$cell" "$tag"
257
+ printf '[visual-rsm-onehop-v2] command='
258
+ printf ' %q' "${cmd[@]}"
259
+ printf '\n'
260
+ } >>"$log"
261
+ "${cmd[@]}" >>"$log" 2>&1 &
262
+ PIDS+=("$!")
263
+ NAMES+=("$cell")
264
+ }
265
+
266
+ while IFS=$'\t' read -r cell latent_update action_negative rationale; do
267
+ [ "$cell" = cell ] && continue
268
+ [ -n "$cell" ] || continue
269
+ case "$cell" in
270
+ *[!A-Za-z0-9._-]*)
271
+ echo "[visual-rsm-onehop-v2] invalid cell name: $cell" >&2
272
+ exit 2
273
+ ;;
274
+ esac
275
+ case "$latent_update" in
276
+ frozen|rich_adapter) ;;
277
+ *) echo "[visual-rsm-onehop-v2] invalid latent_update for $cell" >&2; exit 2 ;;
278
+ esac
279
+ case "$action_negative" in
280
+ local|actor_local) ;;
281
+ *) echo "[visual-rsm-onehop-v2] invalid action negative for $cell" >&2; exit 2 ;;
282
+ esac
283
+
284
+ arm="${latent_update}/${action_negative}"
285
+ [ -z "${SEEN_ARMS[$arm]+x}" ] || {
286
+ echo "[visual-rsm-onehop-v2] duplicate arm: $arm" >&2
287
+ exit 2
288
+ }
289
+ SEEN_ARMS[$arm]=$cell
290
+ TOTAL=$((TOTAL + 1))
291
+ launch_cell "$cell" "$latent_update" "$action_negative"
292
+ done <"$MANIFEST"
293
+
294
+ EXPECTED_ARMS=(
295
+ frozen/local
296
+ frozen/actor_local
297
+ rich_adapter/local
298
+ rich_adapter/actor_local
299
+ )
300
+ [ "$TOTAL" -eq 4 ] || {
301
+ echo "[visual-rsm-onehop-v2] manifest must contain exactly four arms; found $TOTAL" >&2
302
+ exit 2
303
+ }
304
+ for arm in "${EXPECTED_ARMS[@]}"; do
305
+ [ -n "${SEEN_ARMS[$arm]+x}" ] || {
306
+ echo "[visual-rsm-onehop-v2] manifest missing arm: $arm" >&2
307
+ exit 2
308
+ }
309
+ done
310
+ [ "$COUNT" -gt 0 ] || {
311
+ echo "[visual-rsm-onehop-v2] CELL_FILTER selected no cells: $CELL_FILTER" >&2
312
+ exit 2
313
+ }
314
+
315
+ echo "[visual-rsm-onehop-v2] invariants pixels_only=true drop_proprio=true non_td=true occupancy_model=flow recursion=off reader=${READER_TAG} actor_q_start=0 sampler=stratified_bins"
316
+ if [ "$DRY_RUN" = 1 ]; then
317
+ echo "[visual-rsm-onehop-v2] dry-run complete cells=$COUNT manifest_arms=$TOTAL"
318
+ exit 0
319
+ fi
320
+
321
+ terminate_children() {
322
+ local pid
323
+ for pid in "${PIDS[@]}"; do
324
+ kill -TERM "$pid" 2>/dev/null || true
325
+ done
326
+ }
327
+ trap terminate_children INT TERM
328
+
329
+ failures=()
330
+ for i in "${!PIDS[@]}"; do
331
+ if wait "${PIDS[$i]}"; then
332
+ echo "[visual-rsm-onehop-v2] complete cell=${NAMES[$i]}"
333
+ else
334
+ rc=$?
335
+ failures+=("${NAMES[$i]}:$rc")
336
+ echo "[visual-rsm-onehop-v2] failed cell=${NAMES[$i]} rc=$rc" >&2
337
+ fi
338
+ done
339
+
340
+ if [ "${#failures[@]}" -gt 0 ]; then
341
+ printf '[visual-rsm-onehop-v2] failed cells:' >&2
342
+ printf ' %s' "${failures[@]}" >&2
343
+ printf '\n' >&2
344
+ exit 1
345
+ fi
346
+ echo "[visual-rsm-onehop-v2] complete cells=$COUNT"
gen_q_rsm/ogbench_genq/experiments/pack_visual_rsm_protected_endpoint_ablation.sh ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Print (but never execute) the four-cell protected-endpoint visual RSM plan.
3
+ #
4
+ # Cells cross frozen versus jointly trained reward-predictive latent with
5
+ # lambda_hit in {0, 0.25}. Every cell jointly updates the conditional-flow
6
+ # occupancy and trainable pixel actor. Recursive composition is deliberately
7
+ # off: beta is protected as a supervised discount endpoint before composition.
8
+ set -euo pipefail
9
+
10
+ ROOT=$(cd "$(dirname "$0")/../.." && pwd)
11
+ cd "$ROOT"
12
+
13
+ if [ "${PACK_DRY_RUN:-1}" != 1 ]; then
14
+ echo "[visual-rsm-protected] this launcher is dry-run only" >&2
15
+ exit 2
16
+ fi
17
+ if [ "$#" -gt 1 ] || { [ "$#" -eq 1 ] && [ "$1" != "--dry-run" ]; }; then
18
+ echo "usage: $0 [--dry-run]" >&2
19
+ exit 2
20
+ fi
21
+
22
+ TRAIN_SCRIPT=ogbench_genq/experiments/train_visual_rsm_pixel_actor.sh
23
+ RSM_IMPL=ogbench_genq/rsm.py
24
+ for required in "$TRAIN_SCRIPT" "$RSM_IMPL"; do
25
+ [ -r "$required" ] || {
26
+ echo "[visual-rsm-protected] missing required file: $required" >&2
27
+ exit 1
28
+ }
29
+ done
30
+ for literal in \
31
+ '--actor_input pixels' \
32
+ '--drop_proprio' \
33
+ '--occupancy_model flow' \
34
+ '--occ_reader_hit_weight "$OCC_READER_HIT_WEIGHT"' \
35
+ '--gamma_sampler "$GAMMA_SAMPLER"' \
36
+ '--rec_beta "$BETA"' \
37
+ '--recursion off'; do
38
+ rg -Fq -- "$literal" "$TRAIN_SCRIPT" || {
39
+ echo "[visual-rsm-protected] pixel launcher contract missing: $literal" >&2
40
+ exit 1
41
+ }
42
+ done
43
+
44
+ SCREEN_ID=${SCREEN_ID:-fair_visual_rsm_protected_v1}
45
+ case "$SCREEN_ID" in
46
+ *[!A-Za-z0-9._-]*|'')
47
+ echo "[visual-rsm-protected] SCREEN_ID contains unsafe characters" >&2
48
+ exit 2
49
+ ;;
50
+ esac
51
+ SEED=${SEED:-0}
52
+ TRAIN_STEPS=${TRAIN_STEPS:-150000}
53
+
54
+ print_cell() {
55
+ local latent_update=$1
56
+ local hit_weight=$2
57
+ local hit_tag=${hit_weight//./p}
58
+ local tag="${SCREEN_ID}_${latent_update}_hit${hit_tag}_s${SEED}"
59
+ local -a command=(
60
+ env
61
+ "TAG=$tag"
62
+ "SEED=$SEED"
63
+ "TRAIN_STEPS=$TRAIN_STEPS"
64
+ "LATENT_UPDATE=$latent_update"
65
+ "ACTOR_AFTER=0"
66
+ "GAMMA=0.99"
67
+ "BETA=0.98"
68
+ "GAMMA_LO=0.50"
69
+ "GAMMA_SAMPLER=protected_endpoints"
70
+ "GAMMA_TASK_FRACTION=0.60"
71
+ "GAMMA_HORIZONS=8,16,32,64"
72
+ "OCC_ACTOR_GOAL_FRACTION=0.50"
73
+ "OCC_READER_METRIC_WEIGHT=0.0"
74
+ "OCC_READER_HIT_WEIGHT=$hit_weight"
75
+ "READER_TAG=indexd4_diagmetric"
76
+ "RDEC_SHA256=9ab338b3940e4c0797b4fc419659d5907f96e745b95a8c57457c85099fdb85a7"
77
+ "OCC_ACTION_NEGATIVE_K=2"
78
+ "OCC_ACTION_NEGATIVE_SIGMA=0.3"
79
+ "WANDB_MODE=disabled"
80
+ bash "$TRAIN_SCRIPT" --dry-run
81
+ )
82
+ printf '[visual-rsm-protected] cell=%s latent_update=%s endpoint_hit_weight=%s command=' \
83
+ "$tag" "$latent_update" "$hit_weight"
84
+ printf ' %q' "${command[@]}"
85
+ printf '\n'
86
+ }
87
+
88
+ print_cell frozen 0.0
89
+ print_cell frozen 0.25
90
+ print_cell joint 0.0
91
+ print_cell joint 0.25
92
+
93
+ echo "[visual-rsm-protected] invariants cells=4 pixels_only=true proprio=false coordinates=false reward_arrays=false td=false bootstrap=false forward_model=false"
94
+ echo "[visual-rsm-protected] occupancy_actor_joint_update=true discount_conditioned=true task_gamma_rows=1229 beta_rows=614 aux_rows=205 aux_sqrt_h_rows=28,40,57,80 actor_goal_rows=1024 value_goal_rows=1024"
95
+ echo "[visual-rsm-protected] dry-run complete no_training=true no_submission=true"
gen_q_rsm/ogbench_genq/experiments/pack_visual_rsm_recursion_continuation.sh ADDED
@@ -0,0 +1,412 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Fail-closed gated continuation for the fair visual Recursive Successor
3
+ # Model (RSM) hidden-state recursion sweep.
4
+ #
5
+ # CELL_FILTER is mandatory. For every explicitly selected manifest cell,
6
+ # GATE_DIR/<cell>.json must be a passing step-50k hidden-h256 gate bound to an
7
+ # immutable *_step50000.pkl checkpoint. New state is written to a distinct
8
+ # continuation checkpoint through step 100k. The default is validation and
9
+ # command printing only; PACK_DRY_RUN=0 or --execute is required to train.
10
+ set -euo pipefail
11
+
12
+ ROOT=$(cd "$(dirname "$0")/../.." && pwd)
13
+ cd "$ROOT"
14
+
15
+ usage() {
16
+ echo "usage: CELL_FILTER=cell[,cell...] GATE_DIR=/abs/gates $0 [--dry-run|--execute]" >&2
17
+ exit 2
18
+ }
19
+
20
+ DRY_RUN=${PACK_DRY_RUN:-1}
21
+ while [ "$#" -gt 0 ]; do
22
+ case "$1" in
23
+ --dry-run) DRY_RUN=1 ;;
24
+ --execute) DRY_RUN=0 ;;
25
+ *) usage ;;
26
+ esac
27
+ shift
28
+ done
29
+ case "$DRY_RUN" in
30
+ 0|1) ;;
31
+ *)
32
+ echo "[visual-rsm-rec-cont] PACK_DRY_RUN must be 0 or 1" >&2
33
+ exit 2
34
+ ;;
35
+ esac
36
+
37
+ MANIFEST=${MANIFEST:-ogbench_genq/experiments/visual_rsm_recursion_sweep_manifest.tsv}
38
+ TRAIN_SCRIPT=ogbench_genq/experiments/train_visual_rsm_occupancy_recursion.sh
39
+ CONTRACT_MODULE=ogbench_genq.genq.visual_recursion_sweep_contract
40
+ CONTRACT_SOURCE=ogbench_genq/genq/visual_recursion_sweep_contract.py
41
+ CF=${CF:-$ROOT}
42
+ REC=${REC:-/proj/inf-scaling/zwhong/projs/gen_q/.claude/worktrees/rsm-visual-recursion}
43
+ PY=${PY:-$REC/.ogbench_venv/bin/python}
44
+ RSM_IMPL=$CF/ogbench_genq/rsm.py
45
+
46
+ for required in "$MANIFEST" "$TRAIN_SCRIPT" "$CONTRACT_SOURCE" "$RSM_IMPL"; do
47
+ [ -r "$required" ] || {
48
+ echo "[visual-rsm-rec-cont] missing required file: $required" >&2
49
+ exit 1
50
+ }
51
+ done
52
+
53
+ require_literal() {
54
+ local literal=$1
55
+ local file=$2
56
+ grep -Fq -- "$literal" "$file" || {
57
+ echo "[visual-rsm-rec-cont] required contract '$literal' absent from $file" >&2
58
+ exit 1
59
+ }
60
+ }
61
+
62
+ require_literal '--resume_ckpt "$RESUME_CKPT"' "$TRAIN_SCRIPT"
63
+ require_literal '--resume_ckpt_sha256 "$RESUME_CKPT_SHA256"' "$TRAIN_SCRIPT"
64
+ require_literal '--drop_proprio' "$TRAIN_SCRIPT"
65
+ require_literal '--latent_update frozen' "$TRAIN_SCRIPT"
66
+ require_literal '--recursion occupancy' "$TRAIN_SCRIPT"
67
+ require_literal 'resolve_checkpoint_load(' "$RSM_IMPL"
68
+ require_literal 'compose = (step > rec_after)' "$RSM_IMPL"
69
+ require_literal 'REC_EVERY = 1' "$RSM_IMPL"
70
+
71
+ PYTHONPATH="$ROOT${PYTHONPATH:+:$PYTHONPATH}" \
72
+ "$PY" -m "$CONTRACT_MODULE" manifest "$MANIFEST" >/dev/null
73
+
74
+ CELL_FILTER=${CELL_FILTER:-}
75
+ [ -n "$CELL_FILTER" ] || {
76
+ echo "[visual-rsm-rec-cont] CELL_FILTER is required; no cell is selected implicitly" >&2
77
+ exit 2
78
+ }
79
+ case "$CELL_FILTER" in
80
+ ,*|*,|*,,*)
81
+ echo "[visual-rsm-rec-cont] CELL_FILTER contains an empty cell name" >&2
82
+ exit 2
83
+ ;;
84
+ esac
85
+
86
+ declare -A REQUESTED=()
87
+ IFS=',' read -r -a REQUESTED_NAMES <<<"$CELL_FILTER"
88
+ for requested in "${REQUESTED_NAMES[@]}"; do
89
+ case "$requested" in
90
+ *[!A-Za-z0-9._-]*|'')
91
+ echo "[visual-rsm-rec-cont] unsafe CELL_FILTER entry: $requested" >&2
92
+ exit 2
93
+ ;;
94
+ esac
95
+ [ -z "${REQUESTED[$requested]+x}" ] || {
96
+ echo "[visual-rsm-rec-cont] duplicate CELL_FILTER entry: $requested" >&2
97
+ exit 2
98
+ }
99
+ REQUESTED[$requested]=1
100
+ done
101
+
102
+ GATE_DIR=${GATE_DIR:-}
103
+ [ -n "$GATE_DIR" ] && [ -d "$GATE_DIR" ] || {
104
+ echo "[visual-rsm-rec-cont] GATE_DIR must name a directory containing <cell>.json gates" >&2
105
+ exit 2
106
+ }
107
+ GATE_DIR=$(cd "$GATE_DIR" && pwd)
108
+
109
+ CALIBRATION_STEPS=50000
110
+ TRAIN_STEPS=${TRAIN_STEPS:-100000}
111
+ [ "$TRAIN_STEPS" = 100000 ] || {
112
+ echo "[visual-rsm-rec-cont] continuation endpoint is fixed at TRAIN_STEPS=100000" >&2
113
+ exit 2
114
+ }
115
+ ARCHIVE_EVERY=${ARCHIVE_EVERY:-25000}
116
+ [ "$ARCHIVE_EVERY" = 25000 ] || {
117
+ echo "[visual-rsm-rec-cont] ARCHIVE_EVERY is fixed at 25000" >&2
118
+ exit 2
119
+ }
120
+
121
+ SCREEN_ID=${SCREEN_ID:-fair_visual_rsm_hidden_gated_cont50k_to100k_v1}
122
+ case "$SCREEN_ID" in
123
+ *[!A-Za-z0-9._-]*|'')
124
+ echo "[visual-rsm-rec-cont] SCREEN_ID contains unsafe characters" >&2
125
+ exit 2
126
+ ;;
127
+ esac
128
+
129
+ RDEC_SAMPLES=${RDEC_SAMPLES:-16}
130
+ WANDB_MODE=${WANDB_MODE:-disabled}
131
+ CELL_MEM_FRACTION=${CELL_MEM_FRACTION:-0.14}
132
+ CKPT_ROOT=${CKPT_ROOT:-ckpt}
133
+ LOG_ROOT=${LOG_ROOT:-bsub_out/visual_rsm_recursion_continuation/${SCREEN_ID}}
134
+
135
+ declare -A FOUND=()
136
+ declare -A SEEN_TAGS=()
137
+ declare -A SEEN_CKPTS=()
138
+ declare -A SEEN_LOGS=()
139
+ PIDS=()
140
+ NAMES=()
141
+ TOTAL=0
142
+ COUNT=0
143
+
144
+ launch_cell() {
145
+ local cell=$1
146
+ local composition=$2
147
+ local gamma=$3
148
+ local beta=$4
149
+ local depth=$5
150
+ local beta_mass=$6
151
+ local gamma_horizons=$7
152
+ local rec_after=$8
153
+
154
+ [ -n "${REQUESTED[$cell]+x}" ] || return 0
155
+ FOUND[$cell]=1
156
+
157
+ local gate_candidate="$GATE_DIR/$cell.json"
158
+ local validation_output
159
+ validation_output=$(
160
+ PYTHONPATH="$ROOT${PYTHONPATH:+:$PYTHONPATH}" \
161
+ "$PY" -m "$CONTRACT_MODULE" continuation \
162
+ --manifest "$MANIFEST" --cell "$cell" --gate "$gate_candidate"
163
+ ) || {
164
+ echo "[visual-rsm-rec-cont] gate validation failed for cell=$cell" >&2
165
+ exit 1
166
+ }
167
+ local -a validated
168
+ mapfile -t validated <<<"$validation_output"
169
+ local -a expected_keys=(
170
+ continuation_gate_pass
171
+ cell
172
+ gate_path
173
+ gate_sha256
174
+ source_checkpoint
175
+ source_checkpoint_sha256
176
+ source_checkpoint_step
177
+ source_seed
178
+ reader_path
179
+ reader_sha256
180
+ )
181
+ [ "${#validated[@]}" -eq "${#expected_keys[@]}" ] || {
182
+ echo "[visual-rsm-rec-cont] malformed validator output for cell=$cell" >&2
183
+ exit 1
184
+ }
185
+ local index key
186
+ for index in "${!expected_keys[@]}"; do
187
+ key=${validated[$index]%%=*}
188
+ [ "$key" = "${expected_keys[$index]}" ] || {
189
+ echo "[visual-rsm-rec-cont] validator field mismatch for cell=$cell: expected=${expected_keys[$index]} actual=$key" >&2
190
+ exit 1
191
+ }
192
+ done
193
+ [ "${validated[0]#*=}" = true ] || {
194
+ echo "[visual-rsm-rec-cont] continuation gate did not pass for cell=$cell" >&2
195
+ exit 1
196
+ }
197
+ [ "${validated[1]#*=}" = "$cell" ] || {
198
+ echo "[visual-rsm-rec-cont] continuation gate returned the wrong cell" >&2
199
+ exit 1
200
+ }
201
+
202
+ local gate_path=${validated[2]#*=}
203
+ local gate_sha256=${validated[3]#*=}
204
+ local source_checkpoint=${validated[4]#*=}
205
+ local source_sha256=${validated[5]#*=}
206
+ local source_step=${validated[6]#*=}
207
+ local seed=${validated[7]#*=}
208
+ local reader_path=${validated[8]#*=}
209
+ local reader_sha256=${validated[9]#*=}
210
+ [ "$source_step" = "$CALIBRATION_STEPS" ] || {
211
+ echo "[visual-rsm-rec-cont] validator returned source_step=$source_step for cell=$cell" >&2
212
+ exit 1
213
+ }
214
+
215
+ if [ -f "$reader_path" ]; then
216
+ local actual_reader_sha256
217
+ actual_reader_sha256=$(sha256sum "$reader_path")
218
+ actual_reader_sha256=${actual_reader_sha256%% *}
219
+ [ "$actual_reader_sha256" = "$reader_sha256" ] || {
220
+ echo "[visual-rsm-rec-cont] reader checksum drift for cell=$cell path=$reader_path" >&2
221
+ exit 1
222
+ }
223
+ elif [ "$DRY_RUN" = 0 ]; then
224
+ echo "[visual-rsm-rec-cont] gated reader is missing for cell=$cell path=$reader_path" >&2
225
+ exit 1
226
+ else
227
+ echo "[visual-rsm-rec-cont] reader artifact preflight deferred in dry-run: $reader_path"
228
+ fi
229
+
230
+ local first_composed_update
231
+ case "$composition" in
232
+ on)
233
+ [ "$rec_after" = "$CALIBRATION_STEPS" ] || {
234
+ echo "[visual-rsm-rec-cont] enabled cell=$cell must use rec_after=$CALIBRATION_STEPS" >&2
235
+ exit 2
236
+ }
237
+ first_composed_update=$((CALIBRATION_STEPS + 1))
238
+ ;;
239
+ off)
240
+ [ "$rec_after" = 1000000000 ] || {
241
+ echo "[visual-rsm-rec-cont] control cell=$cell must keep composition unreachable" >&2
242
+ exit 2
243
+ }
244
+ first_composed_update=none_through_step100000
245
+ ;;
246
+ *)
247
+ echo "[visual-rsm-rec-cont] invalid composition mode for cell=$cell" >&2
248
+ exit 2
249
+ ;;
250
+ esac
251
+
252
+ local tag="${SCREEN_ID}_${cell}_source${CALIBRATION_STEPS}_to${TRAIN_STEPS}_s${seed}"
253
+ local checkpoint="$CKPT_ROOT/rsm_${tag}.pkl"
254
+ local log="$LOG_ROOT/${cell}_source${CALIBRATION_STEPS}_to${TRAIN_STEPS}_s${seed}.log"
255
+ local source_real destination_real
256
+ source_real=$(realpath "$source_checkpoint")
257
+ destination_real=$(realpath -m "$checkpoint")
258
+ [ "$source_real" != "$destination_real" ] || {
259
+ echo "[visual-rsm-rec-cont] source and destination collide for cell=$cell" >&2
260
+ exit 2
261
+ }
262
+ if [ -n "${SEEN_TAGS[$tag]+x}" ] ||
263
+ [ -n "${SEEN_CKPTS[$destination_real]+x}" ] ||
264
+ [ -n "${SEEN_LOGS[$log]+x}" ]; then
265
+ echo "[visual-rsm-rec-cont] duplicate continuation output identity for cell=$cell" >&2
266
+ exit 2
267
+ fi
268
+ SEEN_TAGS[$tag]=1
269
+ SEEN_CKPTS[$destination_real]=1
270
+ SEEN_LOGS[$log]=1
271
+ COUNT=$((COUNT + 1))
272
+
273
+ local -a cmd=(
274
+ env
275
+ "CF=$CF"
276
+ "TAG=$tag"
277
+ "CKPT=$checkpoint"
278
+ "RESUME_CKPT=$source_checkpoint"
279
+ "RESUME_CKPT_SHA256=$source_sha256"
280
+ "PY=$PY"
281
+ "SEED=$seed"
282
+ "TRAIN_STEPS=$TRAIN_STEPS"
283
+ "ARCHIVE_EVERY=$ARCHIVE_EVERY"
284
+ "MODE=ddpgbc_distill"
285
+ "REC_STATE=hidden"
286
+ "READER_DELTA=4"
287
+ "READER_TAG=indexd4_diagmetric"
288
+ "RDEC=$reader_path"
289
+ "RDEC_SHA256=$reader_sha256"
290
+ "RDEC_SAMPLES=$RDEC_SAMPLES"
291
+ "ACTOR_AFTER=0"
292
+ "ALPHA=1.0"
293
+ "EXPECTILE=0.9"
294
+ "DISTILL_ACTOR_GOALS=1"
295
+ "DISTILL_ACTOR_ACTIONS=1"
296
+ "DISTILL_ACTOR_ACTION_K=2"
297
+ "DISTILL_ACTOR_ACTION_SIGMA=0.3"
298
+ "DISTILL_ACTOR_ACTION_PAIRWISE_WEIGHT=1.0"
299
+ "FLOW_STEPS=25"
300
+ "OCC_HIDDEN=512"
301
+ "OCC_LAYERS=4"
302
+ "OCC_ACTION_CONTRAST_WEIGHT=0.5"
303
+ "OCC_ACTION_CONTRAST_MARGIN=0.1"
304
+ "OCC_ACTION_NEGATIVE=actor_local"
305
+ "OCC_ACTION_NEGATIVE_SIGMA=0.3"
306
+ "OCC_ACTION_NEGATIVE_K=2"
307
+ "GAMMA=$gamma"
308
+ "BETA=$beta"
309
+ "REC_DEPTH=$depth"
310
+ "REC_AFTER=$rec_after"
311
+ "REC_GUARD=ema"
312
+ "BETA_SAMPLE_PROB=$beta_mass"
313
+ "GAMMA_SAMPLER=stratified_bins"
314
+ "GAMMA_HORIZONS=$gamma_horizons"
315
+ "GAMMA_LO=0.50"
316
+ "GAMMA_TASK_FRACTION=0.5"
317
+ "WANDB_MODE=$WANDB_MODE"
318
+ "XLA_PYTHON_CLIENT_PREALLOCATE=false"
319
+ "XLA_PYTHON_CLIENT_MEM_FRACTION=$CELL_MEM_FRACTION"
320
+ "OMP_NUM_THREADS=2"
321
+ "OPENBLAS_NUM_THREADS=2"
322
+ "MKL_NUM_THREADS=2"
323
+ bash "$TRAIN_SCRIPT"
324
+ )
325
+
326
+ printf '[visual-rsm-rec-cont] cell=%s composition=%s source_step=%s destination_step=%s first_composed_update=%s tag=%s log=%s\n' \
327
+ "$cell" "$composition" "$source_step" "$TRAIN_STEPS" \
328
+ "$first_composed_update" "$tag" "$log"
329
+ printf '[visual-rsm-rec-cont] provenance cell=%s gate_json=%s gate_sha256=%s source_checkpoint=%s source_sha256=%s reader_sha256=%s\n' \
330
+ "$cell" "$gate_path" "$gate_sha256" "$source_checkpoint" \
331
+ "$source_sha256" "$reader_sha256"
332
+ if [ "$DRY_RUN" = 1 ]; then
333
+ printf '[visual-rsm-rec-cont] command='
334
+ printf ' %q' "${cmd[@]}"
335
+ printf '\n'
336
+ return 0
337
+ fi
338
+
339
+ mkdir -p "$(dirname "$log")" "$(dirname "$checkpoint")"
340
+ {
341
+ printf '\n[visual-rsm-rec-cont] attempt_utc=%s cell=%s phase=gated_recursive_continuation source_step=%s destination_step=%s composition=%s first_composed_update=%s\n' \
342
+ "$(date -u +%Y-%m-%dT%H:%M:%SZ)" "$cell" "$source_step" \
343
+ "$TRAIN_STEPS" "$composition" "$first_composed_update"
344
+ printf '[visual-rsm-rec-cont] gate_json=%s gate_sha256=%s source_checkpoint=%s source_sha256=%s reader_path=%s reader_sha256=%s destination_checkpoint=%s\n' \
345
+ "$gate_path" "$gate_sha256" "$source_checkpoint" "$source_sha256" \
346
+ "$reader_path" "$reader_sha256" "$checkpoint"
347
+ printf '[visual-rsm-rec-cont] command='
348
+ printf ' %q' "${cmd[@]}"
349
+ printf '\n'
350
+ } >>"$log"
351
+ "${cmd[@]}" >>"$log" 2>&1 &
352
+ PIDS+=("$!")
353
+ NAMES+=("$cell")
354
+ }
355
+
356
+ while IFS=$'\t' read -r cell composition gamma beta depth continuation \
357
+ cap_mass beta_mass gamma_horizons rec_after reader_tag reader_sha256 \
358
+ rationale; do
359
+ [ "$cell" = cell ] && continue
360
+ [ -n "$cell" ] || continue
361
+ TOTAL=$((TOTAL + 1))
362
+ launch_cell "$cell" "$composition" "$gamma" "$beta" "$depth" \
363
+ "$beta_mass" "$gamma_horizons" "$rec_after"
364
+ done <"$MANIFEST"
365
+
366
+ [ "$TOTAL" -eq 6 ] || {
367
+ echo "[visual-rsm-rec-cont] manifest must contain exactly six cells; found $TOTAL" >&2
368
+ exit 2
369
+ }
370
+ for requested in "${REQUESTED_NAMES[@]}"; do
371
+ [ -n "${FOUND[$requested]+x}" ] || {
372
+ echo "[visual-rsm-rec-cont] CELL_FILTER names an unknown manifest cell: $requested" >&2
373
+ exit 2
374
+ }
375
+ done
376
+ [ "$COUNT" -eq "${#REQUESTED_NAMES[@]}" ] || {
377
+ echo "[visual-rsm-rec-cont] internal selected-cell count mismatch" >&2
378
+ exit 2
379
+ }
380
+
381
+ echo "[visual-rsm-rec-cont] invariants explicit_cells_only=true all_gates_pass=true immutable_source_step=50000 destination_step=100000 pixels_only=true hidden_future=h256 frozen_encoder=true no_td=true"
382
+ if [ "$DRY_RUN" = 1 ]; then
383
+ echo "[visual-rsm-rec-cont] dry-run complete cells=$COUNT no_training=true no_submission=true"
384
+ exit 0
385
+ fi
386
+
387
+ terminate_children() {
388
+ local pid
389
+ for pid in "${PIDS[@]}"; do
390
+ kill -TERM "$pid" 2>/dev/null || true
391
+ done
392
+ }
393
+ trap terminate_children INT TERM
394
+
395
+ failures=()
396
+ for index in "${!PIDS[@]}"; do
397
+ if wait "${PIDS[$index]}"; then
398
+ echo "[visual-rsm-rec-cont] complete cell=${NAMES[$index]}"
399
+ else
400
+ rc=$?
401
+ failures+=("${NAMES[$index]}:$rc")
402
+ echo "[visual-rsm-rec-cont] failed cell=${NAMES[$index]} rc=$rc" >&2
403
+ fi
404
+ done
405
+
406
+ if [ "${#failures[@]}" -gt 0 ]; then
407
+ printf '[visual-rsm-rec-cont] failed cells:' >&2
408
+ printf ' %s' "${failures[@]}" >&2
409
+ printf '\n' >&2
410
+ exit 1
411
+ fi
412
+ echo "[visual-rsm-rec-cont] complete cells=$COUNT"
gen_q_rsm/ogbench_genq/experiments/pack_visual_rsm_recursion_sweep.sh ADDED
@@ -0,0 +1,353 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Pack the fair visual Recursive Successor Model (RSM) hidden-state one-hop
3
+ # gamma/beta calibration into one GPU allocation.
4
+ #
5
+ # Every cell uses a frozen pixels-only latent, explicit discount-conditioned
6
+ # conditional flow occupancy, index-d4 diagonal reward reader, and the matched
7
+ # supervised DDPG+BC extractor. Occupancy and actor update in the same fused
8
+ # step. There is no temporal-difference/bootstrap target, completion model,
9
+ # proprioception, or simulator coordinate.
10
+ #
11
+ # Usage:
12
+ # bash ogbench_genq/experiments/pack_visual_rsm_recursion_sweep.sh [--dry-run]
13
+ #
14
+ # Every arm is declared with the final occupancy-recursion representation so
15
+ # it models h256 futures and trains exact beta queries, but training stops at
16
+ # step 50k and composition activates only when step > rec_after. Thus this
17
+ # phase contains no recursive targets. Each resulting checkpoint must pass its
18
+ # own hidden-future gate before a separate continuation may resume it.
19
+ #
20
+ # Dry-run mode validates the complete manifest and prints every command without
21
+ # launching training.
22
+ set -euo pipefail
23
+
24
+ ROOT=$(cd "$(dirname "$0")/../.." && pwd)
25
+ cd "$ROOT"
26
+
27
+ usage() {
28
+ echo "usage: $0 [--dry-run]" >&2
29
+ exit 2
30
+ }
31
+
32
+ # The low-level packer is safe by default too. The scheduler wrapper must
33
+ # explicitly set PACK_DRY_RUN=0 inside its allocated GPU job.
34
+ DRY_RUN=${PACK_DRY_RUN:-1}
35
+ while [ "$#" -gt 0 ]; do
36
+ case "$1" in
37
+ --dry-run) DRY_RUN=1 ;;
38
+ *) usage ;;
39
+ esac
40
+ shift
41
+ done
42
+ case "$DRY_RUN" in
43
+ 0|1) ;;
44
+ *) echo "[visual-rsm-rec-sweep] PACK_DRY_RUN must be 0 or 1" >&2; exit 2 ;;
45
+ esac
46
+
47
+ MANIFEST=${MANIFEST:-ogbench_genq/experiments/visual_rsm_recursion_sweep_manifest.tsv}
48
+ TRAIN_SCRIPT=ogbench_genq/experiments/train_visual_rsm_occupancy_recursion.sh
49
+ CONTRACT_MODULE=ogbench_genq.genq.visual_recursion_sweep_contract
50
+ CONTRACT_SOURCE=ogbench_genq/genq/visual_recursion_sweep_contract.py
51
+ CF=${CF:-/proj/inf-scaling/zwhong/projs/gen_q/.claude/worktrees/rsm-visual-coordfree}
52
+ REC=${REC:-/proj/inf-scaling/zwhong/projs/gen_q/.claude/worktrees/rsm-visual-recursion}
53
+ PY=${PY:-$REC/.ogbench_venv/bin/python}
54
+ RSM_IMPL=$CF/ogbench_genq/rsm.py
55
+ BASE=fair_px_gpred_gciql_z8_w003_gciqlret
56
+ READER_TAG=indexd4_diagmetric
57
+ RDEC=${RDEC:-$CF/ckpt/rdec_${BASE}_${READER_TAG}.npz}
58
+ RDEC_SHA256=9ab338b3940e4c0797b4fc419659d5907f96e745b95a8c57457c85099fdb85a7
59
+
60
+ for required in "$MANIFEST" "$TRAIN_SCRIPT" "$CONTRACT_SOURCE" "$RSM_IMPL"; do
61
+ [ -r "$required" ] || {
62
+ echo "[visual-rsm-rec-sweep] missing required file: $required" >&2
63
+ exit 1
64
+ }
65
+ done
66
+
67
+ require_literal() {
68
+ local literal=$1
69
+ local file=$2
70
+ grep -Fq -- "$literal" "$file" || {
71
+ echo "[visual-rsm-rec-sweep] required contract '$literal' absent from $file" >&2
72
+ exit 1
73
+ }
74
+ }
75
+
76
+ # Fail closed if the canonical launcher or implementation no longer encodes
77
+ # the fair post-one-hop method. These checks complement checkpoint metadata.
78
+ require_literal '--drop_proprio' "$TRAIN_SCRIPT"
79
+ require_literal '--latent_update frozen' "$TRAIN_SCRIPT"
80
+ require_literal '--occupancy_model flow' "$TRAIN_SCRIPT"
81
+ require_literal '--actor_after "$ACTOR_AFTER"' "$TRAIN_SCRIPT"
82
+ require_literal '--gamma "$GAMMA"' "$TRAIN_SCRIPT"
83
+ require_literal '--recursion occupancy' "$TRAIN_SCRIPT"
84
+ require_literal '--rec_beta "$BETA"' "$TRAIN_SCRIPT"
85
+ require_literal '--rec_beta_sample_prob "$BETA_SAMPLE_PROB"' "$TRAIN_SCRIPT"
86
+ require_literal '--rec_max_depth "$REC_DEPTH"' "$TRAIN_SCRIPT"
87
+ require_literal 'uses_td_or_bootstrap=False' "$RSM_IMPL"
88
+ require_literal 'occupancy_and_actor_jointly_updated=bool(' "$RSM_IMPL"
89
+ require_literal 'q_weight = (step >= actor_after)' "$RSM_IMPL"
90
+ if grep -Fq -- '--freeze_occupancy' "$TRAIN_SCRIPT"; then
91
+ echo "[visual-rsm-rec-sweep] canonical launcher unexpectedly freezes occupancy" >&2
92
+ exit 1
93
+ fi
94
+
95
+ PYTHONPATH="$ROOT${PYTHONPATH:+:$PYTHONPATH}" \
96
+ "$PY" -m "$CONTRACT_MODULE" manifest "$MANIFEST" || exit $?
97
+
98
+ validate_reader() {
99
+ [ -s "$RDEC" ] || {
100
+ echo "[visual-rsm-rec-sweep] missing diagonal reader: $RDEC" >&2
101
+ return 1
102
+ }
103
+ local actual_sha256
104
+ actual_sha256=$(sha256sum "$RDEC") || return $?
105
+ actual_sha256=${actual_sha256%% *}
106
+ [ "$actual_sha256" = "$RDEC_SHA256" ] || {
107
+ echo "[visual-rsm-rec-sweep] reader checksum mismatch: expected=$RDEC_SHA256 actual=$actual_sha256 path=$RDEC" >&2
108
+ return 1
109
+ }
110
+ PYTHONPATH="$CF${PYTHONPATH:+:$PYTHONPATH}" "$PY" - "$RDEC" <<'PY' || return $?
111
+ import sys
112
+
113
+ from ogbench_genq.genq.reward_reader import load_numpy_reward_reader
114
+
115
+ _, metadata = load_numpy_reward_reader(sys.argv[1])
116
+ expected = {
117
+ "reader_model": "diag_metric",
118
+ "target": "index",
119
+ "index_delta": 4,
120
+ "pixels_only_latents": True,
121
+ "frozen_encoder": True,
122
+ "uses_coordinates_for_training": False,
123
+ "uses_reward_arrays": False,
124
+ "uses_td_or_bootstrap": False,
125
+ }
126
+ errors = [
127
+ f"{key}: expected {value!r}, got {metadata.get(key)!r}"
128
+ for key, value in expected.items()
129
+ if metadata.get(key) != value
130
+ ]
131
+ if errors:
132
+ raise SystemExit(
133
+ "[visual-rsm-rec-sweep] reader contract mismatch:\n "
134
+ + "\n ".join(errors)
135
+ )
136
+ print(
137
+ "[visual-rsm-rec-sweep] reader verified "
138
+ "model=diag_metric target=index index_delta=4 "
139
+ "pixels_only=true non_td=true",
140
+ flush=True,
141
+ )
142
+ PY
143
+ echo "[visual-rsm-rec-sweep] reader sha256=$actual_sha256"
144
+ }
145
+
146
+ if [ -s "$RDEC" ]; then
147
+ validate_reader || exit $?
148
+ elif [ "$DRY_RUN" = 0 ]; then
149
+ validate_reader || exit $?
150
+ else
151
+ echo "[visual-rsm-rec-sweep] reader preflight deferred in dry-run: $RDEC"
152
+ fi
153
+
154
+ SCREEN_ID=${SCREEN_ID:-fair_visual_rsm_hidden_onehop_gb_calib_v1}
155
+ case "$SCREEN_ID" in
156
+ *[!A-Za-z0-9._-]*|'')
157
+ echo "[visual-rsm-rec-sweep] SCREEN_ID contains unsafe characters" >&2
158
+ exit 2
159
+ ;;
160
+ esac
161
+
162
+ SEED=${SEED:-0}
163
+ TRAIN_STEPS=${TRAIN_STEPS:-50000}
164
+ ARCHIVE_EVERY=${ARCHIVE_EVERY:-25000}
165
+ RDEC_SAMPLES=${RDEC_SAMPLES:-16}
166
+ WANDB_MODE=${WANDB_MODE:-disabled}
167
+ CELL_MEM_FRACTION=${CELL_MEM_FRACTION:-0.14}
168
+ CELL_FILTER=${CELL_FILTER:-}
169
+ LOG_ROOT=${LOG_ROOT:-bsub_out/visual_rsm_recursion_sweep/${SCREEN_ID}}
170
+
171
+ [ "$TRAIN_STEPS" = 50000 ] || {
172
+ echo "[visual-rsm-rec-sweep] calibration is fixed at TRAIN_STEPS=50000; recursive continuation has a separate gated phase" >&2
173
+ exit 2
174
+ }
175
+
176
+ is_selected() {
177
+ local cell=$1
178
+ [ -z "$CELL_FILTER" ] && return 0
179
+ case ",$CELL_FILTER," in
180
+ *",$cell,"*) return 0 ;;
181
+ *) return 1 ;;
182
+ esac
183
+ }
184
+
185
+ declare -A SEEN_TAGS=()
186
+ declare -A SEEN_CKPTS=()
187
+ declare -A SEEN_LOGS=()
188
+ PIDS=()
189
+ NAMES=()
190
+ TOTAL=0
191
+ COUNT=0
192
+
193
+ launch_cell() {
194
+ local cell=$1
195
+ local composition=$2
196
+ local gamma=$3
197
+ local beta=$4
198
+ local depth=$5
199
+ local beta_mass=$6
200
+ local gamma_horizons=$7
201
+ local rec_after=$8
202
+
203
+ is_selected "$cell" || return 0
204
+ [ "$rec_after" -ge "$TRAIN_STEPS" ] || {
205
+ echo "[visual-rsm-rec-sweep] refusing $cell: rec_after=$rec_after would compose before the one-hop gate at step $TRAIN_STEPS" >&2
206
+ exit 2
207
+ }
208
+
209
+ local tag="${SCREEN_ID}_${cell}_s${SEED}"
210
+ local ckpt="ckpt/rsm_${tag}.pkl"
211
+ local log="${LOG_ROOT}/${cell}_s${SEED}.log"
212
+ if [ -n "${SEEN_TAGS[$tag]+x}" ] ||
213
+ [ -n "${SEEN_CKPTS[$ckpt]+x}" ] ||
214
+ [ -n "${SEEN_LOGS[$log]+x}" ]; then
215
+ echo "[visual-rsm-rec-sweep] duplicate output identity for cell=$cell" >&2
216
+ exit 2
217
+ fi
218
+ SEEN_TAGS[$tag]=1
219
+ SEEN_CKPTS[$ckpt]=1
220
+ SEEN_LOGS[$log]=1
221
+ COUNT=$((COUNT + 1))
222
+
223
+ local cmd=(
224
+ env
225
+ "TAG=$tag"
226
+ "CKPT=$ckpt"
227
+ "PY=$PY"
228
+ "SEED=$SEED"
229
+ "TRAIN_STEPS=$TRAIN_STEPS"
230
+ "ARCHIVE_EVERY=$ARCHIVE_EVERY"
231
+ "MODE=ddpgbc_distill"
232
+ "REC_STATE=hidden"
233
+ "READER_DELTA=4"
234
+ "READER_TAG=$READER_TAG"
235
+ "RDEC=$RDEC"
236
+ "RDEC_SAMPLES=$RDEC_SAMPLES"
237
+ "ACTOR_AFTER=0"
238
+ "ALPHA=1.0"
239
+ "EXPECTILE=0.9"
240
+ "DISTILL_ACTOR_GOALS=1"
241
+ "DISTILL_ACTOR_ACTIONS=1"
242
+ "DISTILL_ACTOR_ACTION_K=2"
243
+ "DISTILL_ACTOR_ACTION_SIGMA=0.3"
244
+ "DISTILL_ACTOR_ACTION_PAIRWISE_WEIGHT=1.0"
245
+ "FLOW_STEPS=25"
246
+ "OCC_HIDDEN=512"
247
+ "OCC_LAYERS=4"
248
+ "OCC_ACTION_CONTRAST_WEIGHT=0.5"
249
+ "OCC_ACTION_CONTRAST_MARGIN=0.1"
250
+ "OCC_ACTION_NEGATIVE=actor_local"
251
+ "OCC_ACTION_NEGATIVE_SIGMA=0.3"
252
+ "OCC_ACTION_NEGATIVE_K=2"
253
+ "GAMMA=$gamma"
254
+ "BETA=$beta"
255
+ "REC_DEPTH=$depth"
256
+ "REC_AFTER=$rec_after"
257
+ "REC_GUARD=ema"
258
+ "BETA_SAMPLE_PROB=$beta_mass"
259
+ "GAMMA_SAMPLER=stratified_bins"
260
+ "GAMMA_HORIZONS=$gamma_horizons"
261
+ "GAMMA_LO=0.50"
262
+ "GAMMA_TASK_FRACTION=0.5"
263
+ "WANDB_MODE=$WANDB_MODE"
264
+ "XLA_PYTHON_CLIENT_PREALLOCATE=false"
265
+ "XLA_PYTHON_CLIENT_MEM_FRACTION=$CELL_MEM_FRACTION"
266
+ "OMP_NUM_THREADS=2"
267
+ "OPENBLAS_NUM_THREADS=2"
268
+ "MKL_NUM_THREADS=2"
269
+ bash "$TRAIN_SCRIPT"
270
+ )
271
+
272
+ printf '[visual-rsm-rec-sweep] cell=%s composition=%s gamma=%s beta=%s depth=%s beta_mass=%s rec_after=%s tag=%s log=%s\n' \
273
+ "$cell" "$composition" "$gamma" "$beta" "$depth" "$beta_mass" \
274
+ "$rec_after" "$tag" "$log"
275
+ if [ "$DRY_RUN" = 1 ]; then
276
+ printf '[visual-rsm-rec-sweep] command='
277
+ printf ' %q' "${cmd[@]}"
278
+ printf '\n'
279
+ return 0
280
+ fi
281
+
282
+ mkdir -p "$(dirname "$log")" "$(dirname "$ckpt")"
283
+ {
284
+ printf '\n[visual-rsm-rec-sweep] attempt_utc=%s cell=%s tag=%s phase=hidden_onehop_calibration composition_inactive=true\n' \
285
+ "$(date -u +%Y-%m-%dT%H:%M:%SZ)" "$cell" "$tag"
286
+ printf '[visual-rsm-rec-sweep] command='
287
+ printf ' %q' "${cmd[@]}"
288
+ printf '\n'
289
+ } >>"$log"
290
+ "${cmd[@]}" >>"$log" 2>&1 &
291
+ PIDS+=("$!")
292
+ NAMES+=("$cell")
293
+ }
294
+
295
+ while IFS=$'\t' read -r cell composition gamma beta depth continuation \
296
+ cap_mass beta_mass gamma_horizons rec_after reader_tag reader_sha256 \
297
+ rationale; do
298
+ [ "$cell" = cell ] && continue
299
+ [ -n "$cell" ] || continue
300
+ TOTAL=$((TOTAL + 1))
301
+ [ "$reader_tag" = "$READER_TAG" ] || {
302
+ echo "[visual-rsm-rec-sweep] reader tag drift in $cell" >&2
303
+ exit 2
304
+ }
305
+ [ "$reader_sha256" = "$RDEC_SHA256" ] || {
306
+ echo "[visual-rsm-rec-sweep] reader SHA drift in $cell" >&2
307
+ exit 2
308
+ }
309
+ launch_cell "$cell" "$composition" "$gamma" "$beta" "$depth" \
310
+ "$beta_mass" "$gamma_horizons" "$rec_after"
311
+ done <"$MANIFEST"
312
+
313
+ [ "$TOTAL" -eq 6 ] || {
314
+ echo "[visual-rsm-rec-sweep] manifest must contain exactly six cells; found $TOTAL" >&2
315
+ exit 2
316
+ }
317
+ [ "$COUNT" -gt 0 ] || {
318
+ echo "[visual-rsm-rec-sweep] CELL_FILTER selected no cells: $CELL_FILTER" >&2
319
+ exit 2
320
+ }
321
+
322
+ echo "[visual-rsm-rec-sweep] invariants pixels_only=true drop_proprio=true latent_update=frozen non_td=true discount_conditioned=true occupancy_model=flow occupancy_actor_joint_update=true actor_q_start=0 reader=indexd4_diagmetric hidden_future=true composition_inactive_through_step=50000"
323
+ if [ "$DRY_RUN" = 1 ]; then
324
+ echo "[visual-rsm-rec-sweep] dry-run complete cells=$COUNT manifest_cells=$TOTAL"
325
+ exit 0
326
+ fi
327
+
328
+ terminate_children() {
329
+ local pid
330
+ for pid in "${PIDS[@]}"; do
331
+ kill -TERM "$pid" 2>/dev/null || true
332
+ done
333
+ }
334
+ trap terminate_children INT TERM
335
+
336
+ failures=()
337
+ for i in "${!PIDS[@]}"; do
338
+ if wait "${PIDS[$i]}"; then
339
+ echo "[visual-rsm-rec-sweep] complete cell=${NAMES[$i]}"
340
+ else
341
+ rc=$?
342
+ failures+=("${NAMES[$i]}:$rc")
343
+ echo "[visual-rsm-rec-sweep] failed cell=${NAMES[$i]} rc=$rc" >&2
344
+ fi
345
+ done
346
+
347
+ if [ "${#failures[@]}" -gt 0 ]; then
348
+ printf '[visual-rsm-rec-sweep] failed cells:' >&2
349
+ printf ' %s' "${failures[@]}" >&2
350
+ printf '\n' >&2
351
+ exit 1
352
+ fi
353
+ echo "[visual-rsm-rec-sweep] complete cells=$COUNT"
gen_q_rsm/ogbench_genq/experiments/pointmaze-giant-navigate-v0/results/0/rsm_newcov_g995.json ADDED
@@ -0,0 +1,195 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "method": "rsm",
3
+ "readout": "elbo",
4
+ "env": "pointmaze-giant-navigate-v0",
5
+ "seed": 0,
6
+ "alpha": 0.03,
7
+ "gamma": 0.995,
8
+ "recursion": "prob",
9
+ "rec_after": 100000,
10
+ "rec_beta": 0.98,
11
+ "rec_guard": "tails",
12
+ "gamma_spectrum_lo": 0.95,
13
+ "latent": false,
14
+ "success_rate": 0.512,
15
+ "best_sr": 0.52,
16
+ "final_last_step": 0.064,
17
+ "final_best_ckpt": 0.512,
18
+ "best_ckpt_periodic_sr": 0.52,
19
+ "per_task": [
20
+ 0.92,
21
+ 1.0,
22
+ 0.0,
23
+ 0.64,
24
+ 0.0
25
+ ],
26
+ "curve": [
27
+ [
28
+ 25000,
29
+ 0.0
30
+ ],
31
+ [
32
+ 50000,
33
+ 0.2
34
+ ],
35
+ [
36
+ 75000,
37
+ 0.52
38
+ ],
39
+ [
40
+ 100000,
41
+ 0.0
42
+ ],
43
+ [
44
+ 125000,
45
+ 0.0
46
+ ],
47
+ [
48
+ 150000,
49
+ 0.0
50
+ ],
51
+ [
52
+ 175000,
53
+ 0.0
54
+ ],
55
+ [
56
+ 200000,
57
+ 0.0
58
+ ],
59
+ [
60
+ 225000,
61
+ 0.04
62
+ ],
63
+ [
64
+ 250000,
65
+ 0.0
66
+ ],
67
+ [
68
+ 275000,
69
+ 0.0
70
+ ],
71
+ [
72
+ 300000,
73
+ 0.0
74
+ ],
75
+ [
76
+ 325000,
77
+ 0.0
78
+ ],
79
+ [
80
+ 350000,
81
+ 0.08
82
+ ],
83
+ [
84
+ 375000,
85
+ 0.24
86
+ ],
87
+ [
88
+ 400000,
89
+ 0.0
90
+ ],
91
+ [
92
+ 425000,
93
+ 0.10666666666666666
94
+ ],
95
+ [
96
+ 450000,
97
+ 0.12
98
+ ],
99
+ [
100
+ 475000,
101
+ 0.026666666666666665
102
+ ],
103
+ [
104
+ 500000,
105
+ 0.22666666666666666
106
+ ],
107
+ [
108
+ 525000,
109
+ 0.12
110
+ ],
111
+ [
112
+ 550000,
113
+ 0.14666666666666667
114
+ ],
115
+ [
116
+ 575000,
117
+ 0.026666666666666665
118
+ ],
119
+ [
120
+ 600000,
121
+ 0.013333333333333332
122
+ ],
123
+ [
124
+ 625000,
125
+ 0.0
126
+ ],
127
+ [
128
+ 650000,
129
+ 0.013333333333333332
130
+ ],
131
+ [
132
+ 675000,
133
+ 0.0
134
+ ],
135
+ [
136
+ 700000,
137
+ 0.0
138
+ ],
139
+ [
140
+ 725000,
141
+ 0.0
142
+ ],
143
+ [
144
+ 750000,
145
+ 0.0
146
+ ],
147
+ [
148
+ 775000,
149
+ 0.0
150
+ ],
151
+ [
152
+ 800000,
153
+ 0.0
154
+ ],
155
+ [
156
+ 825000,
157
+ 0.04
158
+ ],
159
+ [
160
+ 850000,
161
+ 0.0
162
+ ],
163
+ [
164
+ 875000,
165
+ 0.013333333333333332
166
+ ],
167
+ [
168
+ 900000,
169
+ 0.013333333333333332
170
+ ],
171
+ [
172
+ 925000,
173
+ 0.0
174
+ ],
175
+ [
176
+ 950000,
177
+ 0.0
178
+ ],
179
+ [
180
+ 975000,
181
+ 0.08
182
+ ],
183
+ [
184
+ 1000000,
185
+ 0.05333333333333333
186
+ ],
187
+ [
188
+ 1000000,
189
+ 0.064
190
+ ]
191
+ ],
192
+ "train_steps": 1000000,
193
+ "wall_clock_sec": 23713.0,
194
+ "wandb_url": "https://wandb.ai/improbableai_zwh/gen-q-policy-improvement/runs/6eygxwet"
195
+ }
gen_q_rsm/ogbench_genq/experiments/pointmaze-large-navigate-v0/results/0/rsm_s1.json ADDED
@@ -0,0 +1,194 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "method": "rsm",
3
+ "readout": "elbo",
4
+ "env": "pointmaze-large-navigate-v0",
5
+ "seed": 0,
6
+ "alpha": 0.03,
7
+ "recursion": "prob",
8
+ "rec_after": 100000,
9
+ "rec_beta": 0.98,
10
+ "rec_guard": "tails",
11
+ "gamma_spectrum_lo": 0.95,
12
+ "latent": false,
13
+ "success_rate": 0.33599999999999997,
14
+ "best_sr": 0.4,
15
+ "final_last_step": 0.2,
16
+ "final_best_ckpt": 0.33599999999999997,
17
+ "best_ckpt_periodic_sr": 0.4,
18
+ "per_task": [
19
+ 0.7,
20
+ 0.0,
21
+ 0.98,
22
+ 0.0,
23
+ 0.0
24
+ ],
25
+ "curve": [
26
+ [
27
+ 25000,
28
+ 0.2
29
+ ],
30
+ [
31
+ 50000,
32
+ 0.30666666666666664
33
+ ],
34
+ [
35
+ 75000,
36
+ 0.3466666666666667
37
+ ],
38
+ [
39
+ 100000,
40
+ 0.27999999999999997
41
+ ],
42
+ [
43
+ 125000,
44
+ 0.21333333333333332
45
+ ],
46
+ [
47
+ 150000,
48
+ 0.2
49
+ ],
50
+ [
51
+ 175000,
52
+ 0.2
53
+ ],
54
+ [
55
+ 200000,
56
+ 0.17333333333333334
57
+ ],
58
+ [
59
+ 225000,
60
+ 0.2
61
+ ],
62
+ [
63
+ 250000,
64
+ 0.21333333333333332
65
+ ],
66
+ [
67
+ 275000,
68
+ 0.4
69
+ ],
70
+ [
71
+ 300000,
72
+ 0.04
73
+ ],
74
+ [
75
+ 325000,
76
+ 0.16
77
+ ],
78
+ [
79
+ 350000,
80
+ 0.0
81
+ ],
82
+ [
83
+ 375000,
84
+ 0.2
85
+ ],
86
+ [
87
+ 400000,
88
+ 0.2
89
+ ],
90
+ [
91
+ 425000,
92
+ 0.18666666666666668
93
+ ],
94
+ [
95
+ 450000,
96
+ 0.22666666666666666
97
+ ],
98
+ [
99
+ 475000,
100
+ 0.22666666666666666
101
+ ],
102
+ [
103
+ 500000,
104
+ 0.22666666666666666
105
+ ],
106
+ [
107
+ 525000,
108
+ 0.2
109
+ ],
110
+ [
111
+ 550000,
112
+ 0.26666666666666666
113
+ ],
114
+ [
115
+ 575000,
116
+ 0.4
117
+ ],
118
+ [
119
+ 600000,
120
+ 0.08
121
+ ],
122
+ [
123
+ 625000,
124
+ 0.4
125
+ ],
126
+ [
127
+ 650000,
128
+ 0.12
129
+ ],
130
+ [
131
+ 675000,
132
+ 0.29333333333333333
133
+ ],
134
+ [
135
+ 700000,
136
+ 0.3466666666666667
137
+ ],
138
+ [
139
+ 725000,
140
+ 0.06666666666666667
141
+ ],
142
+ [
143
+ 750000,
144
+ 0.4
145
+ ],
146
+ [
147
+ 775000,
148
+ 0.4
149
+ ],
150
+ [
151
+ 800000,
152
+ 0.4
153
+ ],
154
+ [
155
+ 825000,
156
+ 0.2
157
+ ],
158
+ [
159
+ 850000,
160
+ 0.14666666666666667
161
+ ],
162
+ [
163
+ 875000,
164
+ 0.026666666666666665
165
+ ],
166
+ [
167
+ 900000,
168
+ 0.04
169
+ ],
170
+ [
171
+ 925000,
172
+ 0.09333333333333334
173
+ ],
174
+ [
175
+ 950000,
176
+ 0.27999999999999997
177
+ ],
178
+ [
179
+ 975000,
180
+ 0.29333333333333333
181
+ ],
182
+ [
183
+ 1000000,
184
+ 0.2
185
+ ],
186
+ [
187
+ 1000000,
188
+ 0.2
189
+ ]
190
+ ],
191
+ "train_steps": 1000000,
192
+ "wall_clock_sec": 124911.7,
193
+ "wandb_url": "https://wandb.ai/improbableai_zwh/gen-q-policy-improvement/runs/6aui5pg4"
194
+ }
gen_q_rsm/ogbench_genq/experiments/pointmaze-medium-navigate-v0/figures/suc.png ADDED