rli14 commited on
Commit
ca78610
·
verified ·
1 Parent(s): cc4a1a2

rsm_rise code snapshot (HF_PUSH_ALL) (part 11)

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. rsm_rise/scripts/real/payloads_r42/rung_cov_sn1_knn0p03_T20.sh +4 -0
  2. rsm_rise/scripts/real/payloads_r42/rung_cov_sn1_knn0p03_T25.sh +4 -0
  3. rsm_rise/scripts/real/payloads_r42/rung_cov_sn1_knn0p03_T30.sh +4 -0
  4. rsm_rise/scripts/real/payloads_r42/rung_cov_sn1_knn0p03_T40.sh +4 -0
  5. rsm_rise/scripts/real/payloads_r42/rung_cov_sn1_knn0p03_T60.sh +4 -0
  6. rsm_rise/scripts/real/payloads_r42/rung_cov_sn1_knn0p03_T80.sh +4 -0
  7. rsm_rise/scripts/real/payloads_r43/rep_1.sh +7 -0
  8. rsm_rise/scripts/real/payloads_r43/rep_2.sh +7 -0
  9. rsm_rise/scripts/real/payloads_r43/rep_3.sh +7 -0
  10. rsm_rise/scripts/real/payloads_r43/rep_4.sh +7 -0
  11. rsm_rise/scripts/real/payloads_r45/rung_T10.sh +9 -0
  12. rsm_rise/scripts/real/payloads_r45/rung_T15.sh +9 -0
  13. rsm_rise/scripts/real/payloads_r45/rung_T20.sh +9 -0
  14. rsm_rise/scripts/real/payloads_r45/rung_T25.sh +9 -0
  15. rsm_rise/scripts/real/payloads_r45/rung_T30.sh +9 -0
  16. rsm_rise/scripts/real/payloads_r45/rung_T40.sh +9 -0
  17. rsm_rise/scripts/real/payloads_r45/rung_T60.sh +9 -0
  18. rsm_rise/scripts/real/payloads_r45/rung_T80.sh +9 -0
  19. rsm_rise/scripts/real/payloads_r46/rung_F105.sh +10 -0
  20. rsm_rise/scripts/real/payloads_r46/rung_F110.sh +10 -0
  21. rsm_rise/scripts/real/payloads_r46/rung_F115.sh +10 -0
  22. rsm_rise/scripts/real/payloads_r46/rung_F120.sh +10 -0
  23. rsm_rise/scripts/real/payloads_r46/rung_F125.sh +10 -0
  24. rsm_rise/scripts/real/payloads_r46/rung_F130.sh +10 -0
  25. rsm_rise/scripts/real/payloads_r46/rung_F140.sh +10 -0
  26. rsm_rise/scripts/real/payloads_r46/rung_T10.sh +10 -0
  27. rsm_rise/scripts/real/pi05_200k_prep.sh +92 -0
  28. rsm_rise/scripts/real/pi05_200k_pytest.sh +3 -0
  29. rsm_rise/scripts/real/pi05_200k_rebuild_patch.sh +107 -0
  30. rsm_rise/scripts/real/pi05_action_stats.sh +13 -0
  31. rsm_rise/scripts/real/pi05_candidates.py +0 -0
  32. rsm_rise/scripts/real/pi05_corner_watch.sh +23 -0
  33. rsm_rise/scripts/real/pi05_curve_audit.py +90 -0
  34. rsm_rise/scripts/real/pi05_export_keepers.sh +32 -0
  35. rsm_rise/scripts/real/pi05_export_keepers_cpu.sh +10 -0
  36. rsm_rise/scripts/real/pi05_ft50_chunk10_table.py +90 -0
  37. rsm_rise/scripts/real/pi05_ft50_converse_ladder.sh +202 -0
  38. rsm_rise/scripts/real/pi05_ft50_gap_table.py +76 -0
  39. rsm_rise/scripts/real/pi05_ft50_horizon_probe.py +174 -0
  40. rsm_rise/scripts/real/pi05_ft50_hprobe.sh +158 -0
  41. rsm_rise/scripts/real/pi05_ft50_keepperiod_fallback.sh +42 -0
  42. rsm_rise/scripts/real/pi05_ft50_launch.sh +42 -0
  43. rsm_rise/scripts/real/pi05_ft50_pin_early.sh +102 -0
  44. rsm_rise/scripts/real/pi05_ft50_pr12.sh +12 -0
  45. rsm_rise/scripts/real/pi05_ft50_pr13.sh +31 -0
  46. rsm_rise/scripts/real/pi05_ft50_pytest.sh +4 -0
  47. rsm_rise/scripts/real/pi05_ft50_rebuild_patch.sh +129 -0
  48. rsm_rise/scripts/real/pi05_ft50_reclaim_killed.sh +34 -0
  49. rsm_rise/scripts/real/pi05_ft50_renumber_docs.py +83 -0
  50. rsm_rise/scripts/real/pi05_ft50_screen.sh +307 -0
rsm_rise/scripts/real/payloads_r42/rung_cov_sn1_knn0p03_T20.sh ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -uo pipefail
3
+ export PT_NOISE_SCALE=2.0 PT_NAME=cov_sn1_knn0p03_T20
4
+ exec /proj/dmfexp/zwhong/rsm_rise/scripts/real/pt_temp_screen.sh 0 1
rsm_rise/scripts/real/payloads_r42/rung_cov_sn1_knn0p03_T25.sh ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -uo pipefail
3
+ export PT_NOISE_SCALE=2.5 PT_NAME=cov_sn1_knn0p03_T25
4
+ exec /proj/dmfexp/zwhong/rsm_rise/scripts/real/pt_temp_screen.sh 0 1
rsm_rise/scripts/real/payloads_r42/rung_cov_sn1_knn0p03_T30.sh ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -uo pipefail
3
+ export PT_NOISE_SCALE=3.0 PT_NAME=cov_sn1_knn0p03_T30
4
+ exec /proj/dmfexp/zwhong/rsm_rise/scripts/real/pt_temp_screen.sh 0 1
rsm_rise/scripts/real/payloads_r42/rung_cov_sn1_knn0p03_T40.sh ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -uo pipefail
3
+ export PT_NOISE_SCALE=4.0 PT_NAME=cov_sn1_knn0p03_T40
4
+ exec /proj/dmfexp/zwhong/rsm_rise/scripts/real/pt_temp_screen.sh 0 1
rsm_rise/scripts/real/payloads_r42/rung_cov_sn1_knn0p03_T60.sh ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -uo pipefail
3
+ export PT_NOISE_SCALE=6.0 PT_NAME=cov_sn1_knn0p03_T60
4
+ exec /proj/dmfexp/zwhong/rsm_rise/scripts/real/pt_temp_screen.sh 0 1
rsm_rise/scripts/real/payloads_r42/rung_cov_sn1_knn0p03_T80.sh ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -uo pipefail
3
+ export PT_NOISE_SCALE=8.0 PT_NAME=cov_sn1_knn0p03_T80
4
+ exec /proj/dmfexp/zwhong/rsm_rise/scripts/real/pt_temp_screen.sh 0 1
rsm_rise/scripts/real/payloads_r43/rep_1.sh ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # PROPOSAL_TEST run 43 -- replicate 1 of the scale-1.0 rung, for the DETERMINISM FLOOR measurement
3
+ # pre-registered in gen_q#280 5822858562 / rsm_real#2 5822859924. Identical config and seed to
4
+ # pt_cov_sn1_knn0p03; only PT_NAME differs, so the four replicates are the same nominal computation.
5
+ set -uo pipefail
6
+ export PT_NOISE_SCALE=1.0 PT_NAME=cov_sn1_knn0p03_REP1
7
+ exec /proj/dmfexp/zwhong/rsm_rise/scripts/real/pt_temp_screen.sh 2 8
rsm_rise/scripts/real/payloads_r43/rep_2.sh ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # PROPOSAL_TEST run 43 -- replicate 2 of the scale-1.0 rung, for the DETERMINISM FLOOR measurement
3
+ # pre-registered in gen_q#280 5822858562 / rsm_real#2 5822859924. Identical config and seed to
4
+ # pt_cov_sn1_knn0p03; only PT_NAME differs, so the four replicates are the same nominal computation.
5
+ set -uo pipefail
6
+ export PT_NOISE_SCALE=1.0 PT_NAME=cov_sn1_knn0p03_REP2
7
+ exec /proj/dmfexp/zwhong/rsm_rise/scripts/real/pt_temp_screen.sh 2 8
rsm_rise/scripts/real/payloads_r43/rep_3.sh ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # PROPOSAL_TEST run 43 -- replicate 3 of the scale-1.0 rung, for the DETERMINISM FLOOR measurement
3
+ # pre-registered in gen_q#280 5822858562 / rsm_real#2 5822859924. Identical config and seed to
4
+ # pt_cov_sn1_knn0p03; only PT_NAME differs, so the four replicates are the same nominal computation.
5
+ set -uo pipefail
6
+ export PT_NOISE_SCALE=1.0 PT_NAME=cov_sn1_knn0p03_REP3
7
+ exec /proj/dmfexp/zwhong/rsm_rise/scripts/real/pt_temp_screen.sh 2 8
rsm_rise/scripts/real/payloads_r43/rep_4.sh ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # PROPOSAL_TEST run 43 -- replicate 4 of the scale-1.0 rung, for the DETERMINISM FLOOR measurement
3
+ # pre-registered in gen_q#280 5822858562 / rsm_real#2 5822859924. Identical config and seed to
4
+ # pt_cov_sn1_knn0p03; only PT_NAME differs, so the four replicates are the same nominal computation.
5
+ set -uo pipefail
6
+ export PT_NOISE_SCALE=1.0 PT_NAME=cov_sn1_knn0p03_REP4
7
+ exec /proj/dmfexp/zwhong/rsm_rise/scripts/real/pt_temp_screen.sh 2 8
rsm_rise/scripts/real/payloads_r45/rung_T10.sh ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # PROPOSAL_TEST run 45 -- CORRECTED noise-scale ladder rung (scale 1.0).
3
+ # The run-42 ladder was INERT: proposal_test.py:274 overwrote pol.rng per episode and destroyed the
4
+ # _ScaledNormal wrapper, so all 8 rungs sampled one setting (displacement spread 0.0234 mm over 8x).
5
+ # pt_proposer_temp.py now installs the scale via an rng PROPERTY that survives that reseed
6
+ # (regression-tested, LSF 1907558). NEW tag prefix R45 so the inert caches cannot be mistaken for these.
7
+ set -uo pipefail
8
+ export PT_NOISE_SCALE=1.0 PT_NAME=R45_cov_sn1_knn0p03_T10
9
+ exec /proj/dmfexp/zwhong/rsm_rise/scripts/real/pt_temp_screen.sh 0 1
rsm_rise/scripts/real/payloads_r45/rung_T15.sh ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # PROPOSAL_TEST run 45 -- CORRECTED noise-scale ladder rung (scale 1.5).
3
+ # The run-42 ladder was INERT: proposal_test.py:274 overwrote pol.rng per episode and destroyed the
4
+ # _ScaledNormal wrapper, so all 8 rungs sampled one setting (displacement spread 0.0234 mm over 8x).
5
+ # pt_proposer_temp.py now installs the scale via an rng PROPERTY that survives that reseed
6
+ # (regression-tested, LSF 1907558). NEW tag prefix R45 so the inert caches cannot be mistaken for these.
7
+ set -uo pipefail
8
+ export PT_NOISE_SCALE=1.5 PT_NAME=R45_cov_sn1_knn0p03_T15
9
+ exec /proj/dmfexp/zwhong/rsm_rise/scripts/real/pt_temp_screen.sh 0 1
rsm_rise/scripts/real/payloads_r45/rung_T20.sh ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # PROPOSAL_TEST run 45 -- CORRECTED noise-scale ladder rung (scale 2.0).
3
+ # The run-42 ladder was INERT: proposal_test.py:274 overwrote pol.rng per episode and destroyed the
4
+ # _ScaledNormal wrapper, so all 8 rungs sampled one setting (displacement spread 0.0234 mm over 8x).
5
+ # pt_proposer_temp.py now installs the scale via an rng PROPERTY that survives that reseed
6
+ # (regression-tested, LSF 1907558). NEW tag prefix R45 so the inert caches cannot be mistaken for these.
7
+ set -uo pipefail
8
+ export PT_NOISE_SCALE=2.0 PT_NAME=R45_cov_sn1_knn0p03_T20
9
+ exec /proj/dmfexp/zwhong/rsm_rise/scripts/real/pt_temp_screen.sh 0 1
rsm_rise/scripts/real/payloads_r45/rung_T25.sh ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # PROPOSAL_TEST run 45 -- CORRECTED noise-scale ladder rung (scale 2.5).
3
+ # The run-42 ladder was INERT: proposal_test.py:274 overwrote pol.rng per episode and destroyed the
4
+ # _ScaledNormal wrapper, so all 8 rungs sampled one setting (displacement spread 0.0234 mm over 8x).
5
+ # pt_proposer_temp.py now installs the scale via an rng PROPERTY that survives that reseed
6
+ # (regression-tested, LSF 1907558). NEW tag prefix R45 so the inert caches cannot be mistaken for these.
7
+ set -uo pipefail
8
+ export PT_NOISE_SCALE=2.5 PT_NAME=R45_cov_sn1_knn0p03_T25
9
+ exec /proj/dmfexp/zwhong/rsm_rise/scripts/real/pt_temp_screen.sh 0 1
rsm_rise/scripts/real/payloads_r45/rung_T30.sh ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # PROPOSAL_TEST run 45 -- CORRECTED noise-scale ladder rung (scale 3.0).
3
+ # The run-42 ladder was INERT: proposal_test.py:274 overwrote pol.rng per episode and destroyed the
4
+ # _ScaledNormal wrapper, so all 8 rungs sampled one setting (displacement spread 0.0234 mm over 8x).
5
+ # pt_proposer_temp.py now installs the scale via an rng PROPERTY that survives that reseed
6
+ # (regression-tested, LSF 1907558). NEW tag prefix R45 so the inert caches cannot be mistaken for these.
7
+ set -uo pipefail
8
+ export PT_NOISE_SCALE=3.0 PT_NAME=R45_cov_sn1_knn0p03_T30
9
+ exec /proj/dmfexp/zwhong/rsm_rise/scripts/real/pt_temp_screen.sh 0 1
rsm_rise/scripts/real/payloads_r45/rung_T40.sh ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # PROPOSAL_TEST run 45 -- CORRECTED noise-scale ladder rung (scale 4.0).
3
+ # The run-42 ladder was INERT: proposal_test.py:274 overwrote pol.rng per episode and destroyed the
4
+ # _ScaledNormal wrapper, so all 8 rungs sampled one setting (displacement spread 0.0234 mm over 8x).
5
+ # pt_proposer_temp.py now installs the scale via an rng PROPERTY that survives that reseed
6
+ # (regression-tested, LSF 1907558). NEW tag prefix R45 so the inert caches cannot be mistaken for these.
7
+ set -uo pipefail
8
+ export PT_NOISE_SCALE=4.0 PT_NAME=R45_cov_sn1_knn0p03_T40
9
+ exec /proj/dmfexp/zwhong/rsm_rise/scripts/real/pt_temp_screen.sh 0 1
rsm_rise/scripts/real/payloads_r45/rung_T60.sh ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # PROPOSAL_TEST run 45 -- CORRECTED noise-scale ladder rung (scale 6.0).
3
+ # The run-42 ladder was INERT: proposal_test.py:274 overwrote pol.rng per episode and destroyed the
4
+ # _ScaledNormal wrapper, so all 8 rungs sampled one setting (displacement spread 0.0234 mm over 8x).
5
+ # pt_proposer_temp.py now installs the scale via an rng PROPERTY that survives that reseed
6
+ # (regression-tested, LSF 1907558). NEW tag prefix R45 so the inert caches cannot be mistaken for these.
7
+ set -uo pipefail
8
+ export PT_NOISE_SCALE=6.0 PT_NAME=R45_cov_sn1_knn0p03_T60
9
+ exec /proj/dmfexp/zwhong/rsm_rise/scripts/real/pt_temp_screen.sh 0 1
rsm_rise/scripts/real/payloads_r45/rung_T80.sh ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # PROPOSAL_TEST run 45 -- CORRECTED noise-scale ladder rung (scale 8.0).
3
+ # The run-42 ladder was INERT: proposal_test.py:274 overwrote pol.rng per episode and destroyed the
4
+ # _ScaledNormal wrapper, so all 8 rungs sampled one setting (displacement spread 0.0234 mm over 8x).
5
+ # pt_proposer_temp.py now installs the scale via an rng PROPERTY that survives that reseed
6
+ # (regression-tested, LSF 1907558). NEW tag prefix R45 so the inert caches cannot be mistaken for these.
7
+ set -uo pipefail
8
+ export PT_NOISE_SCALE=8.0 PT_NAME=R45_cov_sn1_knn0p03_T80
9
+ exec /proj/dmfexp/zwhong/rsm_rise/scripts/real/pt_temp_screen.sh 0 1
rsm_rise/scripts/real/payloads_r46/rung_F105.sh ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # PROPOSAL_TEST run 46 -- FINE noise-scale ladder rung (scale 1.05), inside the cliff.
3
+ # Run 46b measured the coarse ladder as a CLIFF: K_real jumps 1.00 -> 7.43 between scale 1.0 and 1.5 and
4
+ # saturates, while median candidate displacement goes 7.63 mm -> 95.82 mm, 3.0x past the pre-registered
5
+ # 32.2 mm PLAUSIBILITY DISQUALIFIER. Every rung >= 1.5 is disqualified, so the only open question is
6
+ # whether a plausible foothold exists BETWEEN 1.0 and 1.5. ONE CHANGE from run 45: the scale grid.
7
+ # Pre-registered gen_q#280 5825155807 / rsm_real#2 5825156755 before submission.
8
+ set -uo pipefail
9
+ export PT_NOISE_SCALE=1.05 PT_NAME=R46_cov_sn1_knn0p03_F105
10
+ exec /proj/dmfexp/zwhong/rsm_rise/scripts/real/pt_temp_screen.sh 0 1
rsm_rise/scripts/real/payloads_r46/rung_F110.sh ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # PROPOSAL_TEST run 46 -- FINE noise-scale ladder rung (scale 1.10), inside the cliff.
3
+ # Run 46b measured the coarse ladder as a CLIFF: K_real jumps 1.00 -> 7.43 between scale 1.0 and 1.5 and
4
+ # saturates, while median candidate displacement goes 7.63 mm -> 95.82 mm, 3.0x past the pre-registered
5
+ # 32.2 mm PLAUSIBILITY DISQUALIFIER. Every rung >= 1.5 is disqualified, so the only open question is
6
+ # whether a plausible foothold exists BETWEEN 1.0 and 1.5. ONE CHANGE from run 45: the scale grid.
7
+ # Pre-registered gen_q#280 5825155807 / rsm_real#2 5825156755 before submission.
8
+ set -uo pipefail
9
+ export PT_NOISE_SCALE=1.10 PT_NAME=R46_cov_sn1_knn0p03_F110
10
+ exec /proj/dmfexp/zwhong/rsm_rise/scripts/real/pt_temp_screen.sh 0 1
rsm_rise/scripts/real/payloads_r46/rung_F115.sh ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # PROPOSAL_TEST run 46 -- FINE noise-scale ladder rung (scale 1.15), inside the cliff.
3
+ # Run 46b measured the coarse ladder as a CLIFF: K_real jumps 1.00 -> 7.43 between scale 1.0 and 1.5 and
4
+ # saturates, while median candidate displacement goes 7.63 mm -> 95.82 mm, 3.0x past the pre-registered
5
+ # 32.2 mm PLAUSIBILITY DISQUALIFIER. Every rung >= 1.5 is disqualified, so the only open question is
6
+ # whether a plausible foothold exists BETWEEN 1.0 and 1.5. ONE CHANGE from run 45: the scale grid.
7
+ # Pre-registered gen_q#280 5825155807 / rsm_real#2 5825156755 before submission.
8
+ set -uo pipefail
9
+ export PT_NOISE_SCALE=1.15 PT_NAME=R46_cov_sn1_knn0p03_F115
10
+ exec /proj/dmfexp/zwhong/rsm_rise/scripts/real/pt_temp_screen.sh 0 1
rsm_rise/scripts/real/payloads_r46/rung_F120.sh ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # PROPOSAL_TEST run 46 -- FINE noise-scale ladder rung (scale 1.20), inside the cliff.
3
+ # Run 46b measured the coarse ladder as a CLIFF: K_real jumps 1.00 -> 7.43 between scale 1.0 and 1.5 and
4
+ # saturates, while median candidate displacement goes 7.63 mm -> 95.82 mm, 3.0x past the pre-registered
5
+ # 32.2 mm PLAUSIBILITY DISQUALIFIER. Every rung >= 1.5 is disqualified, so the only open question is
6
+ # whether a plausible foothold exists BETWEEN 1.0 and 1.5. ONE CHANGE from run 45: the scale grid.
7
+ # Pre-registered gen_q#280 5825155807 / rsm_real#2 5825156755 before submission.
8
+ set -uo pipefail
9
+ export PT_NOISE_SCALE=1.20 PT_NAME=R46_cov_sn1_knn0p03_F120
10
+ exec /proj/dmfexp/zwhong/rsm_rise/scripts/real/pt_temp_screen.sh 0 1
rsm_rise/scripts/real/payloads_r46/rung_F125.sh ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # PROPOSAL_TEST run 46 -- FINE noise-scale ladder rung (scale 1.25), inside the cliff.
3
+ # Run 46b measured the coarse ladder as a CLIFF: K_real jumps 1.00 -> 7.43 between scale 1.0 and 1.5 and
4
+ # saturates, while median candidate displacement goes 7.63 mm -> 95.82 mm, 3.0x past the pre-registered
5
+ # 32.2 mm PLAUSIBILITY DISQUALIFIER. Every rung >= 1.5 is disqualified, so the only open question is
6
+ # whether a plausible foothold exists BETWEEN 1.0 and 1.5. ONE CHANGE from run 45: the scale grid.
7
+ # Pre-registered gen_q#280 5825155807 / rsm_real#2 5825156755 before submission.
8
+ set -uo pipefail
9
+ export PT_NOISE_SCALE=1.25 PT_NAME=R46_cov_sn1_knn0p03_F125
10
+ exec /proj/dmfexp/zwhong/rsm_rise/scripts/real/pt_temp_screen.sh 0 1
rsm_rise/scripts/real/payloads_r46/rung_F130.sh ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # PROPOSAL_TEST run 46 -- FINE noise-scale ladder rung (scale 1.30), inside the cliff.
3
+ # Run 46b measured the coarse ladder as a CLIFF: K_real jumps 1.00 -> 7.43 between scale 1.0 and 1.5 and
4
+ # saturates, while median candidate displacement goes 7.63 mm -> 95.82 mm, 3.0x past the pre-registered
5
+ # 32.2 mm PLAUSIBILITY DISQUALIFIER. Every rung >= 1.5 is disqualified, so the only open question is
6
+ # whether a plausible foothold exists BETWEEN 1.0 and 1.5. ONE CHANGE from run 45: the scale grid.
7
+ # Pre-registered gen_q#280 5825155807 / rsm_real#2 5825156755 before submission.
8
+ set -uo pipefail
9
+ export PT_NOISE_SCALE=1.30 PT_NAME=R46_cov_sn1_knn0p03_F130
10
+ exec /proj/dmfexp/zwhong/rsm_rise/scripts/real/pt_temp_screen.sh 0 1
rsm_rise/scripts/real/payloads_r46/rung_F140.sh ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # PROPOSAL_TEST run 46 -- FINE noise-scale ladder rung (scale 1.40), inside the cliff.
3
+ # Run 46b measured the coarse ladder as a CLIFF: K_real jumps 1.00 -> 7.43 between scale 1.0 and 1.5 and
4
+ # saturates, while median candidate displacement goes 7.63 mm -> 95.82 mm, 3.0x past the pre-registered
5
+ # 32.2 mm PLAUSIBILITY DISQUALIFIER. Every rung >= 1.5 is disqualified, so the only open question is
6
+ # whether a plausible foothold exists BETWEEN 1.0 and 1.5. ONE CHANGE from run 45: the scale grid.
7
+ # Pre-registered gen_q#280 5825155807 / rsm_real#2 5825156755 before submission.
8
+ set -uo pipefail
9
+ export PT_NOISE_SCALE=1.40 PT_NAME=R46_cov_sn1_knn0p03_F140
10
+ exec /proj/dmfexp/zwhong/rsm_rise/scripts/real/pt_temp_screen.sh 0 1
rsm_rise/scripts/real/payloads_r46/rung_T10.sh ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # PROPOSAL_TEST run 46 -- FINE noise-scale ladder rung (scale 1.00), inside the cliff.
3
+ # Run 46b measured the coarse ladder as a CLIFF: K_real jumps 1.00 -> 7.43 between scale 1.0 and 1.5 and
4
+ # saturates, while median candidate displacement goes 7.63 mm -> 95.82 mm, 3.0x past the pre-registered
5
+ # 32.2 mm PLAUSIBILITY DISQUALIFIER. Every rung >= 1.5 is disqualified, so the only open question is
6
+ # whether a plausible foothold exists BETWEEN 1.0 and 1.5. ONE CHANGE from run 45: the scale grid.
7
+ # Pre-registered gen_q#280 5825155807 / rsm_real#2 5825156755 before submission.
8
+ set -uo pipefail
9
+ export PT_NOISE_SCALE=1.00 PT_NAME=R46_cov_sn1_knn0p03_T10
10
+ exec /proj/dmfexp/zwhong/rsm_rise/scripts/real/pt_temp_screen.sh 0 1
rsm_rise/scripts/real/pi05_200k_prep.sh ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # One-shot prep for the PI05_200K stream (owner 2026-09-25: run the five 30k cooking fine-tunes to 200k).
3
+ # Idempotent: re-running it is safe and skips anything already done.
4
+ # 1. symlink runs/openpi/assets/<cfg>_200k -> <cfg> (assets_dirs = assets_base_dir/<config.name>)
5
+ # 2. seed runs/openpi/checkpoints/<cfg>_200k/<exp>_200k/29999 as HARDLINKS of the parent 29999
6
+ # (42 GB each; the fs is at 100%. orbax never rewrites a step dir in place, and when it rmtree's the
7
+ # copy after the first new save the parent's inodes survive.)
8
+ # 3. pre-create the fresh W&B run for each continuation (name <exp>_200k, config note resumed_from=...)
9
+ # and write its id to <new ckpt dir>/wandb_id.txt -- scripts/train.py:init_wandb(resuming=True) does
10
+ # wandb.init(id=<that>, resume="must") and passes neither name nor config, so it must exist already.
11
+ # 4. print the resolved _200k TrainConfigs and the LR the new cosine gives at the resume step.
12
+ set -uo pipefail
13
+ ROOT=/proj/dmfexp/zwhong/rsm_rise
14
+ CK=$ROOT/runs/openpi/checkpoints
15
+ AS=$ROOT/runs/openpi/assets
16
+ source $ROOT/wandb_env.sh
17
+ export HF_HUB_OFFLINE=1 TOKENIZERS_PARALLELISM=false PYTHONUNBUFFERED=1
18
+ export JAX_PLATFORMS=cpu # login-free CPU node: do not try to grab a GPU
19
+ export OPENPI_DATA_HOME=$ROOT/.openpi_assets HF_LEROBOT_HOME=$ROOT/data/real/lerobot_home
20
+ PY=$ROOT/third_party/openpi/.venv/bin/python
21
+
22
+ PAIRS="pi05_cooking_stock:stock_s0 pi05_cooking_stock:stock_s1 pi05_cooking_rise:rise_s0 pi05_cooking_rise:rise_s1 pi05_cooking_riseadv:riseadv_s0"
23
+
24
+ echo "[prep] ==== 1. assets symlinks ===="
25
+ for cfg in pi05_cooking_stock pi05_cooking_rise pi05_cooking_riseadv; do
26
+ if [ -e "$AS/${cfg}_200k" ]; then echo " exists: $AS/${cfg}_200k"; else
27
+ ln -s "$cfg" "$AS/${cfg}_200k" && echo " linked: ${cfg}_200k -> $cfg"; fi
28
+ done
29
+
30
+ echo "[prep] ==== 2. hardlink-seed the new exp dirs from 29999 ===="
31
+ for p in $PAIRS; do
32
+ cfg=${p%%:*}; exp=${p##*:}
33
+ src=$CK/$cfg/$exp/29999
34
+ dst=$CK/${cfg}_200k/${exp}_200k
35
+ if [ ! -d "$src" ]; then echo " MISSING PARENT $src"; continue; fi
36
+ if [ -d "$dst/29999" ]; then echo " exists: $dst/29999"; continue; fi
37
+ mkdir -p "$dst"
38
+ cp -al "$src" "$dst/29999" || { echo " HARDLINK FAILED for $src"; continue; }
39
+ echo " seeded: $dst/29999 (files=$(find "$dst/29999" | wc -l))"
40
+ done
41
+ echo "[prep] parent 29999 dirs still intact:"
42
+ for p in $PAIRS; do cfg=${p%%:*}; exp=${p##*:}; echo " $(ls -d $CK/$cfg/$exp/29999) params=$(ls $CK/$cfg/$exp/29999/params | wc -l)"; done
43
+
44
+ echo "[prep] ==== 3. pre-create fresh W&B runs ===="
45
+ $PY - <<'PYEOF'
46
+ import os, pathlib, wandb
47
+ CK = pathlib.Path("/proj/dmfexp/zwhong/rsm_rise/runs/openpi/checkpoints")
48
+ PAIRS = [("pi05_cooking_stock","stock_s0"),("pi05_cooking_stock","stock_s1"),
49
+ ("pi05_cooking_rise","rise_s0"),("pi05_cooking_rise","rise_s1"),
50
+ ("pi05_cooking_riseadv","riseadv_s0")]
51
+ for cfg, exp in PAIRS:
52
+ d = CK / f"{cfg}_200k" / f"{exp}_200k"
53
+ idf = d / "wandb_id.txt"
54
+ if idf.exists():
55
+ print(f"[wandb] exists {d.name}: {idf.read_text().strip()}", flush=True); continue
56
+ d.mkdir(parents=True, exist_ok=True)
57
+ parent_id = (CK / cfg / exp / "wandb_id.txt").read_text().strip()
58
+ run = wandb.init(
59
+ project="rsm_rise", entity="richardrl", name=f"{exp}_200k",
60
+ config={"resumed_from": f"{cfg}/{exp}/29999",
61
+ "resumed_from_wandb_id": parent_id,
62
+ "train_config": f"{cfg}_200k",
63
+ "num_train_steps": 200_000, "keep_period": 50_000, "save_interval": 500,
64
+ "lr_schedule": "cosine warmup=1000 peak=5e-5 decay_steps=200000 floor=5e-6 "
65
+ "(warm restart from the 30k floor; no re-warmup)",
66
+ "devices": "8x H100 data parallel (fsdp_devices=1), global batch 32 = 4/GPU"},
67
+ notes=f"200k continuation of {cfg}/{exp} (stopped at 29999). Parent W&B run {parent_id}.",
68
+ tags=["pi05_cooking", "200k_continuation"],
69
+ )
70
+ idf.write_text(run.id)
71
+ print(f"[wandb] created {exp}_200k id={run.id} url={run.url}", flush=True)
72
+ run.finish()
73
+ PYEOF
74
+
75
+ echo "[prep] ==== 4. resolved _200k configs + LR check ===="
76
+ cd $ROOT/third_party/openpi
77
+ $PY - <<'PYEOF'
78
+ import jax, numpy as np
79
+ from openpi.training import config as _c
80
+ for name in ("pi05_cooking_stock_200k","pi05_cooking_rise_200k","pi05_cooking_riseadv_200k"):
81
+ cfg = _c.get_config(name)
82
+ s = cfg.lr_schedule
83
+ print(f"--- {name}: steps={cfg.num_train_steps} keep_period={cfg.keep_period} save_interval={cfg.save_interval} "
84
+ f"batch={cfg.batch_size} workers={cfg.num_workers} fsdp={cfg.fsdp_devices} ema={cfg.ema_decay} "
85
+ f"enc_lr_scale={cfg.encoder_lr_scale} img_aug={cfg.image_aug}")
86
+ print(f" lr_schedule={s}")
87
+ print(f" assets_dirs={cfg.assets_dirs} exists={cfg.assets_dirs.exists()}")
88
+ sch = s.create()
89
+ for st in (0, 1000, 29999, 30000, 30500, 100000, 199999):
90
+ print(f" lr(step={st:>6}) = {float(sch(st)):.6e}")
91
+ PYEOF
92
+ echo "[prep] done rc=$?"
rsm_rise/scripts/real/pi05_200k_pytest.sh ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ cd /proj/dmfexp/zwhong/scratch_pi05_200k/rsm_real_scaffold
3
+ /proj/dmfexp/zwhong/rsm_rise/third_party/openpi/.venv/bin/python -m pytest tests/test_rise_stack_openpi_patch_numbers.py -q 2>&1 | tail -25
rsm_rise/scripts/real/pi05_200k_rebuild_patch.sh ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # Rebuild rsm_real's vendored openpi patch so it also carries the three `pi05_cooking_*_200k`
3
+ # TrainConfigs (PI05_200K stream, owner 2026-09-25), WITHOUT dragging in anything else.
4
+ #
5
+ # Why not just `git diff` the rsm_rise openpi tree: the shipped patch is NOT that diff. It carries the
6
+ # rsm_real#5 inference-split fix (`episodes_required_from`, the `split_json` missing-file fallback) that was
7
+ # never back-ported into rsm_rise, and the rsm_rise tree carries run-54 factorial configs the patch has never
8
+ # shipped. Regenerating wholesale would silently revert the first and publish the second. So: replay the
9
+ # SHIPPED patch onto pristine upstream, apply ONLY the _200k block on top, and re-diff.
10
+ set -euo pipefail
11
+ ROOT=/proj/dmfexp/zwhong/rsm_rise
12
+ WT=${1:-/proj/dmfexp/zwhong/scratch_pi05_200k/rsm_real_scaffold}
13
+ PATCH=$WT/rise_stack/openpi/rise_on_pi05.patch
14
+ PIN=$(head -1 $WT/rise_stack/openpi/UPSTREAM_COMMIT.txt)
15
+ WORK=/proj/dmfexp/zwhong/scratch_pi05_200k/openpi_rebuild
16
+ rm -rf $WORK; mkdir -p $WORK/up
17
+ echo "[rebuild] pin=$PIN"
18
+ cd $ROOT/third_party/openpi && git archive "$PIN" | tar -x -C $WORK/up
19
+ cd $WORK/up
20
+ git init -q && git add -A && git -c user.email=rr@local -c user.name=rr commit -qm "upstream $PIN"
21
+ echo "[rebuild] ---- git apply --check of the SHIPPED patch onto pristine $PIN ----"
22
+ git apply --check "$PATCH" && echo "[rebuild] SHIPPED PATCH APPLIES CLEAN"
23
+ git apply "$PATCH"
24
+
25
+ echo "[rebuild] ---- insert the _200k block ----"
26
+ python3 - "$ROOT" <<'PY'
27
+ import sys, pathlib
28
+ root = pathlib.Path(sys.argv[1])
29
+ # take the block verbatim from the live rsm_rise config.py so the two can never drift
30
+ live = (root / "third_party/openpi/src/openpi/training/config.py").read_text()
31
+ start = live.index("# ---- rsm_rise (#263 follow-up, owner 2026-09-25): 200k continuations")
32
+ end = live.index("if len({config.name for config in _CONFIGS}) != len(_CONFIGS):", start)
33
+ block = live[start:end]
34
+ p = pathlib.Path("src/openpi/training/config.py")
35
+ src = p.read_text()
36
+ anchor = "if len({config.name for config in _CONFIGS}) != len(_CONFIGS):"
37
+ assert src.count(anchor) == 1, src.count(anchor)
38
+ assert "_cooking_200k" not in src
39
+ p.write_text(src.replace(anchor, block + anchor))
40
+ print(f"[rebuild] inserted {len(block)} chars / {block.count(chr(10))} lines")
41
+ PY
42
+
43
+ git add -A
44
+ git diff --cached HEAD > $WORK/rise_on_pi05.patch
45
+ echo "[rebuild] new patch: $(wc -l < $WORK/rise_on_pi05.patch) lines"
46
+
47
+ echo "[rebuild] ---- verify the NEW patch applies clean to pristine upstream ----"
48
+ rm -rf $WORK/verify; mkdir -p $WORK/verify
49
+ cd $ROOT/third_party/openpi && git archive "$PIN" | tar -x -C $WORK/verify
50
+ cd $WORK/verify && git init -q && git add -A && git -c user.email=rr@local -c user.name=rr commit -qm base
51
+ git apply --check $WORK/rise_on_pi05.patch && echo "[rebuild] NEW PATCH APPLIES CLEAN"
52
+ git apply $WORK/rise_on_pi05.patch
53
+ $ROOT/third_party/openpi/.venv/bin/python -c "import ast;ast.parse(open('src/openpi/training/config.py').read());print('[rebuild] patched config.py parses')"
54
+
55
+ echo "[rebuild] ---- diff-of-diffs: shipped vs new (should be ONLY the _200k block + line/hash shifts) ----"
56
+ { diff "$PATCH" $WORK/rise_on_pi05.patch || true; } | grep -E "^[<>]" | grep -vE "^[<>] (index |@@ )" | head -60 || true
57
+ { diff "$PATCH" $WORK/rise_on_pi05.patch || true; } | grep -E "^<" | grep -vE "^< (index |@@ )" > $WORK/removed.txt || true
58
+ echo "[rebuild] non-_200k content deltas (lines the new patch DROPS, must be 0): $(wc -l < $WORK/removed.txt)"
59
+ head -20 $WORK/removed.txt
60
+ test "$(wc -l < $WORK/removed.txt)" -eq 0
61
+
62
+ echo "[rebuild] ---- install into the worktree and re-number the docs ----"
63
+ cp $WORK/rise_on_pi05.patch "$PATCH"
64
+ cd $WT
65
+ export WT
66
+ python3 - <<'PY'
67
+ import os, re, pathlib
68
+ REPO = pathlib.Path(os.environ["WT"])
69
+ patch = (REPO/"rise_stack/openpi/rise_on_pi05.patch").read_text()
70
+ stat, path, in_hunk, ins, dele = {}, None, False, 0, 0
71
+ for line in patch.splitlines():
72
+ m = re.match(r"^diff --git a/(\S+) b/(\S+)$", line)
73
+ if m:
74
+ if path is not None: stat[path] = (ins, dele)
75
+ path, in_hunk, ins, dele = m.group(2), False, 0, 0; continue
76
+ if path is None: continue
77
+ if line.startswith("@@"): in_hunk = True; continue
78
+ if not in_hunk: continue
79
+ if line.startswith("+"): ins += 1
80
+ elif line.startswith("-"): dele += 1
81
+ if path is not None: stat[path] = (ins, dele)
82
+ tot_i, tot_d, nf = sum(i for i,_ in stat.values()), sum(d for _,d in stat.values()), len(stat)
83
+ print("[renumber] numstat:", {k: v for k, v in sorted(stat.items())})
84
+ print(f"[renumber] totals: {nf} files, +{tot_i} / -{tot_d}")
85
+
86
+ def commas(n): return f"{n:,}"
87
+ # README per-file table rows
88
+ rp = REPO/"rise_stack/openpi/README.md"; r = rp.read_text()
89
+ for p_, (i_, d_) in stat.items():
90
+ cell = f"+{commas(i_)}" + (f" / -{commas(d_)}" if d_ else "")
91
+ r, n = re.subn(rf"(^\|\s*`{re.escape(p_)}`\s*\|)[^|]*(\|)", lambda m: m.group(1)+f" {cell} "+m.group(2), r, flags=re.M)
92
+ assert n == 1, (p_, n)
93
+ # README totals row
94
+ r, n = re.subn(r"\|\s*\*\*\d+ files?, total\*\*\s*\|\s*\*\*\+[\d,]+\s*/\s*-[\d,]+\*\*",
95
+ f"| **{nf} files, total** | **+{commas(tot_i)} / -{commas(tot_d)}**", r); assert n == 1, n
96
+ # README headline
97
+ r, n = re.subn(r"\d+ files, [\d,]+ insertions and \d+ deletions",
98
+ f"{nf} files, {commas(tot_i)} insertions and {tot_d} deletions", r); assert n == 1, n
99
+ rp.write_text(r)
100
+ # SETUP.md headline
101
+ sp = REPO/"SETUP.md"; s = sp.read_text()
102
+ s, n = re.subn(r"\d+\s+files and [\d,]+ inserted lines", f"{nf} files and {commas(tot_i)} inserted lines", s)
103
+ assert n == 1, n
104
+ sp.write_text(s)
105
+ print("[renumber] README.md + SETUP.md updated")
106
+ PY
107
+ echo "[rebuild] done"
rsm_rise/scripts/real/pi05_action_stats.sh ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # CPU job: PI05_NORM deliverables 4 + 5 -- the action-target unit test over the whole split + the stats table.
3
+ # env: PI05_NORM_CONFIGS (default pi05_cooking_stock,pi05_cooking_rise), PI05_NORM_SPLITS, PI05_NORM_MAX_FRAMES
4
+ set -uo pipefail
5
+ ROOT=/proj/dmfexp/zwhong/rsm_rise
6
+ export JAX_PLATFORMS=cpu OPENPI_DATA_HOME=$ROOT/.openpi_assets HF_LEROBOT_HOME=$ROOT/data/real/lerobot_home
7
+ export HF_HUB_OFFLINE=1 PYTHONUNBUFFERED=1 TOKENIZERS_PARALLELISM=false
8
+ cd $ROOT/third_party/openpi
9
+ echo "[pi05_action_stats] host=$(hostname) job=${LSB_JOBID:-none} configs=${PI05_NORM_CONFIGS:-default} \
10
+ splits=${PI05_NORM_SPLITS:-default} max_frames=${PI05_NORM_MAX_FRAMES:-all} $(date -u)"
11
+ $ROOT/third_party/openpi/.venv/bin/python -m pytest -q -s -p no:cacheprovider \
12
+ $ROOT/tests/test_pi05_action_targets.py "$@"
13
+ rc=$?; echo "[pi05_action_stats] pytest exit=$rc $(date -u)"; exit $rc
rsm_rise/scripts/real/pi05_candidates.py ADDED
File without changes
rsm_rise/scripts/real/pi05_corner_watch.sh ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # gen_q #269 -- submit the planning screen for the last sweep corner (sn 1.0 / knn 0.05, LSF 1856693) the moment
3
+ # its 9999 checkpoint lands, instead of waiting for the next worker run. pi05_screen_sweep.sh is idempotent and
4
+ # carries its own duplicate guards, so calling it on a timer is safe. Exits once the screen is queued (or after
5
+ # MAXH hours).
6
+ set -uo pipefail
7
+ ROOT=/proj/dmfexp/zwhong/rsm_rise
8
+ CK=$ROOT/runs/openpi/checkpoints/pi05_cooking_sn1_knn0p05/ws_s0/9999
9
+ MAXH=${MAXH:-5}
10
+ deadline=$(( $(date +%s) + MAXH*3600 ))
11
+ while [ "$(date +%s)" -lt "$deadline" ]; do
12
+ if [ -d "$CK" ]; then
13
+ echo "[corner-watch] $(date -u +%H:%M:%SZ) checkpoint exists -> pi05_screen_sweep.sh 0"
14
+ "$ROOT/scripts/real/pi05_screen_sweep.sh" 0
15
+ if bjobs -o "job_name stat" -noheader 2>/dev/null | grep -qE "^rr_pi05scr_pi05sn1_knn0p05_ws9999 "; then
16
+ echo "[corner-watch] screen queued; exiting"; exit 0
17
+ fi
18
+ else
19
+ echo "[corner-watch] $(date -u +%H:%M:%SZ) waiting (last step $(ls -d ${CK%/9999}/[0-9]* 2>/dev/null | sed 's|.*/||' | sort -n | tail -1))"
20
+ fi
21
+ sleep 300
22
+ done
23
+ echo "[corner-watch] deadline reached without queueing a screen"
rsm_rise/scripts/real/pi05_curve_audit.py ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+ """PI05_NORM deliverable 1: per-run val/train curve audit for every pi0.5 cooking run.
3
+
4
+ Reads runs/openpi/checkpoints/<cfg>/<exp>/eval_history.jsonl (one json per eval: {'val':{...},'train_eval':{...},'step':n})
5
+ and reports, per metric: min step / min value / final value / the train_eval value at the same steps.
6
+ Pure json reading, no compute.
7
+ """
8
+ import json, pathlib, sys
9
+
10
+ ROOT = pathlib.Path("/proj/dmfexp/zwhong/rsm_rise")
11
+ CKPT = ROOT / "runs/openpi/checkpoints"
12
+ METRICS = ["loss", "mse_all10", "mse_x", "mse_y", "mse_z", "mse_r0", "mse_r1", "mse_r2", "mse_r3", "mse_r4",
13
+ "mse_r5", "mse_grip", "xyz_l2_first_cm", "xyz_l2_chunk_cm", "rot6d_l2_first", "grip_abs_first_mm",
14
+ "grip_bin_acc"]
15
+
16
+ def load(p):
17
+ rows = []
18
+ for ln in p.read_text().splitlines():
19
+ ln = ln.strip()
20
+ if not ln:
21
+ continue
22
+ try:
23
+ rows.append(json.loads(ln))
24
+ except json.JSONDecodeError:
25
+ pass
26
+ rows.sort(key=lambda r: r.get("step", -1))
27
+ # de-duplicate steps (resumes re-log): keep the last occurrence
28
+ out = {}
29
+ for r in rows:
30
+ out[r.get("step")] = r
31
+ return [out[k] for k in sorted(out)]
32
+
33
+ def main():
34
+ result = {}
35
+ for p in sorted(CKPT.glob("*/*/eval_history.jsonl")):
36
+ cfg, exp = p.parent.parent.name, p.parent.name
37
+ rows = load(p)
38
+ if not rows:
39
+ continue
40
+ steps = [r["step"] for r in rows]
41
+ run = {"config": cfg, "exp": exp, "n_evals": len(rows), "first_step": steps[0], "last_step": steps[-1],
42
+ "steps": steps, "metrics": {}}
43
+ for m in METRICS:
44
+ v = [(r["step"], r["val"].get(m), r.get("train_eval", {}).get(m)) for r in rows if m in r.get("val", {})]
45
+ if not v:
46
+ continue
47
+ better = max if m.endswith("_acc") else min
48
+ # ignore step 0 (untrained) for the "best" search but keep it in the series
49
+ cand = [t for t in v if t[0] > 0] or v
50
+ best = better(cand, key=lambda t: t[1])
51
+ run["metrics"][m] = {
52
+ "best_step": best[0], "best_val": best[1], "train_at_best": best[2],
53
+ "final_step": v[-1][0], "final_val": v[-1][1], "train_at_final": v[-1][2],
54
+ "step0_val": v[0][1] if v[0][0] == 0 else None,
55
+ "series": [[t[0], t[1], t[2]] for t in v],
56
+ }
57
+ result[f"{cfg}/{exp}"] = run
58
+ out = ROOT / "status/real/pi05_curve_audit.json"
59
+ out.write_text(json.dumps(result, indent=1))
60
+ # markdown summary on val loss + key mse
61
+ print(f"wrote {out}\n")
62
+ hdr = ("| run | evals | steps | val loss @best | best step | train@best | val loss final | "
63
+ "train@final | gap final | val/train ratio final |")
64
+ print(hdr); print("|" + "---|" * 10)
65
+ for k, r in result.items():
66
+ m = r["metrics"].get("loss")
67
+ if not m:
68
+ continue
69
+ gap = m["final_val"] - (m["train_at_final"] or float("nan"))
70
+ ratio = m["final_val"] / m["train_at_final"] if m["train_at_final"] else float("nan")
71
+ print(f"| {k} | {r['n_evals']} | {r['first_step']}-{r['last_step']} | {m['best_val']:.5f} | "
72
+ f"{m['best_step']} | {m['train_at_best']:.5f} | {m['final_val']:.5f} | {m['train_at_final']:.5f} | "
73
+ f"{gap:+.5f} | {ratio:.2f} |")
74
+ print("\n\n### per-dim val mse: best step / best / final (train at final in parens)\n")
75
+ dims = ["mse_all10", "mse_x", "mse_y", "mse_z", "mse_r0", "mse_r1", "mse_r2", "mse_r3", "mse_r4", "mse_r5", "mse_grip"]
76
+ for k, r in result.items():
77
+ if not r["metrics"]:
78
+ continue
79
+ print(f"\n**{k}** (evals {r['n_evals']}, steps {r['first_step']}-{r['last_step']})\n")
80
+ print("| metric | best step | best val | final val | train @final | final/best |")
81
+ print("|---|---|---|---|---|---|")
82
+ for d in dims + ["xyz_l2_first_cm", "rot6d_l2_first", "grip_abs_first_mm", "grip_bin_acc"]:
83
+ m = r["metrics"].get(d)
84
+ if not m:
85
+ continue
86
+ rr = m["final_val"] / m["best_val"] if m["best_val"] else float("nan")
87
+ print(f"| {d} | {m['best_step']} | {m['best_val']:.6g} | {m['final_val']:.6g} | "
88
+ f"{(m['train_at_final'] if m['train_at_final'] is not None else float('nan')):.6g} | {rr:.3f} |")
89
+
90
+ main()
rsm_rise/scripts/real/pi05_export_keepers.sh ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # gen_q #269 -- params-only export of the pi0.5 RISE actors the PLANNING SCREEN keeps.
3
+ # Keep criterion (the owner's, step 4'): spread UP and oracle error DOWN vs stock, or a scorer below its
4
+ # permuted control. On the 10-episode screen (status/real/openloop_pi05*_e10/scorer_openloop.json) rise s0,
5
+ # rise s1 and riseadv s0 all pass on the first clause.
6
+ # The export hardlinks params/ + assets/ (no extra disk -- /proj/dmfexp is at 100%) and drops train_state.
7
+ set -uo pipefail
8
+ ROOT=/proj/dmfexp/zwhong/rsm_rise
9
+ CK=$ROOT/runs/openpi/checkpoints
10
+ EX=$ROOT/runs/openpi/export
11
+ # The list is a superset: a cell whose checkpoint does not exist yet is SKIPped, and a cell already exported is
12
+ # reported as "have" -- so this script is idempotent and can be called after every sweep cell lands (run 8).
13
+ # The sn x knn sweep cells are 10k-step WARM STARTS off pi05_cooking_rise/rise_s0/29999, hence ws_s0/9999;
14
+ # the destination names match PI05_DIRS in scripts/real/hf_upload.py one for one.
15
+ CELLS_DEFAULT="pi05_cooking_rise:$CK/pi05_cooking_rise/rise_s0/29999:$EX/pi05_rise_s0_29999
16
+ pi05_cooking_rise:$CK/pi05_cooking_rise/rise_s1/29999:$EX/pi05_rise_s1_29999
17
+ pi05_cooking_riseadv:$CK/pi05_cooking_riseadv/riseadv_s0/29999:$EX/pi05_riseadv_s0_29999
18
+ pi05_cooking_risebn:$CK/pi05_cooking_risebn/risebn_s0/29999:$EX/pi05_risebn_s0_29999"
19
+ for c in wsctrl sn0p3_knn0p01 sn0p1_knn0p03 sn0p3_knn0p03 sn0p03_knn0p01 sn0p1_knn0p05 sn1_knn0p03 sn1_knn0p05 ; do
20
+ CELLS_DEFAULT="$CELLS_DEFAULT
21
+ pi05_cooking_$c:$CK/pi05_cooking_$c/ws_s0/9999:$EX/pi05_${c}_s0_ws9999"
22
+ done
23
+ for cell in ${CELLS:-$CELLS_DEFAULT} ; do
24
+ cfg=${cell%%:*}; rest=${cell#*:}; src=${rest%%:*}; dst=${rest#*:}
25
+ [ -d "$src" ] || { echo "[keepers] SKIP missing $src"; continue; }
26
+ [ -e "$dst/_CHECKPOINT_METADATA" ] && { echo "[keepers] have $dst"; continue; }
27
+ echo "=== [keepers] $cfg $src -> $dst"
28
+ $ROOT/scripts/real/openpi_export.sh $ROOT/scripts/real/openpi_export_params.py "$src" "$dst" --config "$cfg" \
29
+ || echo "[keepers] FAILED $dst"
30
+ done
31
+ echo "[keepers] done $(date -u)"
32
+ du -sh $EX/* 2>/dev/null
rsm_rise/scripts/real/pi05_export_keepers_cpu.sh ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # gen_q #269 -- CPU-only wrapper around pi05_export_keepers.sh.
3
+ # Why: the export itself is a hardlink pass (params/ + assets/, train_state dropped) and the verify step is ONE
4
+ # pi0.5 forward pass, so it needs no GPU -- and the GPU submission (1842203) starved in `normal` behind
5
+ # "ngpus_physical not satisfied: 132 hosts" while the whole HF upload chain waited on it.
6
+ # JAX_PLATFORMS=cpu keeps the jax cuda plugin from erroring on a job with no visible device.
7
+ set -uo pipefail
8
+ export JAX_PLATFORMS=cpu
9
+ export XLA_FLAGS="--xla_force_host_platform_device_count=1"
10
+ exec /proj/dmfexp/zwhong/rsm_rise/scripts/real/pi05_export_keepers.sh "$@"
rsm_rise/scripts/real/pi05_ft50_chunk10_table.py ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """PI05_FT req 6: build the CHUNK-10-COMPARABLE held-out table for the seven chunk-50 fine-tunes.
3
+
4
+ Why this script exists. The stdout `EVAL` one-liner prints `xyz_chunk` over the config's FULL horizon, so a
5
+ chunk-50 run's 2.3 cm and a chunk-10 parent's 1.2 cm are not the same measurement. train.py emits
6
+ `*_chunk10_*` (the first-10 prefix) whenever horizon > 10 -- that is the metric the two generations share.
7
+ Everything here is read from `eval_history.jsonl` in each checkpoint dir; no compute, no GPU, no W&B.
8
+
9
+ Selection metric per the brief: held-out `xyz_l2_first_cm` and the `*_chunk10_*` family -- NOT the
10
+ flow-matching loss (it rises from overfitting while the action error plateaus).
11
+ """
12
+ import json, os, sys, statistics
13
+
14
+ ROOT = "/proj/dmfexp/zwhong/rsm_rise"
15
+ # (label, ft50 config, ft50 exp, parent config, parent exp)
16
+ CELLS = [
17
+ ("stock_s0", "pi05_cooking_stock_ft50_s0", "stock_s0_ft50", "pi05_cooking_stock", "stock_s0"),
18
+ ("stock_s1", "pi05_cooking_stock_ft50_s1", "stock_s1_ft50", "pi05_cooking_stock", "stock_s1"),
19
+ ("rise_s0", "pi05_cooking_rise_ft50_s0", "rise_s0_ft50", "pi05_cooking_rise", "rise_s0"),
20
+ ("rise_s1", "pi05_cooking_rise_ft50_s1", "rise_s1_ft50", "pi05_cooking_rise", "rise_s1"),
21
+ ("riseadv_s0", "pi05_cooking_riseadv_ft50_s0", "riseadv_s0_ft50", "pi05_cooking_riseadv", "riseadv_s0"),
22
+ ("sn1_knn0p03", "pi05_cooking_sn1_knn0p03_ft50_s0", "sn1_knn0p03_ft50", "pi05_cooking_sn1_knn0p03", "ws_s0"),
23
+ ("sn0p1_knn0p03", "pi05_cooking_sn0p1_knn0p03_ft50_s0","sn0p1_knn0p03_ft50", "pi05_cooking_sn0p1_knn0p03","ws_s0"),
24
+ ]
25
+ CONTROL = ("stock_s0_h50 (from-base control)", "pi05_cooking_stock_h50", "stock_s0_h50", None, None)
26
+
27
+
28
+ def hist(cfg, exp):
29
+ p = f"{ROOT}/runs/openpi/checkpoints/{cfg}/{exp}/eval_history.jsonl"
30
+ if not os.path.exists(p):
31
+ return None
32
+ return [json.loads(l) for l in open(p) if l.strip()]
33
+
34
+
35
+ def at(H, step):
36
+ for h in H:
37
+ if h["step"] == step:
38
+ return h["val"]
39
+ return None
40
+
41
+
42
+ def tail(H, key, n=3):
43
+ """Mean of the last n evals -- the per-eval scatter on a fixed seeded val subset is ~0.01-0.02 cm, so a
44
+ single point must not be read as a trend."""
45
+ vals = [h["val"][key] for h in H[-n:] if key in h["val"]]
46
+ return statistics.fmean(vals) if vals else float("nan")
47
+
48
+
49
+ def best(H, key):
50
+ vals = [(h["val"][key], h["step"]) for h in H if key in h["val"]]
51
+ return min(vals) if vals else (float("nan"), -1)
52
+
53
+
54
+ def main():
55
+ out = []
56
+ out.append("| model | parent chunk10 (final) | ft50 chunk10 @ step0 | ft50 chunk10 now (mean last 3) | step | recovered | ft50 first | ft50 chunk50 |")
57
+ out.append("|---|---|---|---|---|---|---|---|")
58
+ for label, cfg, exp, pcfg, pexp in CELLS + [CONTROL]:
59
+ H = hist(cfg, exp)
60
+ if not H:
61
+ out.append(f"| {label} | -- | MISSING eval_history.jsonl | | | | | |")
62
+ continue
63
+ step = H[-1]["step"]
64
+ c10_now = tail(H, "xyz_l2_chunk10_cm")
65
+ v0 = at(H, 0) or {}
66
+ c10_0 = v0.get("xyz_l2_chunk10_cm", float("nan"))
67
+ first_now = tail(H, "xyz_l2_first_cm")
68
+ c50_now = tail(H, "xyz_l2_chunk_cm")
69
+ if pcfg:
70
+ PH = hist(pcfg, pexp)
71
+ # the parent ran at horizon 10, so its own xyz_l2_chunk_cm IS the first-10 mean
72
+ p10 = PH[-1]["val"]["xyz_l2_chunk_cm"] if PH else float("nan")
73
+ gap0 = c10_0 - p10
74
+ rec = (gap0 - (c10_now - p10)) / gap0 * 100.0 if gap0 and gap0 == gap0 and abs(gap0) > 1e-9 else float("nan")
75
+ out.append(f"| `{label}` | {p10:.3f} | {c10_0:.3f} (+{gap0:.3f}) | **{c10_now:.3f}** | {step} | {rec:+.0f}% | {first_now:.3f} | {c50_now:.3f} |")
76
+ else:
77
+ out.append(f"| `{label}` | n/a (from base) | {c10_0:.3f} | **{c10_now:.3f}** | {step} | n/a | {first_now:.3f} | {c50_now:.3f} |")
78
+ print("\n".join(out))
79
+ print()
80
+ print("Columns. `parent chunk10 (final)` = the chunk-10 parent's own held-out `xyz_l2_chunk_cm` at its last")
81
+ print("eval (horizon 10, so it IS the first-10 mean). `ft50 chunk10 @ step0` = the same prefix measured on")
82
+ print("the IDENTICAL warm-started weights but denoised jointly over 50 tokens -- the gap in brackets is the")
83
+ print("pure cost of the horizon change, with no training in between. `recovered` = how much of that gap the")
84
+ print("fine-tune has clawed back so far (negative = currently further from the parent than at step 0, i.e. it")
85
+ print("is spending first-10 accuracy on the new 40-frame tail). `ft50 chunk50` is the full 1 s chunk and has")
86
+ print("NO chunk-10 counterpart by construction.")
87
+
88
+
89
+ if __name__ == "__main__":
90
+ main()
rsm_rise/scripts/real/pi05_ft50_converse_ladder.sh ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # rsm_real#14 / worker PI05_FT run 30 -- THE CONVERSE TEST (point prediction) + THE ALPHA LADDER.
3
+ #
4
+ # WHERE THIS COMES FROM. Run 28 measured that `oracle` (the planning CEILING) gets WORSE with more
5
+ # training and concluded "ship an early checkpoint for the planning deployment". Run 29 showed the
6
+ # degradation is PURE CANDIDATE-CLOUD NARROWING (headroom H = greedy-oracle tracks the candidate spread,
7
+ # rho in [1.015,1.070] on the last arm in 8/8 cells; E = H/spread has CV 7.7 % across 24 (cell,step)
8
+ # points) and launched the WIDENING test (LSF 1921943): re-screen 150k with --cand-shrink = each cell's
9
+ # own S(50k)/S(150k).
10
+ #
11
+ # Widening is a DIRECTIONAL test -- "oracle should get better". Almost any monotone story predicts that.
12
+ # The mechanism makes a much sharper claim, and this script tests it:
13
+ #
14
+ # (A) THE CONVERSE, WHICH IS A POINT PREDICTION. If the ONLY thing 100k extra steps did to planning is
15
+ # narrow the cloud by a factor r, then NARROWING THE EARLY CLOUD BY EXACTLY r MUST REPRODUCE THE
16
+ # LATE ORACLE -- not "be worse", but land ON it. So screen step 50000 with alpha = 1/r =
17
+ # S(150k)/S(50k) and compare oracle(50k, 1/r) against the ALREADY-MEASURED oracle(150k, 1.0).
18
+ # This can fail in a way widening cannot: if oracle(50k, 1/r) stays clearly BETTER than
19
+ # oracle(150k, 1.0), then the late checkpoint really did lose planning quality on top of losing
20
+ # width, and run 28's recommendation partly stands. A point prediction that survives is worth
21
+ # more than four directional ones, and one that dies kills the mechanism cleanly.
22
+ # It also runs in the SHRINKING direction, where candidates move TOWARD the cloud centroid and so
23
+ # stay on the action manifold -- widening can always be dismissed as "you invented candidates the
24
+ # policy would never emit", and this arm is immune to that objection.
25
+ #
26
+ # (B) THE LADDER, WHICH MAKES THE RECOMMENDATION DEPLOYABLE. Run 29's alpha is each cell's own
27
+ # S(50k)/S(150k) -- a number that needs the 50k checkpoint to compute. AT DEPLOYMENT THERE IS NO
28
+ # 50k CHECKPOINT. So a recommendation of the form "ship the late checkpoint with alpha>1" is not
29
+ # yet shippable. Two extra alphas (1.5 and 3.0) on two RISE actors bracket each cell's own ratio
30
+ # (sn1 1.772, riseadv 2.049) and, with the alpha=1.0 screens that already exist, give 4 points per
31
+ # cell. If argmin_alpha rsm lands in the same place for both cells, alpha ships as a CONSTANT and
32
+ # the 50k reference is not needed; if it does not, the knob is per-model and that is a real cost
33
+ # that has to be stated rather than discovered later.
34
+ #
35
+ # PREDICTIONS ARE REGISTERED IN status/real/ft50_converse_ladder.py BEFORE ANY OF THESE SCREENS EXIST
36
+ # (C1-C3, L1-L4), and that script was run once on CPU against zero data to timestamp the registration.
37
+ #
38
+ # HONESTY OF THE KNOB. scorer_openloop.py:569-576 rescales the candidates about THEIR OWN CENTROID
39
+ # (`cands = m + alpha*(c - m)`, m = candidates' mean), never the ground truth, so no arm of this can
40
+ # leak the target. It is applied BEFORE the --inject-logged block, and we inject nothing here.
41
+ #
42
+ # SHAPE. 4 converse + 4 ladder = 8 independent single-process screens = ONE FULL 8-GPU pack. An
43
+ # underfilled pack is a 1-GPU job wearing an 8-GPU request (CLAUDE.md), so this script HOLDS rather than
44
+ # submit a short pack unless RR_CL_FORCE=1. No replay eval in any payload: replay does not look at
45
+ # candidates at all, so alpha cannot change it and re-running it would be pure waste.
46
+ #
47
+ # TAGS CANNOT CONTAMINATE THE PUBLISHED TABLES. Every published table globs
48
+ # openloop_pi05*_<step>/scorer_openloop.json, which requires the directory name to END in the step.
49
+ # These end in _cs<NNN> / _lad<NNN>. Verified with fnmatch below at submit time, not assumed.
50
+ set -uo pipefail
51
+ ROOT=/proj/dmfexp/zwhong/rsm_rise
52
+ CK=$ROOT/runs/openpi/checkpoints
53
+ GEN=$ROOT/scripts/real/_gen
54
+ PSDIR=$ROOT/status/real/pi05_pending_submits
55
+ LATE=150000
56
+ EARLY=50000
57
+ LADDER_ALPHAS="1.50 3.00"
58
+
59
+ RSM=$ROOT/runs/real_cooking_v5/rsm/R_M/ckpt_s100000.pt
60
+ IDQL=$ROOT/runs/cooking_v5_expert_suboptimal/policy/S0Aidql_seed1/cooking_v5_expert_suboptimal_S0Aidql_s1/20260921235824/models/model_epoch_3000.pth
61
+ COMMON="--idql-ckpt $IDQL --rsm-ckpt $RSM --rsm-mode d1 --rsm-depth 1 --rsm-beta 0.99 \
62
+ --rsm-score-kind prob --rsm-temperature 25 --n-cand 128 --horizon 8 --stride 25"
63
+ # n-cand MUST stay 128 everywhere: the order statistic c in oracle ~ mu - c*sigma depends on it, so a
64
+ # different n-cand would make every cross-arm comparison in this experiment meaningless (run 29's gate).
65
+
66
+ # converse arm: all four cells run 29 measured a ratio for. ladder arm: the two RISE actors.
67
+ CONVERSE_CELLS="
68
+ pi05_cooking_stock_ft50_s0:stock_s0_ft50
69
+ pi05_cooking_sn1_knn0p03_ft50_s0:sn1_knn0p03_ft50
70
+ pi05_cooking_riseadv_ft50_s0:riseadv_s0_ft50
71
+ pi05_cooking_rise_ft50_s0:rise_s0_ft50
72
+ "
73
+ LADDER_CELLS="
74
+ pi05_cooking_sn1_knn0p03_ft50_s0:sn1_knn0p03_ft50
75
+ pi05_cooking_riseadv_ft50_s0:riseadv_s0_ft50
76
+ "
77
+ mkdir -p "$GEN" "$PSDIR" "$ROOT/logs/lsf"
78
+
79
+ # ---------------------------------------------------------------- duplicate guard (run 29's shape)
80
+ JOBS=""; JOBS_OK=0
81
+ for try in 1 2 3; do
82
+ out=$(bjobs -o "job_name stat" -noheader 2>&1); rc=$?
83
+ if [ $rc -eq 0 ] && [ -n "$out" ]; then JOBS="$out"; JOBS_OK=1; break; fi
84
+ case "$out" in *"No unfinished job found"*) JOBS=""; JOBS_OK=1; break;; esac
85
+ [ $try -lt 3 ] && sleep 5
86
+ done
87
+ [ "$JOBS_OK" = 1 ] || { echo "[cl] ABORT: cannot read the LSF job table; refusing to submit"; exit 0; }
88
+ # MEASURED BUG (run 30, 01:43Z): the first version of this guard matched only "^rr_pi05cl +", but
89
+ # bsub_gpu_pack.sh:86-95 SPLITS an RR_GPUS=8 submission into two 4-GPU packs named <name>_p4a / <name>_p4b.
90
+ # The bare name therefore NEVER appears in the job table for an 8-GPU submission, the guard could not
91
+ # fire, and a second invocation two minutes later submitted duplicates 1922417/1922418 racing
92
+ # 1922400/1922401 on the same output directories. I killed 1922417/1922418 (my own jobs). The suffix
93
+ # must be part of the pattern -- the same way pi05_ft50_screen.sh:138 already writes it.
94
+ if printf '%s\n' "$JOBS" | grep -qE "^rr_pi05cl(_p4[ab])? +(PEND|RUN|PSUSP|USUSP|SSUSP)$"; then
95
+ echo "[cl] rr_pi05cl is already PEND/RUN -- refusing to submit a duplicate"; exit 0
96
+ fi
97
+ [ -e "$PSDIR/ft50cl" ] && { echo "[cl] unconfirmed submission marker $PSDIR/ft50cl exists -- refusing"; exit 0; }
98
+
99
+ emit_payload() { # $1 cfg $2 exp $3 step $4 alpha $5 tag
100
+ local cfg=$1 exp=$2 step=$3 alpha=$4 tag=$5
101
+ local ckdir=$CK/$cfg/$exp/$step
102
+ local olout=$ROOT/status/real/openloop_$tag
103
+ local f=$GEN/rr_pi05cl_${tag}.sh
104
+ cat > "$f" <<PL
105
+ #!/usr/bin/env bash
106
+ # $tag : $exp at $step with --cand-shrink $alpha
107
+ set -uo pipefail
108
+ cd $ROOT
109
+ echo "[cell $tag] start \$(date -u) host=\$(hostname) CUDA_VISIBLE_DEVICES=\${CUDA_VISIBLE_DEVICES:-?} alpha=$alpha"
110
+ if [ ! -d "$ckdir/params" ]; then echo "[cell $tag] checkpoint vanished -- nothing to do"; exit 0; fi
111
+ if [ -e "$olout/scorer_openloop.json" ]; then
112
+ echo "[cell $tag] already done -> $olout/scorer_openloop.json"
113
+ else
114
+ $ROOT/scripts/real/run_env_openpi.sh $ROOT/scripts/real/scorer_openloop.py \\
115
+ --policy "openpi:$cfg:$ckdir" $COMMON --cand-shrink $alpha \\
116
+ --tag $tag --out "$olout"
117
+ echo "[cell $tag] screen rc=\$? \$(date -u)"
118
+ fi
119
+ PL
120
+ chmod +x "$f"
121
+ echo "$f"
122
+ }
123
+
124
+ files=""; skipped=0; tags=""
125
+ # ---------------------------------------------------------------- (A) converse: EARLY at alpha = 1/r
126
+ for cell in $CONVERSE_CELLS; do
127
+ cfg=${cell%%:*}; exp=${cell##*:}
128
+ ck=$CK/$cfg/$exp/$EARLY
129
+ se=$ROOT/status/real/openloop_pi05${exp}_${EARLY}/scorer_openloop.json
130
+ sl=$ROOT/status/real/openloop_pi05${exp}_${LATE}/scorer_openloop.json
131
+ if [ ! -d "$ck/params" ]; then echo "[cl] $exp: no $EARLY checkpoint -- skip"; skipped=$((skipped+1)); continue; fi
132
+ if [ ! -e "$se" ] || [ ! -e "$sl" ]; then
133
+ echo "[cl] $exp: need BOTH $EARLY and $LATE screens to set 1/r -- skip"; skipped=$((skipped+1)); continue; fi
134
+ # alpha = S(LATE)/S(EARLY) < 1, from the measured json. Refuse a degenerate value.
135
+ alpha=$(python3 -c "
136
+ import json,sys
137
+ a=json.load(open('$se'))['candidate_spread_xyz_cm']
138
+ b=json.load(open('$sl'))['candidate_spread_xyz_cm']
139
+ r=b/a
140
+ sys.exit(1) if not (0.15 < r < 0.95) else print('%.3f'%r)
141
+ ") || { echo "[cl] $exp: 1/r out of sane range -- skip"; skipped=$((skipped+1)); continue; }
142
+ cs=$(python3 -c "print('cs%03d'%round(float('$alpha')*100))")
143
+ tag=pi05${exp}_${EARLY}_${cs}
144
+ if [ -e "$ROOT/status/real/openloop_$tag/scorer_openloop.json" ]; then
145
+ echo "[cl] $tag: already measured"; skipped=$((skipped+1)); continue; fi
146
+ files="$files $(emit_payload $cfg $exp $EARLY $alpha $tag)"; tags="$tags $tag"
147
+ echo "[cl] queued CONVERSE $tag alpha=1/r=$alpha"
148
+ done
149
+ # ---------------------------------------------------------------- (B) ladder: LATE at fixed alphas
150
+ for cell in $LADDER_CELLS; do
151
+ cfg=${cell%%:*}; exp=${cell##*:}
152
+ ck=$CK/$cfg/$exp/$LATE
153
+ if [ ! -d "$ck/params" ]; then echo "[cl] $exp: no $LATE checkpoint -- skip"; skipped=$((skipped+1)); continue; fi
154
+ for alpha in $LADDER_ALPHAS; do
155
+ lad=$(python3 -c "print('lad%03d'%round(float('$alpha')*100))")
156
+ tag=pi05${exp}_${LATE}_${lad}
157
+ if [ -e "$ROOT/status/real/openloop_$tag/scorer_openloop.json" ]; then
158
+ echo "[cl] $tag: already measured"; skipped=$((skipped+1)); continue; fi
159
+ files="$files $(emit_payload $cfg $exp $LATE $alpha $tag)"; tags="$tags $tag"
160
+ echo "[cl] queued LADDER $tag alpha=$alpha"
161
+ done
162
+ done
163
+
164
+ n=$(echo $files | wc -w)
165
+ if [ "$n" -eq 0 ]; then echo "[cl] nothing to submit ($skipped skipped)"; exit 0; fi
166
+
167
+ # --------------- contamination gate: no new tag may be picked up by a published-table glob
168
+ python3 - "$tags" <<'PYG' || { echo "[cl] ABORT: contamination gate failed"; exit 4; }
169
+ import sys, fnmatch
170
+ tags = sys.argv[1].split()
171
+ pats = ['openloop_pi05*_%d' % s for s in (50000, 100000, 150000, 199999)]
172
+ bad = [(t, p) for t in tags for p in pats if fnmatch.fnmatch('openloop_' + t, p)]
173
+ for t, p in bad:
174
+ print('[cl] CONTAMINATION: openloop_%s matches %s' % (t, p))
175
+ print('[cl] contamination gate: %d tags x %d globs, %d matches' % (len(tags), len(pats), len(bad)))
176
+ sys.exit(1 if bad else 0)
177
+ PYG
178
+
179
+ # ---------------------------------------------------------------- pack size = the largest FULL pack
180
+ # This script is also the RESUME path: payloads skip any cell whose json exists, so after a preemption
181
+ # the remainder is whatever is left -- 5, or 3, or 1 -- and NOT 8. Two ways to get that wrong, both of
182
+ # which CLAUDE.md forbids and both of which the first draft of this tail would have done:
183
+ # * hold at "n != 8" forever, so a preempted sweep never finishes; or
184
+ # * hand a remainder of 5 to RR_GPUS=8, whose 8->4+4 splitter would make a 3-payload and a 2-payload
185
+ # pack -- two UNDERFILLED 4-GPU nodes, i.e. exactly the 1-GPU-job-in-disguise the rule is about.
186
+ # So round DOWN to a whole number of full packs and leave the tail for a later invocation; the tail is
187
+ # only submitted with RR_CL_FORCE=1, which is the deliberate "this really is the last 1-3 cells" call.
188
+ if [ "$n" -ge 8 ]; then G=8; take=8
189
+ elif [ "$n" -ge 4 ]; then G=4; take=4
190
+ else
191
+ echo "[cl] HOLDING: only $n payload(s) left; a $n-payload pack on a 4-GPU j_exclusive node wastes"
192
+ echo " $((4-n)) GPU(s), which is the 1-GPU-job-in-disguise CLAUDE.md forbids."
193
+ echo " Re-run when more cells are ready, or RR_CL_FORCE=1 to take the genuine tail deliberately."
194
+ [ "${RR_CL_FORCE:-0}" = 1 ] || exit 0
195
+ G=4; take=$n
196
+ echo "[cl] RR_CL_FORCE=1 -- submitting the $n-payload tail anyway (waste documented above)"
197
+ fi
198
+ sub=$(echo $files | tr ' ' '\n' | head -n $take | tr '\n' ' ')
199
+ [ "$take" -lt "$n" ] && echo "[cl] $n ready, taking $take as full pack(s); $((n-take)) left for the next invocation"
200
+ touch "$PSDIR/ft50cl"
201
+ echo "[cl] submitting $take payload(s) on $G GPU(s) as rr_pi05cl"
202
+ RR_GPUS=$G RR_MEM=96G bash $ROOT/scripts/bsub_gpu_pack.sh rr_pi05cl $sub 2>&1 | tail -6
rsm_rise/scripts/real/pi05_ft50_gap_table.py ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """PI05_FT (rsm_real#14) -- the train/val GENERALISATION GAP over the fine-tune, read off disk.
3
+
4
+ Why this exists. `pi05_ft50_chunk10_table.py` answers "is the fine-tune back to parent parity on the
5
+ metric the two generations share". It cannot answer "is the remaining budget buying anything", because a
6
+ single val number does not say whether a flat val curve is convergence or overfitting. train.py evaluates
7
+ BOTH a held-out `val` split and a `train_eval` split of the same size (256 chunks, same seeded draw), so
8
+ the ratio val/train_eval is a direct generalisation-gap read with no extra compute.
9
+
10
+ Reads <ckpt>/<exp>/eval_history.jsonl, whose records are {"val": {...}, "train_eval": {...}, "step": N}.
11
+ No GPU, no W&B, no re-eval.
12
+ """
13
+ import json, glob, os, sys
14
+
15
+ BASE = os.environ.get("RR_CKPT_BASE", "runs/openpi/checkpoints")
16
+
17
+ def load(path):
18
+ evs = []
19
+ with open(path) as fh:
20
+ for line in fh:
21
+ line = line.strip()
22
+ if not line:
23
+ continue
24
+ try:
25
+ d = json.loads(line)
26
+ except json.JSONDecodeError:
27
+ continue # a record torn by a concurrent write; the next run re-reads it
28
+ if "step" in d and "val" in d and "train_eval" in d:
29
+ evs.append(d)
30
+ return sorted(evs, key=lambda d: d["step"])
31
+
32
+ runs = {}
33
+ for p in sorted(glob.glob(os.path.join(BASE, "pi05_cooking_*", "*", "eval_history.jsonl"))):
34
+ exp = p.split(os.sep)[-2]
35
+ if "ft50" not in exp and "h50" not in exp:
36
+ continue
37
+ evs = load(p)
38
+ if evs:
39
+ runs[exp] = evs
40
+
41
+ MARKS = (0, 1000, 5000, 10000, 15000, 20000, 50000, 100000, 150000, 199999)
42
+
43
+ print("# PI05_FT -- train/val generalisation gap (val / train_eval, same 256-chunk draw)")
44
+ print()
45
+ print("`c10` = xyz_l2_chunk10_cm (the first-10 prefix, comparable to the chunk-10 parents).")
46
+ print("`c50` = xyz_l2_chunk_cm (the full 1 s chunk, this generation's real objective).")
47
+ print("`gap` = val/train_eval, so 1.0x = no overfitting. Built by scripts/real/pi05_ft50_gap_table.py.")
48
+ print()
49
+ print("| run | step | val c10 | tr c10 | val c50 | tr c50 | c50 gap | mse10 gap |")
50
+ print("|---|---|---|---|---|---|---|---|")
51
+ for exp, evs in runs.items():
52
+ sel, seen = [], set()
53
+ for e in evs:
54
+ if e["step"] in MARKS:
55
+ sel.append(e); seen.add(e["step"])
56
+ if evs[-1]["step"] not in seen:
57
+ sel.append(evs[-1])
58
+ for e in sel:
59
+ v, t = e["val"], e["train_eval"]
60
+ cg = v["xyz_l2_chunk_cm"] / t["xyz_l2_chunk_cm"] if t["xyz_l2_chunk_cm"] else float("nan")
61
+ mg = v["mse_all10"] / t["mse_all10"] if t["mse_all10"] else float("nan")
62
+ print(f"| `{exp}` | {e['step']} | {v['xyz_l2_chunk10_cm']:.3f} | {t['xyz_l2_chunk10_cm']:.3f} "
63
+ f"| {v['xyz_l2_chunk_cm']:.3f} | {t['xyz_l2_chunk_cm']:.3f} | {cg:.2f}x | {mg:.1f}x |")
64
+
65
+ print()
66
+ print("## Per-run best-so-far on each val metric (does the LATEST step win?)")
67
+ print()
68
+ print("| run | newest step | best val c10 (@step) | best val c50 (@step) | latest is best c50? |")
69
+ print("|---|---|---|---|---|")
70
+ for exp, evs in runs.items():
71
+ b10 = min(evs, key=lambda e: e["val"]["xyz_l2_chunk10_cm"])
72
+ b50 = min(evs, key=lambda e: e["val"]["xyz_l2_chunk_cm"])
73
+ last = evs[-1]
74
+ print(f"| `{exp}` | {last['step']} | {b10['val']['xyz_l2_chunk10_cm']:.3f} (@{b10['step']}) "
75
+ f"| {b50['val']['xyz_l2_chunk_cm']:.3f} (@{b50['step']}) "
76
+ f"| {'YES' if b50['step'] == last['step'] else 'no -- best was @%d' % b50['step']} |")
rsm_rise/scripts/real/pi05_ft50_horizon_probe.py ADDED
@@ -0,0 +1,174 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+ """rsm_real#14 / worker ft50scr TASK 1 -- what does `--horizon 8` MEAN for a policy whose action_horizon is 50?
3
+
4
+ The 13 existing rows of the pi0.5 planning screen (status/real/pi05_screen_table_25.md) were all measured on
5
+ CHUNK-10 policies with `--horizon 8`. Before a single chunk-50 row is added to that table we have to know
6
+ whether `--horizon` truncates the policy's chunk (-> the new rows ARE comparable) or whether it is assumed
7
+ equal to action_horizon / padded / silently scored against a mismatched reference (-> NOT comparable).
8
+
9
+ The code path (read first, then measured here):
10
+ * scorer_openloop.py:568 cands = pol.candidates(obs, a.n_cand, a.horizon)
11
+ * twin_rollout.py:207-216 OpenpiPolicy.candidates: the flow noise is drawn at (self.H, self.D) where
12
+ self.H = cfg.model.action_horizon -- i.e. MODEL-matched, 50 for an ft50 config --
13
+ and the returned chunk is `np.asarray(a)[:horizon, :10]`, a PURE TRUNCATION.
14
+ * scorer_openloop.py:577 gt = A[i:i + a.horizon] (8 logged frames)
15
+ * scorer_openloop.py:545 grid = range(0, T - a.horizon, a.stride) (the same anchors as the chunk-10 runs)
16
+ * scorer_openloop.py:619 err_first = |cands[:, 0, :3] - gt[0, :3]| -> first action only
17
+ * scorer_openloop.py:620 err_chunk = |cands[..., :3] - gt[None, :, :3]|.mean(1) -> mean over 8 steps
18
+ * twin_rollout.py:307 IDQLScorer sees cands[:, 0, :] -> first action only
19
+ * twin_rollout.py:290-302 RSMScorer sees A[:, :rsm.chunk], PADDING with the last action if the chunk is
20
+ SHORTER than rsm.chunk -- and it is 8 steps here exactly as in the chunk-10 runs.
21
+
22
+ So the prediction is: `--horizon 8` on a chunk-50 policy denoises a full 50-step chunk (the model's own
23
+ horizon, which is what its noise shape and attention mask are built for) and then keeps the FIRST 8 steps.
24
+ Every read-out downstream sees exactly the 8-step object it saw for the chunk-10 policies.
25
+
26
+ This script MEASURES that instead of asserting it:
27
+ 1. cfg.model.action_horizon for a chunk-10 parent, an ft50 config and the _h50 control.
28
+ 2. candidates(obs, n, 8).shape == (n, 8, 10) and candidates(obs, n, 50).shape == (n, 50, 10).
29
+ 3. With the proposer RNG re-seeded identically (scorer_openloop.py:519 does exactly this, per episode),
30
+ candidates(...,8) is BIT-IDENTICAL to candidates(...,50)[:, :8]. That is the whole claim: --horizon
31
+ does not change the model call, the noise, or the sample -- only the slice that is returned.
32
+ 4. The failure mode at the other end: horizon > action_horizon returns a chunk SHORTER than requested
33
+ (the slice just runs out), which downstream is a broadcast error, not a silent wrong number.
34
+ 5. The realised spread of the first action, so the new rows' `spread` column has a sanity reference.
35
+
36
+ usage: pi05_ft50_horizon_probe.py --ckpt <dir with params/ and assets/> [--config ...] [--n 8] [--ep 7]
37
+ """
38
+ import argparse, json, sys, time
39
+ from pathlib import Path
40
+ import numpy as np
41
+
42
+ ROOT = Path("/proj/dmfexp/zwhong/rsm_rise")
43
+ PROMPT = "Follow the displayed cooking state sequence"
44
+
45
+
46
+ def decode_frame(path, idx=0):
47
+ import av
48
+ with av.open(str(path)) as c:
49
+ st = c.streams.video[0]; st.thread_type = "AUTO"
50
+ for i, fr in enumerate(c.decode(st)):
51
+ if i == idx:
52
+ return fr.to_ndarray(format="rgb24")
53
+ raise RuntimeError(f"frame {idx} not in {path}")
54
+
55
+
56
+ def main():
57
+ ap = argparse.ArgumentParser()
58
+ ap.add_argument("--ckpt", required=True, help="a CHUNK-50 checkpoint dir holding params/ and assets/")
59
+ ap.add_argument("--config", default="pi05_cooking_stock_ft50_s0")
60
+ ap.add_argument("--parent-config", default="pi05_cooking_stock", help="the chunk-10 parent, for the horizons")
61
+ ap.add_argument("--n", type=int, default=8, help="candidates per call (the real screen uses 128)")
62
+ ap.add_argument("--ep", type=int, default=7, help="held-out episode to take the probe observation from")
63
+ ap.add_argument("--frame", type=int, default=0)
64
+ ap.add_argument("--out", default=str(ROOT / "status/real/pi05_ft50_screen_horizon.json"))
65
+ a = ap.parse_args()
66
+
67
+ sys.path.insert(0, str(ROOT / "scripts/real"))
68
+ from openpi.training import config as cfgmod
69
+ from twin_rollout import OpenpiPolicy
70
+
71
+ rec = {"probe": "pi05_ft50_horizon_probe", "utc": time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime()),
72
+ "ckpt": a.ckpt, "config": a.config, "n_cand": a.n, "episode": a.ep, "frame": a.frame}
73
+
74
+ # ---- 1. the configured horizons ------------------------------------------------------------------
75
+ hz = {}
76
+ for nm in (a.parent_config, a.config, "pi05_cooking_stock_h50"):
77
+ try:
78
+ c = cfgmod.get_config(nm)
79
+ hz[nm] = {"action_horizon": int(c.model.action_horizon), "action_dim": int(c.model.action_dim)}
80
+ except Exception as e: # a config that is not registered is a finding
81
+ hz[nm] = {"error": repr(e)}
82
+ rec["configured_horizons"] = hz
83
+ print("[probe] configured horizons:", json.dumps(hz), flush=True)
84
+
85
+ # ---- the probe observation: a REAL held-out frame, exactly the objects scorer_openloop feeds -------
86
+ import pyarrow.parquet as pq
87
+ t = pq.read_table(ROOT / f"data/real/rsm_cooking_v5/data/chunk-000/episode_{a.ep:06d}.parquet").to_pandas()
88
+ S = np.stack(t["observation.state"].values).astype(np.float32)
89
+ vr = ROOT / "data/real/rsm_cooking_v5/videos/chunk-000"
90
+ obs = {"state": S[a.frame],
91
+ "images": {"global": decode_frame(vr / f"observation.images.global/episode_{a.ep:06d}.mp4", a.frame),
92
+ "wrist": decode_frame(vr / f"observation.images.wrist/episode_{a.ep:06d}.mp4", a.frame)}}
93
+ rec["state_dim"] = int(S.shape[1]); rec["image_shape"] = list(obs["images"]["global"].shape)
94
+
95
+ pol = OpenpiPolicy(a.config, a.ckpt, seed=0)
96
+ rec["policy_H"] = int(pol.H); rec["policy_D"] = int(pol.D)
97
+ rec["noise_shape_per_candidate"] = [int(pol.H), int(pol.D)]
98
+ print(f"[probe] OpenpiPolicy self.H={pol.H} self.D={pol.D} -> flow noise is drawn at "
99
+ f"({pol.H},{pol.D}), i.e. MODEL-matched", flush=True)
100
+
101
+ # ---- 2/3. the same draw at two horizons, proposer RNG re-seeded exactly as scorer_openloop does ----
102
+ seed, ep = 0, a.ep
103
+ pol.rng = np.random.default_rng([seed, ep]); t0 = time.time()
104
+ c8 = pol.candidates(obs, a.n, 8)
105
+ pol.rng = np.random.default_rng([seed, ep])
106
+ c50 = pol.candidates(obs, a.n, int(pol.H))
107
+ rec["secs_per_call"] = round((time.time() - t0) / 2, 2)
108
+ rec["shape_horizon_8"] = list(c8.shape)
109
+ rec["shape_horizon_H"] = list(c50.shape)
110
+ print(f"[probe] candidates(n={a.n}, horizon=8) -> {c8.shape} "
111
+ f"candidates(n={a.n}, horizon={pol.H}) -> {c50.shape}", flush=True)
112
+
113
+ ok_shape = (tuple(c8.shape) == (a.n, 8, 10)) and (tuple(c50.shape) == (a.n, int(pol.H), 10))
114
+ identical = bool(np.array_equal(c8, c50[:, :8]))
115
+ maxabs = float(np.abs(c8 - c50[:, :8]).max())
116
+ rec["shapes_as_expected"] = bool(ok_shape)
117
+ rec["truncation_bit_identical"] = identical
118
+ rec["max_abs_diff_first8"] = maxabs
119
+ print(f"[probe] horizon-8 draw vs first 8 of the horizon-{pol.H} draw: "
120
+ f"bit-identical={identical} max|diff|={maxabs:.3e}", flush=True)
121
+
122
+ # ---- 4. the other end: horizon > action_horizon silently returns a SHORTER chunk -------------------
123
+ pol.rng = np.random.default_rng([seed, ep])
124
+ over = pol.candidates(obs, 2, int(pol.H) + 10)
125
+ rec["shape_horizon_over"] = list(over.shape)
126
+ rec["over_horizon_is_truncated_to_H"] = bool(over.shape[1] == int(pol.H))
127
+ print(f"[probe] candidates(horizon={pol.H + 10}) -> {over.shape}: the slice runs out, so asking for more "
128
+ f"than action_horizon yields action_horizon steps (downstream that is a BROADCAST ERROR in "
129
+ f"err_chunk, not a silent wrong number)", flush=True)
130
+
131
+ # ---- 5. spread / first-action reference -----------------------------------------------------------
132
+ f0 = c8[:, 0, :3]
133
+ rec["first_action_spread_xyz_cm"] = float(100 * np.linalg.norm(f0 - f0.mean(0), axis=1).mean())
134
+ rec["chunk_span_xyz_cm_h8"] = float(100 * np.linalg.norm(c8[:, 7, :3] - c8[:, 0, :3], axis=1).mean())
135
+ rec["chunk_span_xyz_cm_hH"] = float(100 * np.linalg.norm(c50[:, -1, :3] - c50[:, 0, :3], axis=1).mean())
136
+
137
+ # ---- the verdict ----------------------------------------------------------------------------------
138
+ comparable = bool(ok_shape and identical and int(pol.H) == 50 and rec["configured_horizons"]
139
+ .get(a.parent_config, {}).get("action_horizon") == 10)
140
+ rec["verdict"] = "COMPARABLE" if comparable else "NOT_COMPARABLE_OR_INCONCLUSIVE"
141
+ rec["verdict_reason"] = (
142
+ "--horizon is a pure post-hoc TRUNCATION of the policy's own chunk (twin_rollout.py:216 "
143
+ "`np.asarray(a)[:horizon, :10]`). The flow noise is drawn at the MODEL's (action_horizon, action_dim) "
144
+ "= (%d,%d), so the chunk-50 model is sampled exactly as it was trained; the returned object is its "
145
+ "first 8 steps. gt = A[i:i+8] and the anchor grid range(0, T-8, 25) depend only on --horizon, so a "
146
+ "chunk-50 row is measured at the SAME anchors against the SAME 8 logged frames as the 13 chunk-10 rows. "
147
+ "The IDQL read-out sees cands[:,0] and the RSM read-out sees an 8-step chunk padded to rsm.chunk -- "
148
+ "identical objects in both generations. Nothing is assumed equal to action_horizon, nothing is padded "
149
+ "to the reference, and the horizon-8 draw is bit-identical to the first 8 steps of the horizon-50 draw "
150
+ "under the same per-episode seed."
151
+ % (int(pol.H), int(pol.D))
152
+ if comparable else
153
+ "one of the checks failed -- see shapes_as_expected / truncation_bit_identical / configured_horizons")
154
+ rec["caveats"] = [
155
+ "NOT bit-comparable, only distributionally comparable: a chunk-50 candidate consumes H*D = %d*%d "
156
+ "standard normals from the per-episode stream np.random.default_rng([seed, ep]) where a chunk-10 one "
157
+ "consumed 10*%d, so candidate k gets a DIFFERENT (equally iid N(0,1)) noise draw. Means over 25 "
158
+ "episodes x ~28 anchors x 128 candidates are comparable; a per-candidate diff against a chunk-10 run "
159
+ "is not." % (int(pol.H), int(pol.D), int(pol.D)),
160
+ "The remaining difference is the MODEL, which is the point of the screen: the first 8 steps of a "
161
+ "chunk-50 policy come from a chunk that was jointly denoised over 50 steps. That is the property "
162
+ "being screened, not a measurement artefact.",
163
+ "--horizon must be <= action_horizon. At horizon 50 a chunk-10 policy returns 10 steps and "
164
+ "err_chunk raises a broadcast error; so the chunk-10 rows can never be re-measured at horizon 50, "
165
+ "only the chunk-50 rows can be re-measured at horizon 8 (which is what we do).",
166
+ ]
167
+ Path(a.out).write_text(json.dumps(rec, indent=1))
168
+ print("[probe] wrote", a.out, flush=True)
169
+ print("[probe] VERDICT:", rec["verdict"], flush=True)
170
+ return 0 if comparable else 5
171
+
172
+
173
+ if __name__ == "__main__":
174
+ sys.exit(main())
rsm_rise/scripts/real/pi05_ft50_hprobe.sh ADDED
@@ -0,0 +1,158 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # rsm_real#14 / worker ft50scr TASK 1 -- MEASURE what `--horizon 8` means for a chunk-50 pi0.5 policy, before
3
+ # any chunk-50 row is added to the 13-row pi0.5 planning screen table.
4
+ #
5
+ # Why a PINNED COPY of a checkpoint. `_cooking_ft50` and `_cooking_h50` both run with keep_period=50_000 and
6
+ # save_interval=500, so until step 50k there is exactly ONE step directory alive at a time and it is deleted
7
+ # ~4 min later (measured: 19500 at 05:47Z was already 20000 at 05:52Z). A probe that resolves the newest step
8
+ # at submit time races the trainer and dies on a vanished path. So a CPU job copies <newest>/params (12 G) +
9
+ # <newest>/assets (2 K) to runs/openpi/probe_ckpts/<cfg>_<step>/ -- OUTSIDE the live checkpoint tree, because
10
+ # adding a directory beside orbax's own step dirs in a RUNNING training is not worth the risk to a 28 h job --
11
+ # and the GPU pack runs against the frozen copy under -w done(<pin job>).
12
+ #
13
+ # Four payloads on 4 GPUs, no idle slot:
14
+ # slot0 the code-path probe (pi05_ft50_horizon_probe.py: shapes, truncation bit-identity, over-horizon
15
+ # behaviour) THEN a real 1-episode screen of the chunk-50 model at --horizon 8 with pi05_screen.sh's
16
+ # COMMON verbatim.
17
+ # slot1 the same 1-episode screen at --horizon 50 -- the 50-step read-out, which tells us what we would be
18
+ # measuring if the horizon were raised to match the chunk.
19
+ # slot2 the SAME 1-episode screen of the CHUNK-10 parent pi05_cooking_stock/stock_s1/29999. This is the
20
+ # control that makes the comparability claim empirical rather than code-reading: episode 7 is the
21
+ # first held-out episode, and status/real/openloop_pi05stock_s1/scorer_openloop.json already holds
22
+ # that episode's row from the full 25-episode chunk-10 screen, so slot2 must REPRODUCE it exactly.
23
+ # If it does, the 1-episode probe is a faithful slice of a real screen row and slot0's numbers can be
24
+ # read against the table.
25
+ # slot3 openpi_replay_eval.py on the chunk-50 checkpoint (TASK 3 smoke test): does the replay eval run at
26
+ # action_horizon=50 and does it emit xyz_l2_first_cm AND the *_chunk10_* prefixes that make chunk-50
27
+ # comparable to the chunk-10 generation?
28
+ #
29
+ # usage: pi05_ft50_hprobe.sh (idempotent: nothing is submitted if the jsons exist or a job is queued)
30
+ set -uo pipefail
31
+ ROOT=/proj/dmfexp/zwhong/rsm_rise
32
+ CK=$ROOT/runs/openpi/checkpoints
33
+ GEN=$ROOT/scripts/real/_gen
34
+ PSDIR=$ROOT/status/real/pi05_pending_submits
35
+ NAME=rr_pi05scr_ft50_hprobe
36
+ PIN_NAME=rr_cpu_pi05scr_ft50_pin
37
+ PIN_CFG=${PIN_CFG:-pi05_cooking_stock_ft50_s0}
38
+ PIN_EXP=${PIN_EXP:-stock_s0_ft50}
39
+ PINROOT=$ROOT/runs/openpi/probe_ckpts
40
+ HZJSON=$ROOT/status/real/pi05_ft50_screen_horizon.json
41
+ C10CK=$CK/pi05_cooking_stock/stock_s1/29999
42
+
43
+ RSM=$ROOT/runs/real_cooking_v5/rsm/R_M/ckpt_s100000.pt
44
+ IDQL=$ROOT/runs/cooking_v5_expert_suboptimal/policy/S0Aidql_seed1/cooking_v5_expert_suboptimal_S0Aidql_s1/20260921235824/models/model_epoch_3000.pth
45
+ # COPIED VERBATIM from pi05_screen.sh's COMMON, minus --horizon (each slot sets its own) so the rows stay
46
+ # comparable to the existing 13.
47
+ COMMON_NOH="--idql-ckpt $IDQL --rsm-ckpt $RSM --rsm-mode d1 --rsm-depth 1 --rsm-beta 0.99 \
48
+ --rsm-score-kind prob --rsm-temperature 25 --n-cand 128 --stride 25 --max-eps 1"
49
+
50
+ mkdir -p "$GEN" "$PSDIR" "$PINROOT"
51
+
52
+ if [ -e "$HZJSON" ]; then
53
+ echo "[hprobe] TASK 1 already answered -> $HZJSON"
54
+ python3 -c "import json;d=json.load(open('$HZJSON'));print('[hprobe] verdict:',d['verdict'])" 2>/dev/null
55
+ exit 0
56
+ fi
57
+
58
+ # ---------------------------------------------------------------- duplicate guard (pi05_screen_sweep.sh run 13/14)
59
+ JOBS=""; JOBS_OK=0
60
+ for try in 1 2 3; do
61
+ out=$(bjobs -o "job_name stat" -noheader 2>&1); rc=$?
62
+ if [ $rc -eq 0 ] && [ -n "$out" ]; then JOBS="$out"; JOBS_OK=1; break; fi
63
+ case "$out" in *"No unfinished job found"*) JOBS=""; JOBS_OK=1; break;; esac
64
+ echo "[hprobe] bjobs attempt $try failed (rc=$rc): ${out:-<empty>}"; [ $try -lt 3 ] && sleep 5
65
+ done
66
+ [ "$JOBS_OK" = 1 ] || { echo "[hprobe] ABORT: cannot read the LSF job table; refusing to submit"; exit 0; }
67
+ # clear a marker whose job we can now see in the table
68
+ for m in "$PSDIR"/hprobe "$PSDIR"/hprobe_pin; do
69
+ [ -e "$m" ] || continue
70
+ want=$NAME; [ "$(basename "$m")" = hprobe_pin ] && want=$PIN_NAME
71
+ printf '%s\n' "$JOBS" | grep -qE "^${want} +" && { rm -f "$m"; echo "[hprobe] cleared confirmed marker $(basename "$m")"; }
72
+ done
73
+ for p in "$NAME" "$PIN_NAME"; do
74
+ if printf '%s\n' "$JOBS" | grep -qE "^${p} +(PEND|RUN|PSUSP|USUSP|SSUSP)$"; then
75
+ echo "[hprobe] $p already queued/running -- nothing to do"; exit 0
76
+ fi
77
+ done
78
+ if [ -e "$PSDIR/hprobe" ] || [ -e "$PSDIR/hprobe_pin" ]; then
79
+ echo "[hprobe] an UNCONFIRMED submission marker exists ($PSDIR/hprobe*) -- confirm with"
80
+ echo " 'bjobs -w | grep -E \"$NAME|$PIN_NAME\"' / 'bhist -n 2 -J $NAME' and delete it first"; exit 0
81
+ fi
82
+
83
+ # ---------------------------------------------------------------- the pin payload (CPU job, resolves at RUN time)
84
+ cat > "$GEN/${PIN_NAME}.sh" <<PIN
85
+ #!/usr/bin/env bash
86
+ # Freeze one chunk-50 checkpoint's params+assets so the GPU probe cannot race the trainer's 500-step rotation.
87
+ set -uo pipefail
88
+ SRC=$CK/$PIN_CFG/$PIN_EXP
89
+ for attempt in 1 2 3 4 5; do
90
+ st=\$(ls -d \$SRC/[0-9]* 2>/dev/null | sed 's|.*/||' | sort -n | tail -1)
91
+ [ -n "\$st" ] || { echo "[pin] no step dir under \$SRC yet (attempt \$attempt)"; sleep 30; continue; }
92
+ dst=$PINROOT/${PIN_CFG}_\$st
93
+ if [ -e "\$dst/.complete" ]; then echo "[pin] already pinned: \$dst"; echo "\$dst" > $PINROOT/LATEST; exit 0; fi
94
+ echo "[pin] attempt \$attempt: copying \$SRC/\$st -> \$dst (\$(date -u))"
95
+ rm -rf "\$dst.tmp"; mkdir -p "\$dst.tmp"
96
+ if cp -r "\$SRC/\$st/params" "\$dst.tmp/params" && cp -r "\$SRC/\$st/assets" "\$dst.tmp/assets"; then
97
+ cp "\$SRC/\$st/_CHECKPOINT_METADATA" "\$dst.tmp/_CHECKPOINT_METADATA" 2>/dev/null
98
+ echo "step=\$st src=\$SRC/\$st pinned=\$(date -u)" > "\$dst.tmp/.complete"
99
+ rm -rf "\$dst"; mv "\$dst.tmp" "\$dst"
100
+ echo "\$dst" > $PINROOT/LATEST
101
+ echo "[pin] OK step \$st -> \$dst (\$(du -sh \$dst | cut -f1))"; exit 0
102
+ fi
103
+ echo "[pin] copy of step \$st failed (the trainer probably rotated it) -- retrying with the new newest"
104
+ rm -rf "\$dst.tmp"; sleep 10
105
+ done
106
+ echo "[pin] FAILED after 5 attempts"; exit 4
107
+ PIN
108
+ chmod +x "$GEN/${PIN_NAME}.sh"
109
+
110
+ printf '%s submitted %s; job id unconfirmed until a later run sees it\n' "$(date -u +'%F %H:%M UTC')" "$PIN_NAME" \
111
+ > "$PSDIR/hprobe_pin"
112
+ mkdir -p "$ROOT/logs/lsf"
113
+ pin_out=$(bsub -G grp_runtime -q normal -n 8 -M 64G -J "$PIN_NAME" \
114
+ -o "$ROOT/logs/lsf/$PIN_NAME.%J.out" -e "$ROOT/logs/lsf/$PIN_NAME.%J.err" \
115
+ bash "$GEN/${PIN_NAME}.sh" 2>&1)
116
+ echo "[hprobe] pin: $pin_out"
117
+ PINJOB=$(printf '%s' "$pin_out" | sed -n 's/.*<\([0-9]\+\)>.*/\1/p' | head -1)
118
+ [ -n "$PINJOB" ] || { echo "[hprobe] pin submission gave no job id -- marker kept, aborting the pack"; exit 4; }
119
+
120
+ # ---------------------------------------------------------------- the four GPU payloads
121
+ _slot () { # _slot <i> <body...>
122
+ local i=$1; shift
123
+ { echo '#!/usr/bin/env bash'; echo "# ft50scr TASK 1 probe, slot $i"; echo 'set -uo pipefail'
124
+ echo "cd $ROOT"; echo "PIN=\$(cat $PINROOT/LATEST)"; echo 'echo "[slot'"$i"'] pinned ckpt=$PIN"'
125
+ printf '%s\n' "$@"; echo 'echo "[slot'"$i"'] done rc=$? $(date -u)"'; } > "$GEN/${NAME}_slot$i.sh"
126
+ chmod +x "$GEN/${NAME}_slot$i.sh"
127
+ }
128
+
129
+ _slot 0 \
130
+ "$ROOT/scripts/real/run_env_openpi.sh $ROOT/scripts/real/pi05_ft50_horizon_probe.py \\
131
+ --ckpt \"\$PIN\" --config $PIN_CFG --parent-config pi05_cooking_stock \\
132
+ --out $ROOT/status/real/pi05_ft50_screen_horizon.json" \
133
+ "$ROOT/scripts/real/run_env_openpi.sh $ROOT/scripts/real/scorer_openloop.py \\
134
+ --policy \"openpi:$PIN_CFG:\$PIN\" $COMMON_NOH --horizon 8 \\
135
+ --tag pi05hprobe_ft50_h8_e1 --out $ROOT/status/real/openloop_pi05hprobe_ft50_h8_e1"
136
+
137
+ _slot 1 \
138
+ "$ROOT/scripts/real/run_env_openpi.sh $ROOT/scripts/real/scorer_openloop.py \\
139
+ --policy \"openpi:$PIN_CFG:\$PIN\" $COMMON_NOH --horizon 50 \\
140
+ --tag pi05hprobe_ft50_h50_e1 --out $ROOT/status/real/openloop_pi05hprobe_ft50_h50_e1"
141
+
142
+ _slot 2 \
143
+ "# the chunk-10 control: must REPRODUCE episode 7's row in openloop_pi05stock_s1/scorer_openloop.json" \
144
+ "$ROOT/scripts/real/run_env_openpi.sh $ROOT/scripts/real/scorer_openloop.py \\
145
+ --policy \"openpi:pi05_cooking_stock:$C10CK\" $COMMON_NOH --horizon 8 \\
146
+ --tag pi05hprobe_c10stock_s1_h8_e1 --out $ROOT/status/real/openloop_pi05hprobe_c10stock_s1_h8_e1"
147
+
148
+ _slot 3 \
149
+ "# TASK 3 smoke test: openpi_replay_eval.py at action_horizon 50, does it emit the *_chunk10_* prefixes?" \
150
+ "$ROOT/scripts/real/openpi_eval.sh $ROOT/scripts/real/openpi_replay_eval.py \\
151
+ --config $PIN_CFG --ckpt \"\$PIN\" --max-eps 3 \\
152
+ --out $ROOT/status/real/pi05_ft50_hprobe_replay"
153
+
154
+ printf '%s submitted %s (4-GPU pack, dep on pin job %s); job id unconfirmed until a later run sees it\n' \
155
+ "$(date -u +'%F %H:%M UTC')" "$NAME" "$PINJOB" > "$PSDIR/hprobe"
156
+ RR_GPUS=4 RR_MEM=96G RR_DEP="done($PINJOB)" \
157
+ bash $ROOT/scripts/bsub_gpu_pack.sh $NAME \
158
+ "$GEN/${NAME}_slot0.sh" "$GEN/${NAME}_slot1.sh" "$GEN/${NAME}_slot2.sh" "$GEN/${NAME}_slot3.sh" 2>&1 | tail -3
rsm_rise/scripts/real/pi05_ft50_keepperiod_fallback.sh ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # rsm_real#14 (stream PI05_FT) -- DISK FALLBACK, armed 2026-09-25 run 10, NOT fired automatically.
3
+ #
4
+ # WHY: the plan keeps checkpoints at every keep_period=50_000 -> 50k/100k/150k/199999 = 4 keeps x 42 GB x 8 runs
5
+ # = 1.34 TB by 200k. The brief's fallback is keep_period=100_000 (2 keeps -> 672 GB) "only if free < 800 G".
6
+ #
7
+ # GATE (measured, run 10): free on /proj/dmfexp is a SAWTOOTH, not a monotone fall -- 794 G ... 1050 G inside
8
+ # 90 s, because eight concurrent trainings each stage a 42 GB orbax tmp dir every 500 steps (~336 GB of
9
+ # self-inflicted oscillation) on top of other streams. So fire on the PEAK of several df samples, not on one
10
+ # trough: for i in 1 2 3 4 5 6; do df --output=avail -BG /proj/dmfexp | tail -1; sleep 15; done
11
+ # -> if the LARGEST of those is < 800 G, fire. A single trough below 800 G is not the signal.
12
+ #
13
+ # SEQUENCING: with keep_period=100_000 the EXISTING step-50000 checkpoints stop matching the keep rule and
14
+ # orbax garbage-collects them at the next save. Their metrics are already extracted (replay_50000/
15
+ # replay_eval.json + status/real/openloop_pi05*_50000/scorer_openloop.json), but the 50k SCREENS read the
16
+ # weights, so do NOT fire while any rr_pi05scr_ft50_* job is RUN/PEND. My stream adds no NEW keep until
17
+ # ~16:15Z (100k), so there is no growth pressure from PI05_FT before then -- waiting costs nothing.
18
+ set -uo pipefail
19
+ ROOT=/proj/dmfexp/zwhong/rsm_rise
20
+ CFG=$ROOT/third_party/openpi/src/openpi/training/config.py
21
+
22
+ if bjobs -o "job_name stat" -noheader 2>/dev/null | grep -q "rr_pi05scr_ft50"; then
23
+ echo "[fallback] REFUSING: a 50k screen is still RUN/PEND and would lose the weights it is reading."; exit 5
24
+ fi
25
+
26
+ n=$(grep -c "keep_period=50_000," "$CFG")
27
+ [ "$n" = "2" ] || { echo "[fallback] expected 2 keep_period=50_000 lines (h50 factory + ft50 factory), found $n"; exit 3; }
28
+ cp "$CFG" "$CFG.bak.keepperiod.$(date -u +%Y%m%d_%H%M%S)"
29
+ sed -i 's/keep_period=50_000,/keep_period=100_000, # DISK FALLBACK 2026-09-25: free < 800 G, see rsm_real#14/' "$CFG"
30
+ grep -n "keep_period=100_000, # DISK FALLBACK" "$CFG" || { echo "[fallback] edit did not apply"; exit 4; }
31
+
32
+ echo "[fallback] killing the 7 fine-tunes + the from-base control so they restart under the new keep_period"
33
+ for jn in rr_ft50_stock_s0_ft50 rr_ft50_stock_s1_ft50 rr_ft50_rise_s0_ft50 rr_ft50_rise_s1_ft50 \
34
+ rr_ft50_riseadv_s0_ft50 rr_ft50_sn1_knn0p03_ft50 rr_ft50_sn0p1_knn0p03_ft50 rr_h50_stock_s0_h50; do
35
+ bkill -J "$jn" 2>&1 | sed "s/^/[fallback] /"
36
+ done
37
+ sleep 30
38
+ bash $ROOT/scripts/real/pi05_ft50_launch.sh # resumes every exp from its newest checkpoint
39
+ RR_GPUS=8 bash $ROOT/scripts/bsub_gpu_multi.sh rr_h50_stock_s0_h50 \
40
+ $ROOT/scripts/real/openpi_train.sh pi05_cooking_stock_h50 stock_s0_h50 --seed 0
41
+ echo "[fallback] done -- check: bjobs -o \"nreq_slot job_name\" (64 = correct 8-GPU training, 8 = the 1-GPU bug)"
42
+ echo "[fallback] and re-verify the vendored patch: bash $ROOT/scripts/real/pi05_ft50_rebuild_patch.sh"
rsm_rise/scripts/real/pi05_ft50_launch.sh ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # rsm_real#14 (stream PI05_FT): launch the pi0.5 flagship FINE-TUNES -- 200k steps, action chunk 50 (1.000 s
3
+ # @ 50 Hz), warm-started from the published flagship checkpoints. One 8-GPU node each (CLAUDE.md: never a
4
+ # 1-GPU job; `nreq_slot` must read 64, not 8). Idempotent: openpi_train.sh --resume's any exp that already
5
+ # has a checkpoint, so re-running this after a preemption is the correct recovery.
6
+ #
7
+ # cfg:exp:SEED -- the seed is an explicit tyro override, NOT a config field. TrainConfig.seed defaults to 42,
8
+ # so omitting it makes s0 and s1 bit-identical runs (that bug cost PI05_200K a relaunch, LSF 1909408-12).
9
+ # Each fine-tune inherits its PARENT's seed so the data order continues the run it warm-starts from.
10
+ set -uo pipefail
11
+ ROOT=/proj/dmfexp/zwhong/rsm_rise
12
+
13
+ PAIRS="\
14
+ pi05_cooking_stock_ft50_s0:stock_s0_ft50:0 \
15
+ pi05_cooking_stock_ft50_s1:stock_s1_ft50:1 \
16
+ pi05_cooking_rise_ft50_s0:rise_s0_ft50:0 \
17
+ pi05_cooking_rise_ft50_s1:rise_s1_ft50:1 \
18
+ pi05_cooking_riseadv_ft50_s0:riseadv_s0_ft50:0 \
19
+ pi05_cooking_sn1_knn0p03_ft50_s0:sn1_knn0p03_ft50:0 \
20
+ pi05_cooking_sn0p1_knn0p03_ft50_s0:sn0p1_knn0p03_ft50:0"
21
+
22
+ # Preflight: the norm stats behind assets_dirs must be the PARENT's per-frame train-split file. A warm start
23
+ # under different normalisation silently moves the regression targets, so this is a hard gate, not a warning.
24
+ WANT_MD5=da20b66d4beb1dae800603b6745623c3
25
+ for p in $PAIRS; do
26
+ cfg=${p%%:*}
27
+ f=$ROOT/runs/openpi/assets/$cfg/jmarangola/rsm_cooking_v5/norm_stats.json
28
+ [ -s "$f" ] || { echo "MISSING norm stats for $cfg ($f)"; exit 3; }
29
+ got=$(md5sum "$f" | awk '{print $1}')
30
+ [ "$got" = "$WANT_MD5" ] || { echo "WRONG norm stats for $cfg: $got != $WANT_MD5 (parent per-frame file)"; exit 4; }
31
+ done
32
+ echo "[launch] norm-stats preflight OK (all 7 resolve to the parent per-frame file $WANT_MD5)"
33
+
34
+ for p in $PAIRS; do
35
+ cfg=${p%%:*}; rest=${p#*:}; exp=${rest%%:*}; sd=${rest##*:}
36
+ d=$ROOT/runs/openpi/checkpoints/$cfg/$exp
37
+ if ls -d "$d"/[0-9]* >/dev/null 2>&1; then
38
+ echo "[launch] $exp already has checkpoints -- the runner will RESUME (correct for a rerun/preemption)"
39
+ fi
40
+ echo "[launch] $cfg $exp --seed $sd"
41
+ RR_GPUS=8 bash $ROOT/scripts/bsub_gpu_multi.sh rr_ft50_$exp $ROOT/scripts/real/openpi_train.sh $cfg $exp --seed $sd
42
+ done
rsm_rise/scripts/real/pi05_ft50_pin_early.sh ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # PI05_FT (rsm_real#14): pin a PARAMS-ONLY copy of the current rolling checkpoint for the fine-tunes
3
+ # whose held-out first-10 prefix is DEGRADING, so that selection at 200k has an early fallback.
4
+ #
5
+ # Why this exists. keep_period=50_000 means the earliest RETAINED checkpoint is 50k; save_interval=500
6
+ # keeps only ONE rolling step dir, which is replaced every ~500 steps (~4 min at 2.15 steps/s). So today
7
+ # there is nothing retained between step 0 and step 50k. The run-4 curve shows riseadv_s0 / sn1_knn0p03 /
8
+ # sn0p1_knn0p03 losing first-10 accuracy monotonically (sn1: 1.657 @5k -> 1.818 @19k) while their full
9
+ # chunk-50 error is flat since ~5k -- i.e. their best checkpoint may well be EARLIER than the first keep.
10
+ # params is 12 G, train_state is 31 G; the screens load `params` only, so we copy params and skip the
11
+ # optimiser state. 3 x 12 G = 36 G, checked against df before writing.
12
+ #
13
+ # The source dir can be DELETED mid-copy by the trainer. Orbax step dirs are immutable once complete, so
14
+ # the only failure mode is deletion: we rsync, then re-assert the source still exists. If it vanished we
15
+ # retry with the new newest step. Nothing here ever writes into runs/openpi/checkpoints.
16
+ set -uo pipefail
17
+ cd /proj/dmfexp/zwhong/rsm_rise
18
+
19
+ DEST=runs/openpi/probe_ckpts
20
+ MIN_FREE_GB=${MIN_FREE_GB:-500}
21
+
22
+ RUNS="
23
+ pi05_cooking_riseadv_ft50_s0/riseadv_s0_ft50
24
+ pi05_cooking_sn1_knn0p03_ft50_s0/sn1_knn0p03_ft50
25
+ pi05_cooking_sn0p1_knn0p03_ft50_s0/sn0p1_knn0p03_ft50
26
+ "
27
+
28
+ free_gb() { df -BG --output=avail /proj/dmfexp | tail -1 | tr -dc '0-9'; }
29
+
30
+ echo "[pin] df free before: $(free_gb) G (floor ${MIN_FREE_GB} G)"
31
+ mkdir -p "$DEST"
32
+
33
+ rc_all=0
34
+ for rel in $RUNS; do
35
+ exp=$(basename "$rel")
36
+ cfg=$(dirname "$rel")
37
+ if [ "$(free_gb)" -lt "$MIN_FREE_GB" ]; then
38
+ echo "[pin] REFUSING $exp: only $(free_gb) G free, floor ${MIN_FREE_GB} G"; rc_all=4; continue
39
+ fi
40
+ # already pinned for this run? one early pin per run is the point; skip if present.
41
+ if compgen -G "$DEST/${cfg}_[0-9]*/.complete" >/dev/null 2>&1; then
42
+ echo "[pin] $exp: already has an early pin ($(ls -d $DEST/${cfg}_[0-9]* | tr '\n' ' ')), skipping"; continue
43
+ fi
44
+ ok=0
45
+ for attempt in 1 2 3 4 5; do
46
+ src=$(ls -d runs/openpi/checkpoints/$rel/[0-9]* 2>/dev/null | awk -F/ '{print $NF, $0}' | sort -n | tail -1 | cut -d' ' -f2-)
47
+ if [ -z "${src:-}" ]; then echo "[pin] $exp attempt $attempt: no step dir yet"; sleep 20; continue; fi
48
+ step=$(basename "$src")
49
+ if [ ! -d "$src/params" ]; then echo "[pin] $exp attempt $attempt: $step has no params/ yet"; sleep 20; continue; fi
50
+ tgt="$DEST/${cfg}_${step}"
51
+ tmp="$tgt.partial.$$"
52
+ echo "[pin] $exp attempt $attempt: $src -> $tgt"
53
+ rm -rf "$tmp"; mkdir -p "$tmp"
54
+ # PARALLEL copy. A single-stream rsync of the 12 G params dir runs ~4.5 min, but the trainer replaces
55
+ # the rolling step dir every 500 steps = ~3.9 min at 2.15 steps/s -- so a serial copy LOSES THE RACE every
56
+ # time (observed: LSF 1910834 attempt 1 died with rsync rc=23, "failed to open ... Not a directory", which
57
+ # is what a mid-copy deletion looks like). Splitting the file list over 8 streams brings it to ~1 min,
58
+ # comfortably inside the window. -n 8 is what the job requests.
59
+ mkdir -p "$tmp/params"
60
+ ( cd "$src/params" && find . -type d -print0 ) | ( cd "$tmp/params" && xargs -0 -r mkdir -p ) 2>/dev/null
61
+ ( cd "$src/params" && find . -type f -printf '%f\t%s\t%p\n' ) 2>/dev/null \
62
+ | sort -k2,2nr | awk -F'\t' '{print $3}' > "$tmp/.filelist"
63
+ nf=$(wc -l < "$tmp/.filelist")
64
+ # round-robin by descending size so every stream gets a mix of large and small files
65
+ awk -v n=8 'NR%n==0{print > "'"$tmp"'/.fl0"} NR%n==1{print > "'"$tmp"'/.fl1"} NR%n==2{print > "'"$tmp"'/.fl2"} NR%n==3{print > "'"$tmp"'/.fl3"} NR%n==4{print > "'"$tmp"'/.fl4"} NR%n==5{print > "'"$tmp"'/.fl5"} NR%n==6{print > "'"$tmp"'/.fl6"} NR%n==7{print > "'"$tmp"'/.fl7"}' "$tmp/.filelist"
66
+ echo "[pin] $exp attempt $attempt: $nf files over 8 streams"
67
+ r=0
68
+ for k in 0 1 2 3 4 5 6 7; do
69
+ [ -s "$tmp/.fl$k" ] || continue
70
+ rsync -a --files-from="$tmp/.fl$k" "$src/params/" "$tmp/params/" > "$tmp/.rsync.$k.log" 2>&1 &
71
+ done
72
+ wait
73
+ for k in 0 1 2 3 4 5 6 7; do
74
+ [ -s "$tmp/.rsync.$k.log" ] && { r=1; tail -2 "$tmp/.rsync.$k.log"; }
75
+ done
76
+ [ -e "$src/_CHECKPOINT_METADATA" ] && rsync -a "$src/_CHECKPOINT_METADATA" "$tmp/" 2>/dev/null
77
+ [ -d "$src/assets" ] && rsync -a "$src/assets" "$tmp/" 2>/dev/null
78
+ # the ONLY failure mode for an immutable orbax dir is deletion mid-copy -- re-assert it.
79
+ if [ $r -ne 0 ] || [ ! -d "$src/params" ]; then
80
+ echo "[pin] $exp attempt $attempt: source rolled away (rsync rc=$r), retrying"; rm -rf "$tmp"; continue
81
+ fi
82
+ if [ ! -s "$tmp/params/_METADATA" ] || [ ! -e "$tmp/params/manifest.ocdbt" ]; then
83
+ echo "[pin] $exp attempt $attempt: copy incomplete (_METADATA/manifest.ocdbt missing), retrying"; rm -rf "$tmp"; continue
84
+ fi
85
+ sb=$(du -sb "$src/params" | cut -f1); tb=$(du -sb "$tmp/params" | cut -f1)
86
+ if [ "$sb" != "$tb" ]; then
87
+ echo "[pin] $exp attempt $attempt: size mismatch src=$sb copy=$tb, retrying"; rm -rf "$tmp"; continue
88
+ fi
89
+ rm -f "$tmp"/.rsync.*.log "$tmp"/.filelist "$tmp"/.fl[0-7]
90
+ date -u +%Y-%m-%dT%H:%M:%SZ > "$tmp/.complete"
91
+ echo "$src" >> "$tmp/.complete"
92
+ rm -rf "$tgt"; mv "$tmp" "$tgt"
93
+ echo "[pin] $exp OK: $tgt ($(du -sh $tgt/params | cut -f1), from step $step)"
94
+ ok=1; break
95
+ done
96
+ [ $ok -eq 1 ] || { echo "[pin] $exp FAILED after 5 attempts"; rc_all=5; }
97
+ done
98
+
99
+ echo "[pin] df free after: $(free_gb) G"
100
+ echo "[pin] pins now:"; for d in $DEST/*/; do [ -e "$d/.complete" ] && echo " $d $(du -sh $d 2>/dev/null | cut -f1) <- $(sed -n 2p $d/.complete)"; done
101
+ ls -d $DEST/pi05_cooking_* 2>/dev/null | sed 's#.*/##' > $DEST/LATEST_PINS
102
+ exit $rc_all
rsm_rise/scripts/real/pi05_ft50_pr12.sh ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ ROOT=/proj/dmfexp/zwhong/rsm_rise
4
+ WT=/proj/dmfexp/zwhong/scratch_pi05_200k/rsm_real
5
+ PY=$ROOT/third_party/openpi/.venv/bin/python
6
+ $PY $ROOT/scripts/real/pi05_ft50_update_pr12.py "$WT" "$ROOT/status/real/pi05_ft50_section.md"
7
+ echo "=================== idempotence: run it twice ==================="
8
+ $PY $ROOT/scripts/real/pi05_ft50_update_pr12.py "$WT" "$ROOT/status/real/pi05_ft50_section.md"
9
+ cd $WT && git --no-pager diff --stat
10
+ echo "=================== headings after ==================="
11
+ grep -n "^## \|^### " rise_stack/CHECKPOINTS.md | sed -n '1,25p'
12
+ echo PR12_JOB_DONE
rsm_rise/scripts/real/pi05_ft50_pr13.sh ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # One CPU LSF job for the whole of PR #13's mechanical work:
3
+ # rebuild the patch (3 blocks) -> assert 0 lines dropped -> git apply --check -> py_compile
4
+ # -> install it in the worktree -> renumber README.md / SETUP.md FROM THE PATCH BYTES -> 20 guard tests.
5
+ # Leaves the worktree dirty but uncommitted; the main session reads this log and commits.
6
+ set -euo pipefail
7
+ ROOT=/proj/dmfexp/zwhong/rsm_rise
8
+ WT=/proj/dmfexp/zwhong/scratch_pi05_200k/rsm_real_scaffold
9
+ WORK=/proj/dmfexp/zwhong/scratch_pi05_200k/openpi_rebuild_ft50
10
+ PY=$ROOT/third_party/openpi/.venv/bin/python
11
+
12
+ bash $ROOT/scripts/real/pi05_ft50_rebuild_patch.sh "$WT"
13
+
14
+ echo "=================== install into the worktree ==================="
15
+ cp $WORK/rise_on_pi05.patch $WT/rise_stack/openpi/rise_on_pi05.patch
16
+ cd $WT && git --no-pager diff --stat -- rise_stack/openpi/rise_on_pi05.patch
17
+
18
+ echo "=================== renumber the docs from the patch bytes ==================="
19
+ $PY $ROOT/scripts/real/pi05_ft50_renumber_docs.py "$WT"
20
+
21
+ echo "=================== guard tests ==================="
22
+ cd $WT && $PY -m pytest tests/test_rise_stack_openpi_patch_numbers.py -q 2>&1 | tail -30
23
+
24
+ echo "=================== worktree diff summary ==================="
25
+ cd $WT && git --no-pager diff --stat
26
+ echo "=================== doc numbers now in the tree ==================="
27
+ grep -n "insertions and" $WT/rise_stack/openpi/README.md || true
28
+ grep -n "files, total" $WT/rise_stack/openpi/README.md || true
29
+ grep -n "inserted lines on top of upstream commit" $WT/SETUP.md || true
30
+ grep -n "pi05_cooking_\*\` \`TrainConfig\|declares" $WT/rise_stack/openpi/README.md | head || true
31
+ echo "PR13_JOB_DONE"
rsm_rise/scripts/real/pi05_ft50_pytest.sh ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ cd /proj/dmfexp/zwhong/scratch_pi05_200k/rsm_real_scaffold
3
+ /proj/dmfexp/zwhong/rsm_rise/third_party/openpi/.venv/bin/python -m pytest tests/test_rise_stack_openpi_patch_numbers.py -q 2>&1 | tail -25
4
+ echo FT50_PYTEST_DONE
rsm_rise/scripts/real/pi05_ft50_rebuild_patch.sh ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # Rebuild rsm_real's vendored openpi patch so it carries THREE of our blocks instead of two:
3
+ # 1. `_cooking_h50` -- the from-base chunk-50 configs (KEPT: LSF 1909448 stock_s0_h50 still trains on it)
4
+ # 2. `_cooking_ft50` -- NEW: the seven pi0.5 flagship FINE-TUNES at chunk 50 (rsm_real#14 / rsm_rise PI05_FT)
5
+ # 3. fit_metrics' `*_chunk10_*` variants in scripts/train.py
6
+ #
7
+ # Same discipline as scripts/real/pi05_h50_rebuild_patch.sh (do not "improve" it): the shipped patch is NOT a
8
+ # `git diff` of the rsm_rise openpi tree (that tree carries the run-54 factorial configs the patch has never
9
+ # shipped, and the patch carries the rsm_real#5 inference-split fix that was never back-ported). So: replay
10
+ # the shipped patch AS OF THE BRANCH POINT onto pristine upstream, apply ONLY our blocks on top, re-diff, and
11
+ # assert that the new patch drops nothing.
12
+ set -euo pipefail
13
+ ROOT=/proj/dmfexp/zwhong/rsm_rise
14
+ WT=${1:-/proj/dmfexp/zwhong/scratch_pi05_200k/rsm_real_scaffold}
15
+ BASE_REF=${2:-2dc85c8} # the branch point: the patch WITHOUT any chunk-50 block
16
+ WORK=/proj/dmfexp/zwhong/scratch_pi05_200k/openpi_rebuild_ft50
17
+ PIN=$(head -1 $WT/rise_stack/openpi/UPSTREAM_COMMIT.txt)
18
+ rm -rf $WORK; mkdir -p $WORK/up
19
+ cd $WT && git show "$BASE_REF:rise_stack/openpi/rise_on_pi05.patch" > $WORK/base.patch
20
+ # the patch currently COMMITTED on the branch (h50 + chunk10), the one the 0-dropped-lines assertion must
21
+ # respect. Read it from HEAD, not from the working tree: on a re-run the working tree already holds the NEW
22
+ # patch, and comparing it against itself would silently turn the subset assertion into a tautology.
23
+ git show "HEAD:rise_stack/openpi/rise_on_pi05.patch" > $WORK/current.patch
24
+ echo "[rebuild] pin=$PIN base=$BASE_REF base.patch=$(wc -l < $WORK/base.patch) current.patch=$(wc -l < $WORK/current.patch) lines"
25
+ cd $ROOT/third_party/openpi && git archive "$PIN" | tar -x -C $WORK/up
26
+ cd $WORK/up
27
+ git init -q && git add -A && git -c user.email=rr@local -c user.name=rr commit -qm "upstream $PIN"
28
+ echo "[rebuild] ---- git apply --check of the BASE patch onto pristine $PIN ----"
29
+ git apply --check $WORK/base.patch && echo "[rebuild] BASE PATCH APPLIES CLEAN"
30
+ git apply $WORK/base.patch
31
+
32
+ echo "[rebuild] ---- insert the _h50 block, the NEW _ft50 block, and the chunk10 fit metrics ----"
33
+ python3 - "$ROOT" <<'PY'
34
+ import sys, pathlib
35
+ root = pathlib.Path(sys.argv[1])
36
+
37
+ H50_MARK = "# ---- rsm_rise (#263 follow-up, owner 2026-09-25): CHUNK-50 200k cooking fine-tunes"
38
+ FT50_MARK = "# ---- rsm_rise / rsm_real#14: pi0.5 flagship FINE-TUNES to 200k steps at chunk 50"
39
+ ANCHOR = "if len({config.name for config in _CONFIGS}) != len(_CONFIGS):"
40
+
41
+ # 1+2. the two TrainConfig blocks, verbatim from the live rsm_rise config.py so the two trees can never drift
42
+ live = (root / "third_party/openpi/src/openpi/training/config.py").read_text()
43
+ h50_s, ft50_s = live.index(H50_MARK), live.index(FT50_MARK)
44
+ assert h50_s < ft50_s, "expected the _h50 block to precede the _ft50 block"
45
+ end = live.index(ANCHOR, ft50_s)
46
+ h50 = live[h50_s:ft50_s]
47
+ ft50 = live[ft50_s:end]
48
+ p = pathlib.Path("src/openpi/training/config.py")
49
+ src = p.read_text()
50
+ assert src.count(ANCHOR) == 1, src.count(ANCHOR)
51
+ assert "_cooking_h50" not in src and "_cooking_ft50" not in src and "_cooking_200k" not in src, \
52
+ "base patch already carries a chunk-50 / continuation block"
53
+ p.write_text(src.replace(ANCHOR, h50 + ft50 + ANCHOR))
54
+ print(f"[rebuild] config.py: _h50 block {len(h50):6d} chars / {h50.count(chr(10)):4d} lines")
55
+ print(f"[rebuild] config.py: _ft50 block {len(ft50):6d} chars / {ft50.count(chr(10)):4d} lines (NEW)")
56
+
57
+ # 3. the *_chunk10_* fit metrics, verbatim from the live rsm_rise train.py
58
+ livet = (root / "third_party/openpi/scripts/train.py").read_text()
59
+ s2 = livet.index(" # rsm_rise (owner 2026-09-25, chunk 50): the *_chunk_* means above run over")
60
+ e2 = livet.index(" return m", s2)
61
+ fit = livet[s2:e2]
62
+ q = pathlib.Path("scripts/train.py")
63
+ t = q.read_text()
64
+ a2 = ''' for i, n in enumerate(ACT_NAMES):
65
+ m[f"mse_{n}"] = float((d[..., i] ** 2).mean())
66
+ return m'''
67
+ assert t.count(a2) == 1, t.count(a2)
68
+ q.write_text(t.replace(a2, a2[:-len(" return m")] + fit + " return m"))
69
+ print(f"[rebuild] train.py: inserted {len(fit)} chars / {fit.count(chr(10))} lines")
70
+ PY
71
+
72
+ git add -A
73
+ git diff --cached HEAD > $WORK/rise_on_pi05.patch
74
+ echo "[rebuild] new patch: $(wc -l < $WORK/rise_on_pi05.patch) lines"
75
+
76
+ echo "[rebuild] ---- verify the NEW patch applies clean to pristine upstream $PIN ----"
77
+ rm -rf $WORK/verify; mkdir -p $WORK/verify
78
+ cd $ROOT/third_party/openpi && git archive "$PIN" | tar -x -C $WORK/verify
79
+ cd $WORK/verify && git init -q && git add -A && git -c user.email=rr@local -c user.name=rr commit -qm base
80
+ git apply --check $WORK/rise_on_pi05.patch && echo "[rebuild] NEW PATCH APPLIES CLEAN"
81
+ git apply $WORK/rise_on_pi05.patch
82
+ PY=$ROOT/third_party/openpi/.venv/bin/python
83
+ $PY -c "import ast;ast.parse(open('src/openpi/training/config.py').read());print('[rebuild] patched config.py parses')"
84
+ $PY -c "import ast;ast.parse(open('scripts/train.py').read());print('[rebuild] patched train.py parses')"
85
+ $PY -m py_compile src/openpi/training/config.py scripts/train.py && echo "[rebuild] py_compile OK on both patched files"
86
+
87
+ echo "[rebuild] ---- 0-lines-dropped: the CURRENT branch patch's line set must be a SUBSET of the new one ----"
88
+ $PY - "$WORK" <<'PY'
89
+ import collections, pathlib, sys
90
+ w = pathlib.Path(sys.argv[1])
91
+ def bag(f):
92
+ c = collections.Counter()
93
+ for ln in (w / f).read_text().splitlines():
94
+ if ln.startswith("index ") or ln.startswith("@@"):
95
+ continue # blob hashes and hunk headers legitimately shift
96
+ c[ln] += 1
97
+ return c
98
+ for old in ("current.patch", "base.patch"):
99
+ o, n = bag(old), bag("rise_on_pi05.patch")
100
+ missing = o - n
101
+ tot = sum(missing.values())
102
+ print(f"[rebuild] lines of {old} NOT in the new patch (must be 0): {tot}")
103
+ for ln, k in list(missing.items())[:20]:
104
+ print(f" x{k} {ln!r}")
105
+ assert tot == 0, f"{old}: the new patch DROPS {tot} lines"
106
+ PY
107
+
108
+ echo "[rebuild] ---- +ins/-del, current vs new ----"
109
+ $PY - "$WORK" <<'PY'
110
+ import pathlib, sys
111
+ w = pathlib.Path(sys.argv[1])
112
+ def numstat(f):
113
+ files, cur = {}, None
114
+ for ln in (w / f).read_text().splitlines():
115
+ if ln.startswith("diff --git "):
116
+ cur = ln.split(" b/")[-1]; files.setdefault(cur, [0, 0])
117
+ elif ln.startswith(("+++ ", "--- ", "@@")):
118
+ continue
119
+ elif cur and ln.startswith("+"):
120
+ files[cur][0] += 1
121
+ elif cur and ln.startswith("-"):
122
+ files[cur][1] += 1
123
+ return files
124
+ for f in ("current.patch", "rise_on_pi05.patch"):
125
+ fs = numstat(f)
126
+ ti, td = sum(v[0] for v in fs.values()), sum(v[1] for v in fs.values())
127
+ print(f"[rebuild] {f:22s} {len(fs)} files +{ti} / -{td}")
128
+ PY
129
+ echo "[rebuild] OK -> $WORK/rise_on_pi05.patch"
rsm_rise/scripts/real/pi05_ft50_reclaim_killed.sh ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # PI05_FT req 4/req 8 (disk): the four from-base chunk-50 runs killed in run 1 (LSF 1909449-52) each still
3
+ # hold ONE 42 GB step dir from a run that is not the deliverable (from pi05_base, chunk-pooled norm stats,
4
+ # dead at step 7500-8000). The retained control stock_s0_h50 (1909448) is STILL RUNNING and is NOT touched.
5
+ # Deletes only the numeric step dirs; keeps eval_history.jsonl / fit_curves.png / wandb_id.txt as the record.
6
+ set -uo pipefail
7
+ cd /proj/dmfexp/zwhong/rsm_rise
8
+ KEEP_ALIVE="stock_s0_h50" # the retained from-base control -- never touch
9
+ DIRS="runs/openpi/checkpoints/pi05_cooking_rise_h50/rise_s0_h50
10
+ runs/openpi/checkpoints/pi05_cooking_rise_h50/rise_s1_h50
11
+ runs/openpi/checkpoints/pi05_cooking_riseadv_h50/riseadv_s0_h50
12
+ runs/openpi/checkpoints/pi05_cooking_stock_h50/stock_s1_h50"
13
+
14
+ echo "[reclaim] df BEFORE:"; df -h /proj/dmfexp | tail -1
15
+ # hard guard: refuse if any of these names is a live job
16
+ LIVE=$(bjobs -o "job_name" -noheader 2>/dev/null | tr -d ' ')
17
+ for d in $DIRS; do
18
+ exp=$(basename "$d")
19
+ if [[ "$exp" == "$KEEP_ALIVE" ]]; then echo "[reclaim] REFUSE: $exp is the retained control"; exit 3; fi
20
+ if echo "$LIVE" | grep -qx "rr_h50_${exp}"; then echo "[reclaim] REFUSE: rr_h50_${exp} is a LIVE job"; exit 4; fi
21
+ done
22
+ for d in $DIRS; do
23
+ [[ -d "$d" ]] || { echo "[reclaim] $d absent, skip"; continue; }
24
+ for s in "$d"/[0-9]*; do
25
+ [[ -d "$s" ]] || continue
26
+ base=$(basename "$s"); [[ "$base" =~ ^[0-9]+$ ]] || continue
27
+ sz=$(du -sh "$s" | cut -f1)
28
+ echo "[reclaim] rm -rf $s ($sz)"
29
+ rm -rf "$s" && echo "[reclaim] done" || echo "[reclaim] FAILED"
30
+ done
31
+ echo "[reclaim] $d now: $(ls "$d" | tr '\n' ' ')"
32
+ done
33
+ echo "[reclaim] df AFTER:"; df -h /proj/dmfexp | tail -1
34
+ echo "[reclaim] OK"
rsm_rise/scripts/real/pi05_ft50_renumber_docs.py ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Recompute rise_stack/openpi/README.md's per-file +ins/-del table, its totals row, the headline line and
2
+ SETUP.md's "N files and X inserted lines" from the SHIPPED patch bytes, after the patch is replaced.
3
+
4
+ tests/test_rise_stack_openpi_patch_numbers.py recomputes the same numbers and fails on any drift, so this
5
+ script exists to keep the prose honest rather than to be believed.
6
+
7
+ usage: pi05_ft50_renumber_docs.py <worktree>
8
+ """
9
+ import pathlib, re, sys
10
+
11
+ wt = pathlib.Path(sys.argv[1])
12
+ patch = (wt / "rise_stack/openpi/rise_on_pi05.patch").read_text().splitlines()
13
+
14
+ # numstat straight from the hunk lines, exactly as the guard test does
15
+ files, cur = {}, None
16
+ for ln in patch:
17
+ if ln.startswith("diff --git "):
18
+ cur = ln.split(" b/")[-1]
19
+ files.setdefault(cur, [0, 0])
20
+ elif ln.startswith("+++ ") or ln.startswith("--- ") or ln.startswith("@@"):
21
+ continue
22
+ elif cur and ln.startswith("+"):
23
+ files[cur][0] += 1
24
+ elif cur and ln.startswith("-"):
25
+ files[cur][1] += 1
26
+ ti = sum(v[0] for v in files.values())
27
+ td = sum(v[1] for v in files.values())
28
+ print(f"patch: {len(files)} files, +{ti} / -{td}")
29
+ for f, (a, d) in sorted(files.items(), key=lambda kv: -kv[1][0]):
30
+ print(f" {f}: +{a} / -{d}")
31
+
32
+
33
+ def fmt(a, d):
34
+ return f"+{a:,}" if d == 0 else f"+{a:,} / -{d:,}"
35
+
36
+
37
+ rp = wt / "rise_stack/openpi/README.md"
38
+ txt = rp.read_text()
39
+ n_before = txt
40
+
41
+ # per-file rows
42
+ for f, (a, d) in files.items():
43
+ pat = re.compile(r"^(\| `" + re.escape(f) + r"` \| )([^|]*?)( \|)", re.M)
44
+ if not pat.search(txt):
45
+ print(f" !! no README row for {f}")
46
+ continue
47
+ txt = pat.sub(lambda m: m.group(1) + fmt(a, d) + m.group(3), txt)
48
+
49
+ # totals row
50
+ txt = re.sub(r"\| \*\*\d+ files, total\*\* \| \*\*[^*]*\*\* \|",
51
+ f"| **{len(files)} files, total** | **+{ti:,} / -{td:,}** |", txt)
52
+ # headline bullet
53
+ txt = re.sub(r"(\[`rise_on_pi05\.patch`\]\(rise_on_pi05\.patch\), )\d+ files, [\d,]+ insertions and [\d,]+ deletions",
54
+ rf"\g<1>{len(files)} files, {ti:,} insertions and {td:,} deletions", txt)
55
+ # the self-referential sentence that quotes the headline
56
+ txt = re.sub(r"(or the `)\d+ files,\n?([\d,]+) insertions` line above it",
57
+ lambda m: f"{m.group(1)}{len(files)} files,\n{ti:,} insertions` line above it", txt)
58
+ rp.write_text(txt)
59
+ print(f"README.md {'CHANGED' if txt != n_before else 'unchanged'}")
60
+
61
+ sp = wt / "SETUP.md"
62
+ s = sp.read_text()
63
+ # NOTE (ft50): the h50 version of this script matched `is <n> files and <m> inserted lines` on ONE line.
64
+ # SETUP.md is hard-wrapped at ~110 cols and the sentence now breaks between "9" and "files", so that regex
65
+ # silently matched nothing and left SETUP.md at the old total -- which is exactly what
66
+ # test_headline_matches_the_patch[SETUP.md] and test_the_two_documents_agree_with_each_other caught.
67
+ # Tolerate any whitespace (including the newline) at both wrap points, and PRESERVE it so the wrap does not
68
+ # move. Then assert the substitution actually happened rather than trusting it.
69
+ pat = re.compile(r"(\d+)(\s+)files and ([\d,]+)(\s+)inserted lines on top of upstream commit")
70
+ assert pat.search(s), "SETUP.md: '<n> files and <m> inserted lines on top of upstream commit' not found"
71
+ s2 = pat.sub(lambda m: f"{len(files)}{m.group(2)}files and {ti:,}{m.group(4)}inserted lines on top of upstream commit", s)
72
+ sp.write_text(s2)
73
+ print(f"SETUP.md {'CHANGED' if s2 != s else 'unchanged'}")
74
+
75
+ # self-check: both documents' headlines must now read back out of the patch, the same way the guard test
76
+ # recomputes them (re.search over the whole text, so a hard wrap is invisible to it).
77
+ HEAD = re.compile(r"(\d+)\s+files?[^.\n]*?([\d,]+)\s+(?:inserted lines|insertions)")
78
+ for d in (rp, sp):
79
+ m = HEAD.search(d.read_text())
80
+ assert m, f"{d.name}: no headline found"
81
+ got = (int(m.group(1)), int(m.group(2).replace(",", "")))
82
+ assert got == (len(files), ti), f"{d.name} headline {got} != patch ({len(files)}, {ti})"
83
+ print(f"[selfcheck] {d.name} headline = {got} OK")
rsm_rise/scripts/real/pi05_ft50_screen.sh ADDED
@@ -0,0 +1,307 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # rsm_real#14 / worker ft50scr TASK 2+3 -- the PLANNING SCREEN and the HELD-OUT REPLAY EVAL of the pi0.5
3
+ # chunk-50 fine-tunes, at every keep step.
4
+ #
5
+ # A RISE actor is judged by what planning can extract from its candidates, not by greedy fit (owner, PR
6
+ # jmarangola/rsm_real#1, 2026-09-22), so every keep-step checkpoint goes through scorer_openloop.py with the
7
+ # flagship RSM read-out. SETTINGS ARE COPIED VERBATIM from pi05_screen.sh's COMMON -- same IDQL critic
8
+ # (S0Aidql seed 1 epoch 3000), same RSM (R_M ckpt_s100000), d1 / depth 1 / beta 0.99 / prob / T=25, N=128,
9
+ # stride 25, --horizon 8, all 25 held-out episodes -- so the new rows drop straight into the 13-row table that
10
+ # status/real/pi05_screen_table_25.md and build_pi05_screen_table.py already hold.
11
+ #
12
+ # --horizon 8 ON A CHUNK-50 POLICY IS THE RIGHT SETTING, AND IT IS MEASURED, NOT ASSUMED. This script
13
+ # REFUSES to submit until status/real/pi05_ft50_screen_horizon.json says COMPARABLE. The finding
14
+ # (scripts/real/pi05_ft50_horizon_probe.py, TASK 1): --horizon is a pure post-hoc truncation of the policy's
15
+ # own chunk (twin_rollout.py:216 `np.asarray(a)[:horizon, :10]`); the flow noise is drawn at the MODEL's
16
+ # (action_horizon, action_dim), so a chunk-50 model is sampled exactly as trained and only its first 8 steps
17
+ # are returned. gt = A[i:i+8] and the anchor grid range(0, T-8, 25) depend on --horizon alone, so a chunk-50
18
+ # row is measured at the SAME anchors against the SAME 8 logged frames as the chunk-10 rows.
19
+ #
20
+ # SHAPE (CLAUDE.md "many independent single-GPU tasks -> one job, one task per GPU"): the 8 cells are 8
21
+ # independent single-process jobs, so they are PACKED, never submitted one per job (scripts/bsub_gpu.sh exits 3
22
+ # by design since the admin banned 1-GPU jobs). Two things the pack wrapper forces, which is why this is not
23
+ # literally one 8-GPU pack per step:
24
+ # * bsub_gpu_pack.sh splits any RR_GPUS=8 pack with >= 2 payloads into two 4-GPU packs (_p4a/_p4b) because
25
+ # 8-GPU multi-payload packs measurably DO NOT PLACE on this cluster (ORCH run 75). So an 8-wide call
26
+ # becomes 4+4 by itself; we ask for 8 when we have 8 and let it split evenly.
27
+ # * an underfilled pack is a forbidden shape: 1 payload on a 4-GPU j_exclusive node IS a 1-GPU job wearing a
28
+ # 4-GPU request (jobs 1897367/1897368 wasted 6 GPUs for 70 min that way). The `_h50` control runs ~2 h
29
+ # AHEAD of the seven fine-tunes (it started at 02:30Z, they at 04:25Z), so at any given moment the ready
30
+ # cells are NOT one clean step's worth. Therefore this script POOLS every ready-and-unscreened cell
31
+ # ACROSS all four keep steps into one todo list and packs it in groups of 8 (then 4). A remainder of 1-3
32
+ # is HELD, not submitted, and the script prints the RR_FT50SCR_FORCE=1 command that releases it -- by then
33
+ # it is the genuine tail of the work and the waste is bounded.
34
+ #
35
+ # TASK 3 -- the replay eval rides in the SAME payload as the screen, replay FIRST. openpi_replay_eval.py is
36
+ # 8 more independent single-GPU tasks, so it must be packed too; giving it its own packs would double the
37
+ # number of 4-GPU nodes this stream asks for on a cluster where packs already PEND for hours. A payload runs
38
+ # the ~20 min replay eval and then the ~1.5 h screen, so every replay number lands early in the pack's life
39
+ # and the screens finish later, on half the nodes. Each has its OWN json guard, so a payload that dies after
40
+ # the replay eval is resumed at the screen without re-running the replay.
41
+ #
42
+ # usage:
43
+ # pi05_ft50_screen.sh scan all four keep steps, submit what is ready, print what is pending
44
+ # pi05_ft50_screen.sh 50000 only that step
45
+ # RR_FT50SCR_FORCE=1 pi05_ft50_screen.sh also submit a remainder of 1-3 cells (documents the waste)
46
+ # Safe and useful to call every 30 min from now on; before 50k lands it submits nothing.
47
+ set -uo pipefail
48
+ ROOT=/proj/dmfexp/zwhong/rsm_rise
49
+ CK=$ROOT/runs/openpi/checkpoints
50
+ GEN=$ROOT/scripts/real/_gen
51
+ PSDIR=$ROOT/status/real/pi05_pending_submits
52
+ HZJSON=$ROOT/status/real/pi05_ft50_screen_horizon.json
53
+ STEPS=${*:-"50000 100000 150000 199999"}
54
+ FORCE=${RR_FT50SCR_FORCE:-0}
55
+
56
+ # COPIED VERBATIM from pi05_screen.sh (do not edit one of these without re-measuring all 13 existing rows)
57
+ RSM=$ROOT/runs/real_cooking_v5/rsm/R_M/ckpt_s100000.pt
58
+ IDQL=$ROOT/runs/cooking_v5_expert_suboptimal/policy/S0Aidql_seed1/cooking_v5_expert_suboptimal_S0Aidql_s1/20260921235824/models/model_epoch_3000.pth
59
+ COMMON="--idql-ckpt $IDQL --rsm-ckpt $RSM --rsm-mode d1 --rsm-depth 1 --rsm-beta 0.99 \
60
+ --rsm-score-kind prob --rsm-temperature 25 --n-cand 128 --horizon 8 --stride 25"
61
+
62
+ # cfg:exp -- the 7 fine-tunes plus the retained from-base control, which is the init ablation against
63
+ # stock_s0_ft50 (same horizon, same 200k, same data; different init AND different norm stats).
64
+ CELLS="
65
+ pi05_cooking_stock_ft50_s0:stock_s0_ft50
66
+ pi05_cooking_stock_ft50_s1:stock_s1_ft50
67
+ pi05_cooking_rise_ft50_s0:rise_s0_ft50
68
+ pi05_cooking_rise_ft50_s1:rise_s1_ft50
69
+ pi05_cooking_riseadv_ft50_s0:riseadv_s0_ft50
70
+ pi05_cooking_sn1_knn0p03_ft50_s0:sn1_knn0p03_ft50
71
+ pi05_cooking_sn0p1_knn0p03_ft50_s0:sn0p1_knn0p03_ft50
72
+ pi05_cooking_stock_h50:stock_s0_h50
73
+ "
74
+
75
+ mkdir -p "$GEN" "$PSDIR" "$ROOT/logs/lsf"
76
+
77
+ # ---------------------------------------------------------------- TASK 1 gate
78
+ if [ ! -e "$HZJSON" ]; then
79
+ echo "[ft50-screen] BLOCKED on TASK 1: $HZJSON does not exist yet."
80
+ echo "[ft50-screen] --horizon 8 against an action_horizon-50 policy has not been MEASURED, so a screen"
81
+ echo "[ft50-screen] fired now could produce rows that are not comparable to the existing 13."
82
+ echo "[ft50-screen] Run: bash scripts/real/pi05_ft50_hprobe.sh (then re-run this script)"
83
+ exit 0
84
+ fi
85
+ HZV=$(python3 -c "import json;print(json.load(open('$HZJSON')).get('verdict','?'))" 2>/dev/null)
86
+ if [ "$HZV" != COMPARABLE ]; then
87
+ echo "[ft50-screen] REFUSING TO SUBMIT: $HZJSON verdict=$HZV (expected COMPARABLE)."
88
+ echo "[ft50-screen] A screen whose rows are not comparable to the table's other 13 would MISLEAD."
89
+ echo "[ft50-screen] Read the json, fix the one setting it names, and document the change here."
90
+ exit 5
91
+ fi
92
+
93
+ # ---------------------------------------------------------------- duplicate guard (pi05_screen_sweep.sh run 13/14)
94
+ # A pack that is PEND/RUN has no json yet, so the json guard alone would re-submit it; and a stalled mbatchd can
95
+ # hide a bsub that WILL still appear, so every submission also drops an unconfirmed-submission marker. A
96
+ # duplicate screen corrupts a cell's parts/ cache, so when the job table cannot be trusted we submit NOTHING.
97
+ JOBS=""; JOBS_OK=0
98
+ for try in 1 2 3; do
99
+ out=$(bjobs -o "job_name stat" -noheader 2>&1); rc=$?
100
+ if [ $rc -eq 0 ] && [ -n "$out" ]; then JOBS="$out"; JOBS_OK=1; break; fi
101
+ case "$out" in *"No unfinished job found"*) JOBS=""; JOBS_OK=1; break;; esac
102
+ echo "[ft50-screen] bjobs attempt $try failed (rc=$rc): ${out:-<empty>}"; [ $try -lt 3 ] && sleep 5
103
+ done
104
+ [ "$JOBS_OK" = 1 ] || { echo "[ft50-screen] ABORT: cannot read the LSF job table; refusing to submit (duplicate risk)"; exit 0; }
105
+
106
+ # clear markers whose job we can now see in the table (any state), or whose screen has produced its json.
107
+ #
108
+ # PI05_FT run 30 BUGFIX. Only the first half of that sentence was implemented. A marker is a promise
109
+ # "a pack was bsub'd but I have not yet seen its id", and the job-table check can only ever clear it
110
+ # WHILE THE JOB IS STILL LIVE. If the pack finishes before any later run looks -- which is the normal
111
+ # case for a 4-cell screen pack that takes ~1.5 h against a ~30 min run cadence -- the job is gone from
112
+ # the table forever and the marker becomes PERMANENT. Its only effect from then on is the `live=2`
113
+ # branch below, which reports every cell in that pack as "in flight" and therefore NEVER RESUBMITS IT:
114
+ # a silent, unrecoverable deadlock that looks like healthy "in flight" output.
115
+ # Measured: status/real/pi05_pending_submits/ft50scr_rr_pi05scr_ft50_g1_09251204 (Sep 25 12:04) was still
116
+ # present 13.5 h later with its job long finished and all four of its cells screened.
117
+ # So implement the second, work-based condition the comment already promised: if every `--tag` in the
118
+ # pack's payload files has a scorer_openloop.json, the pack's work is DONE and the marker is meaningless
119
+ # regardless of what the job table says. This is strictly safer than a time-based expiry -- it cannot
120
+ # clear a marker for a pack that still has unfinished work, so the duplicate-submission protection the
121
+ # marker exists for is fully preserved.
122
+ for m in "$PSDIR"/ft50scr_*; do
123
+ [ -e "$m" ] || continue
124
+ mt=$(basename "$m" | sed 's/^ft50scr_//') # mt = the pack name stem
125
+ if printf '%s\n' "$JOBS" | grep -qE "^${mt}(_p4[ab])? +"; then
126
+ rm -f "$m"; echo "[ft50-screen] cleared confirmed submission marker $mt (job visible in the table)"
127
+ continue
128
+ fi
129
+ # not in the table: either never submitted, or finished. Distinguish by whether the work exists.
130
+ ntag=0; njson=0
131
+ for p in "$GEN"/${mt}_slot*.sh; do
132
+ [ -e "$p" ] || continue
133
+ for t in $(grep -oE -- '--tag [A-Za-z0-9_]+' "$p" | awk '{print $2}' | sort -u); do
134
+ ntag=$((ntag+1))
135
+ [ -e "$ROOT/status/real/openloop_$t/scorer_openloop.json" ] && njson=$((njson+1))
136
+ done
137
+ done
138
+ if [ "$ntag" -gt 0 ] && [ "$ntag" = "$njson" ]; then
139
+ rm -f "$m"
140
+ echo "[ft50-screen] cleared STALE submission marker $mt: job not in the table and all $ntag cell(s) screened"
141
+ elif [ "$ntag" -gt 0 ]; then
142
+ # Job not in the table AND work incomplete => the pack died (preemption is routine on this queue).
143
+ # Keeping the marker here would be the SAME deadlock, just with a warning printed: the cells would
144
+ # never be resubmitted. But clearing it unconditionally would reopen the exact race the marker
145
+ # exists for -- a marker is written immediately after `bsub`, and LSF can take a few seconds to
146
+ # publish the job, so a run that fires in that window would see "not in the table" and double-submit.
147
+ # Age is the correct discriminator: that publication window is seconds, so a marker older than
148
+ # RR_MARKER_STALE_MIN (default 30 min, one run cadence) cannot still be waiting to appear.
149
+ age_min=$(( ( $(date +%s) - $(stat -c %Y "$m" 2>/dev/null || date +%s) ) / 60 ))
150
+ if [ "$age_min" -ge "${RR_MARKER_STALE_MIN:-30}" ]; then
151
+ rm -f "$m"
152
+ echo "[ft50-screen] cleared DEAD-PACK marker $mt: not in the table, ${age_min} min old,"
153
+ echo " only $njson/$ntag cell(s) screened -- its unscreened cells are now resubmittable"
154
+ else
155
+ echo "[ft50-screen] marker $mt kept: not in the table but only ${age_min} min old ($njson/$ntag screened)"
156
+ echo " -- inside the bsub publication window, so this may be a job LSF has not listed yet"
157
+ fi
158
+ fi
159
+ done
160
+
161
+ # A cell whose training is permanently STOPPED can never produce a later keep. Expecting one is not merely
162
+ # cosmetic: it keeps $waiting non-empty forever, which silently DISABLES the terminal-release branch in the
163
+ # packing tail and so leaves the final-step remainder held for good. The from-base control was stopped by the
164
+ # owner at 154 000 on 2026-09-25 ~20:15 UTC (LSF 1913561, TERM_OWNER) when GPUs were freed for the DINO/WM
165
+ # top-ups; its last keep -- and its last word in every table -- is 150 000.
166
+ CELL_LAST_STEP="stock_s0_h50:150000"
167
+
168
+ # ---------------------------------------------------------------- build the todo list
169
+ todo=""; waiting=""; stopped=""; done_n=0; queued=0
170
+ for st in $STEPS; do
171
+ for cell in $CELLS; do
172
+ cfg=${cell%%:*}; exp=${cell##*:}
173
+ ckdir=$CK/$cfg/$exp/$st
174
+ tag=pi05${exp}_${st}
175
+ lim=$(printf '%s\n' $CELL_LAST_STEP | sed -n "s/^$exp://p")
176
+ if [ -n "$lim" ] && [ "$st" -gt "$lim" ] && [ ! -d "$ckdir/params" ]; then
177
+ stopped="$stopped\n $tag -> that training was STOPPED at step $lim; this keep will never exist, so it is"
178
+ stopped="$stopped\n NOT counted as waiting (counting it would hold the final remainder forever)"
179
+ continue
180
+ fi
181
+ if [ ! -d "$ckdir/params" ]; then
182
+ last=$(ls -d $CK/$cfg/$exp/[0-9]* 2>/dev/null | sed 's|.*/||' | sort -n | tail -1)
183
+ waiting="$waiting\n $tag -> $ckdir/params (that run's newest step is ${last:-none})"
184
+ continue
185
+ fi
186
+ if [ -e "$ROOT/status/real/openloop_$tag/scorer_openloop.json" ]; then
187
+ done_n=$((done_n+1)); continue
188
+ fi
189
+ # is this cell already inside a queued/running pack? The pack name carries the cell list's hash-free
190
+ # stem, so we look the cell up in the payload files of every live pack instead of guessing the name.
191
+ live=0
192
+ for p in "$GEN"/rr_pi05scr_ft50_g*_slot*.sh; do
193
+ [ -e "$p" ] || continue
194
+ grep -q -- "--tag $tag " "$p" || continue
195
+ pk=$(basename "$p" | sed 's/_slot[0-9]*\.sh$//')
196
+ if printf '%s\n' "$JOBS" | grep -qE "^${pk}(_p4[ab])? +(PEND|RUN|PSUSP|USUSP|SSUSP)$"; then live=1; break; fi
197
+ [ -e "$PSDIR/ft50scr_$pk" ] && { live=2; break; }
198
+ done
199
+ if [ "$live" = 1 ]; then echo "[ft50-screen] $tag: already in a queued/running pack"; queued=$((queued+1)); continue; fi
200
+ if [ "$live" = 2 ]; then
201
+ echo "[ft50-screen] $tag: in a pack whose submission is UNCONFIRMED (marker $PSDIR/ft50scr_*) --"
202
+ echo " confirm the job id with 'bjobs -w | grep rr_pi05scr_ft50_g' and delete the marker"
203
+ queued=$((queued+1)); continue
204
+ fi
205
+ todo="$todo $cfg:$exp:$st"
206
+ done
207
+ done
208
+
209
+ echo "[ft50-screen] cells: $(echo $todo | wc -w) ready-and-unscreened, $done_n already screened, $queued in flight"
210
+ [ -n "$waiting" ] && { echo "[ft50-screen] WAITING FOR CHECKPOINTS:"; printf "$waiting\n"; }
211
+ [ -n "$stopped" ] && { echo "[ft50-screen] STOPPED TRAININGS (steps that will never arrive):"; printf "$stopped\n"; }
212
+ [ -z "$todo" ] && { echo "[ft50-screen] nothing to submit"; exit 0; }
213
+
214
+ # ---------------------------------------------------------------- payload writer
215
+ _payload () { # _payload <file> <cfg> <exp> <step>
216
+ local f=$1 cfg=$2 exp=$3 st=$4
217
+ local tag=pi05${exp}_${st}
218
+ local ckdir=$CK/$cfg/$exp/$st
219
+ local olout=$ROOT/status/real/openloop_$tag
220
+ local rpout=$CK/$cfg/$exp/replay_$st
221
+ cat > "$f" <<PL
222
+ #!/usr/bin/env bash
223
+ # ft50scr: keep-step $st of $cfg/$exp -- replay eval (cheap, first) then the planning screen.
224
+ # Both steps SKIP themselves if their json already exists, so a preempted pack resumes and never re-measures.
225
+ set -uo pipefail
226
+ cd $ROOT
227
+ echo "[cell $tag] start \$(date -u) host=\$(hostname) CUDA_VISIBLE_DEVICES=\${CUDA_VISIBLE_DEVICES:-?}"
228
+ if [ ! -d "$ckdir/params" ]; then echo "[cell $tag] checkpoint vanished ($ckdir/params) -- nothing to do"; exit 0; fi
229
+
230
+ # --- TASK 3: held-out replay eval. --horizon is left at the default 0 = the config's own action_horizon, so
231
+ # this reports the real 50-step fit AND (openpi_replay_eval.py:84-87, whenever H > 10) the *_chunk10_*
232
+ # prefixes that make a chunk-50 run comparable to the chunk-10 generation.
233
+ if [ -e "$rpout/replay_eval.json" ]; then
234
+ echo "[cell $tag] replay eval already done -> $rpout/replay_eval.json"
235
+ else
236
+ mkdir -p "$rpout"
237
+ $ROOT/scripts/real/openpi_eval.sh $ROOT/scripts/real/openpi_replay_eval.py \\
238
+ --config $cfg --ckpt "$ckdir" --out "$rpout"
239
+ echo "[cell $tag] replay eval rc=\$? \$(date -u)"
240
+ fi
241
+
242
+ # --- TASK 2: the planning screen, settings verbatim from pi05_screen.sh's COMMON, all 25 held-out episodes.
243
+ if [ -e "$olout/scorer_openloop.json" ]; then
244
+ echo "[cell $tag] screen already done -> $olout/scorer_openloop.json"
245
+ else
246
+ $ROOT/scripts/real/run_env_openpi.sh $ROOT/scripts/real/scorer_openloop.py \\
247
+ --policy "openpi:$cfg:$ckdir" $COMMON \\
248
+ --tag $tag --out "$olout"
249
+ echo "[cell $tag] screen rc=\$? \$(date -u)"
250
+ fi
251
+ echo "[cell $tag] finished \$(date -u)"
252
+ PL
253
+ chmod +x "$f"
254
+ }
255
+
256
+ # ---------------------------------------------------------------- pack the todo list
257
+ set -- $todo
258
+ g=0
259
+ while [ $# -gt 0 ]; do
260
+ if [ $# -ge 8 ]; then n=8; G=8
261
+ elif [ $# -ge 4 ]; then n=4; G=4
262
+ elif [ "$FORCE" = 1 ]; then n=$#; G=4
263
+ elif [ -z "$waiting" ] && [ $# -ge 2 ]; then
264
+ # TERMINAL REMAINDER. The hold below rests entirely on "the other cells' checkpoints are still coming",
265
+ # which is exactly FALSE once $waiting is empty: every cell of the CELLS x STEPS grid then either has its
266
+ # json or is in this remainder, so NO later call can ever add a payload and the hold is permanent. At the
267
+ # final keep that is the normal case, not an edge case: 7 fine-tunes pack as 4 + 3, and the trailing 3 --
268
+ # three of the seven 200k deliverable cells -- would be held forever while the log kept promising a later
269
+ # pack that cannot exist. So release them, on a 4-GPU node, and say what it costs. A remainder of 1 is
270
+ # still held: ONE payload on a 4-GPU j_exclusive node is the forbidden 1-GPU job in disguise, and that one
271
+ # needs a human's RR_FT50SCR_FORCE=1 with a reason.
272
+ n=$#; G=4
273
+ echo "[ft50-screen] TERMINAL REMAINDER: releasing the last $# cell(s) on a 4-GPU node ($((4 - $#)) GPU(s) idle)."
274
+ echo " Nothing is waiting for a checkpoint, so no later call could ever fill this pack and"
275
+ echo " holding it would stall these cells permanently."
276
+ else
277
+ echo "[ft50-screen] HOLDING the last $# cell(s): a pack with $# payload(s) on a 4-GPU j_exclusive node is"
278
+ echo " the forbidden 1-GPU-wearing-a-4-GPU-request shape (see 1897367/1897368). The other"
279
+ echo " cells' checkpoints are still coming, so these will join a full pack on a later call."
280
+ echo " To release them anyway (accepting $((4 - $#)) idle GPU(s)):"
281
+ echo " RR_FT50SCR_FORCE=1 bash scripts/real/pi05_ft50_screen.sh $STEPS"
282
+ for c in "$@"; do echo " held: pi05$(echo $c | cut -d: -f2)_$(echo $c | cut -d: -f3)"; done
283
+ break
284
+ fi
285
+ # TERMINAL BALANCE. Symmetric to the terminal release above, for the one split it cannot save: at terminal
286
+ # state a 4-pack that leaves exactly 1 cell behind ORPHANS it, because a lone payload on a 4-GPU j_exclusive
287
+ # node is the forbidden shape and is therefore the one remainder that is never auto-released. 5 unscreened
288
+ # terminal cells (a preemption away on this queue) would do exactly that. Shrink this pack to 2 so the tail
289
+ # is a releasable 3. Only the n=4 branch is adjusted -- shrinking the 8-wide branch would leave n > G.
290
+ if [ -z "$waiting" ] && [ "$FORCE" != 1 ] && [ "$n" = 4 ] && [ $(( $# - n )) -eq 1 ]; then
291
+ n=2
292
+ echo "[ft50-screen] TERMINAL BALANCE: packing $n (not 4) so the tail is 3, not an orphaned 1."
293
+ fi
294
+ g=$((g+1)); PK=rr_pi05scr_ft50_g${g}_$(date -u +%m%d%H%M)
295
+ # a pack name must be unique per submission or the duplicate guard above cannot tell two packs apart
296
+ while printf '%s\n' "$JOBS" | grep -qE "^${PK}(_p4[ab])? +"; do PK=${PK}x; done
297
+ files=""; i=0
298
+ for c in $(echo "$@" | cut -d' ' -f1-$n); do
299
+ cfg=$(echo $c | cut -d: -f1); exp=$(echo $c | cut -d: -f2); st=$(echo $c | cut -d: -f3)
300
+ f=$GEN/${PK}_slot$i.sh; _payload "$f" "$cfg" "$exp" "$st"; files="$files $f"; i=$((i+1))
301
+ echo "[ft50-screen] $PK slot$i -> pi05${exp}_${st}"
302
+ done
303
+ printf '%s submitted %s (%d payloads, RR_GPUS=%d; the wrapper may split it into %s_p4a/_p4b); job id unconfirmed until a later run sees it\n' \
304
+ "$(date -u +'%F %H:%M UTC')" "$PK" "$n" "$G" "$PK" > "$PSDIR/ft50scr_$PK"
305
+ RR_GPUS=$G RR_MEM=96G bash $ROOT/scripts/bsub_gpu_pack.sh $PK $files 2>&1 | tail -4
306
+ shift $n
307
+ done