rsm_rise code snapshot (HF_PUSH_ALL) (part 7)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
Files changed (50)
- .gitattributes+174
- gen_q_rsm/preliminary_analysis/experiments/visual_pointmaze_medium_navigate_v0/figures/mse.pngAdded
- gen_q_rsm/preliminary_analysis/experiments/visual_pointmaze_medium_navigate_v0/results/0/genq.jsonAdded+122
- gen_q_rsm/preliminary_analysis/experiments/visual_pointmaze_medium_navigate_v0/results/0/mc.jsonAdded+124
- gen_q_rsm/preliminary_analysis/experiments/visual_pointmaze_medium_navigate_v0/results/0/td.jsonAdded+124
- gen_q_rsm/preliminary_analysis/experiments/visual_pointmaze_medium_navigate_v0/results/1/genq.jsonAdded+122
- gen_q_rsm/preliminary_analysis/experiments/visual_pointmaze_medium_navigate_v0/results/1/mc.jsonAdded+124
- gen_q_rsm/preliminary_analysis/experiments/visual_pointmaze_medium_navigate_v0/results/1/td.jsonAdded+124
- gen_q_rsm/preliminary_analysis/experiments/visual_pointmaze_medium_navigate_v0/results/2/genq.jsonAdded+122
- gen_q_rsm/preliminary_analysis/experiments/visual_pointmaze_medium_navigate_v0/results/2/mc.jsonAdded+124
- gen_q_rsm/preliminary_analysis/experiments/visual_pointmaze_medium_navigate_v0/results/2/td.jsonAdded+124
- gen_q_rsm/preliminary_analysis/experiments/visual_pointmaze_medium_navigate_v0/results/3/genq.jsonAdded+122
- gen_q_rsm/preliminary_analysis/experiments/visual_pointmaze_medium_navigate_v0/results/3/mc.jsonAdded+124
- gen_q_rsm/preliminary_analysis/experiments/visual_pointmaze_medium_navigate_v0/results/3/td.jsonAdded+124
- gen_q_rsm/preliminary_analysis/experiments/visual_pointmaze_medium_navigate_v0/results/4/genq.jsonAdded+122
- gen_q_rsm/preliminary_analysis/experiments/visual_pointmaze_medium_navigate_v0/results/4/mc.jsonAdded+124
- gen_q_rsm/preliminary_analysis/experiments/visual_pointmaze_medium_navigate_v0/results/4/td.jsonAdded+124
- gen_q_rsm/preliminary_analysis/experiments/visual_pointmaze_medium_navigate_v0/run_genq.pyAdded+87
- gen_q_rsm/preliminary_analysis/experiments/visual_pointmaze_medium_navigate_v0/run_seq.shAdded+68
- gen_q_rsm/preliminary_analysis/experiments/visual_puzzle_3x3_play_v0/NOTES.mdAdded+52
- gen_q_rsm/preliminary_analysis/experiments/visual_puzzle_3x3_play_v0/figures/.gitkeepAdded
- gen_q_rsm/preliminary_analysis/experiments/visual_puzzle_3x3_play_v0/figures/corr.pngAdded
- gen_q_rsm/preliminary_analysis/experiments/visual_puzzle_3x3_play_v0/figures/mse.pngAdded
- gen_q_rsm/preliminary_analysis/experiments/visual_puzzle_3x3_play_v0/results/.gitkeepAdded
- gen_q_rsm/preliminary_analysis/experiments/visual_puzzle_3x3_play_v0/results/0/genq.jsonAdded+121
- gen_q_rsm/preliminary_analysis/experiments/visual_puzzle_3x3_play_v0/results/0/mc.jsonAdded+123
- gen_q_rsm/preliminary_analysis/experiments/visual_puzzle_3x3_play_v0/results/0/td.jsonAdded+123
- gen_q_rsm/preliminary_analysis/experiments/visual_puzzle_3x3_play_v0/results/1/genq.jsonAdded+121
- gen_q_rsm/preliminary_analysis/experiments/visual_puzzle_3x3_play_v0/results/1/mc.jsonAdded+123
- gen_q_rsm/preliminary_analysis/experiments/visual_puzzle_3x3_play_v0/results/1/td.jsonAdded+123
- gen_q_rsm/preliminary_analysis/experiments/visual_puzzle_3x3_play_v0/results/2/genq.jsonAdded+121
- gen_q_rsm/preliminary_analysis/experiments/visual_puzzle_3x3_play_v0/results/2/mc.jsonAdded+123
- gen_q_rsm/preliminary_analysis/experiments/visual_puzzle_3x3_play_v0/results/2/td.jsonAdded+123
- gen_q_rsm/preliminary_analysis/experiments/visual_puzzle_3x3_play_v0/results/3/genq.jsonAdded+121
- gen_q_rsm/preliminary_analysis/experiments/visual_puzzle_3x3_play_v0/results/3/mc.jsonAdded+123
- gen_q_rsm/preliminary_analysis/experiments/visual_puzzle_3x3_play_v0/results/3/td.jsonAdded+123
- gen_q_rsm/preliminary_analysis/experiments/visual_puzzle_3x3_play_v0/results/4/genq.jsonAdded+121
- gen_q_rsm/preliminary_analysis/experiments/visual_puzzle_3x3_play_v0/results/4/mc.jsonAdded+123
- gen_q_rsm/preliminary_analysis/experiments/visual_puzzle_3x3_play_v0/results/4/td.jsonAdded+123
- gen_q_rsm/preliminary_analysis/experiments/visual_puzzle_3x3_play_v0/run_seed.pyAdded+76
- gen_q_rsm/preliminary_analysis/experiments/visual_puzzle_3x3_play_v0/run_seq.shAdded+66
- gen_q_rsm/preliminary_analysis/gc_core.pyAdded+1612
- gen_q_rsm/preliminary_analysis/genq.pyAdded+115
- gen_q_rsm/preliminary_analysis/genq_reward_latent.pyAdded+202
- gen_q_rsm/preliminary_analysis/genq_visual.pyAdded+450
- gen_q_rsm/preliminary_analysis/genq_visual_cube.pyAdded+409
- gen_q_rsm/preliminary_analysis/genq_visual_puzzle.pyAdded+439
- gen_q_rsm/preliminary_analysis/illustration.pyAdded+112
- gen_q_rsm/preliminary_analysis/mc.pyAdded+150
- gen_q_rsm/preliminary_analysis/models.pyAdded+487
71 unmodified lines72737471 unmodified linesgen_q_rsm/preliminary_analysis/experiments/antmaze_medium_navigate_v0/figures/illustration.gif filter=lfs diff=lfs merge=lfs -textgen_q_rsm/preliminary_analysis/experiments/pointmaze_large_navigate_v0/figures/illustration.gif filter=lfs diff=lfs merge=lfs -textgen_q_rsm/preliminary_analysis/experiments/pointmaze_medium_navigate_v0/figures/illustration.gif filter=lfs diff=lfs merge=lfs -text71 unmodified lines7273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724871 unmodified linesgen_q_rsm/preliminary_analysis/experiments/antmaze_medium_navigate_v0/figures/illustration.gif filter=lfs diff=lfs merge=lfs -textgen_q_rsm/preliminary_analysis/experiments/pointmaze_large_navigate_v0/figures/illustration.gif filter=lfs diff=lfs merge=lfs -textgen_q_rsm/preliminary_analysis/experiments/pointmaze_medium_navigate_v0/figures/illustration.gif filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_libero/notes/action_contrast.pdf filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_libero/notes/rsm_formula_comparison.pdf filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/pixdec/fidelity.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/pixdec/fidelity_mug_expert_suboptimal.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/pixdec/fidelity_mug_mgen.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/pixdec/fidelity_square_expert_play.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/pixdec/fidelity_square_expert_suboptimal.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/pixdec/fidelity_square_sub_20100.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/pixdec/fidelity_threading_expert_play.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/pixdec/fidelity_threading_mgen.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/pixdec/fidelity_two_piece_expert_play.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/pixdec/fidelity_two_piece_expert_play_tipping.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/pixdec/fidelity_two_piece_expert_suboptimal.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/pixdec/r84/fidelity_mug_expert_suboptimal.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/pixdec/r84/fidelity_mug_mgen.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/pixdec/r84/fidelity_square_expert_play.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/pixdec/r84/fidelity_square_expert_suboptimal.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/pixdec/r84/fidelity_square_sub_20100.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/pixdec/r84/fidelity_threading_expert_play.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/pixdec/r84/fidelity_threading_mgen.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/pixdec/r84/fidelity_two_piece_expert_play.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/pixdec/r84/fidelity_two_piece_expert_play_tipping.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/pixdec/r84/fidelity_two_piece_expert_suboptimal.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/real_proposal_curves.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/real_stages/end_stage1_combo.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/real_stages/end_stage1_global.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/real_stages/end_stage1_wrist.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/real_stages/end_stage2_combo.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/real_stages/end_stage2_global.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/real_stages/end_stage2_wrist.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/real_stages/end_stage3_combo.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/real_stages/end_stage3_wrist.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/real_stages/end_stage4_wrist.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/real_stages/end_stage5_combo.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/real_stages/end_stage5_wrist.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/real_stages/end_stage6_combo.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/real_stages/end_stage6_wrist.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/real_stages/pour_strip_ep148.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/real_stages/reward_strip_subopt.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/real_stages/reward_strip_success.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/real_stages/reward_timelines.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/real_stages/stage0_ep000_wrist_start.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/real_stages/stage0_ep001_wrist_start.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/real_stages/stage1_ep050_global_arrival.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/real_stages/stage1_ep050_wrist_arrival.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/real_stages/stage1_ep051_global_arrival.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/real_stages/stage1_ep051_wrist_arrival.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/real_stages/stage2_ep100_global_arrival.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/real_stages/stage2_ep100_wrist_arrival.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/real_stages/stage2_ep101_global_arrival.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/real_stages/stage2_ep101_wrist_arrival.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/real_stages/stage2_ep148_wrist_start.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/real_stages/stage3_ep050_wrist_arrival.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/real_stages/stage3_ep051_wrist_arrival.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/real_stages/stage4_ep148_wrist_arrival.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/real_stages/stage4_ep149_wrist_arrival.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/real_stages/stage5_ep000_wrist_arrival.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/real_stages/stage5_ep001_wrist_arrival.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/real_stages/stage6_ep198_wrist_arrival.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/real_stages/stage6_ep199_wrist_arrival.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/real_stages/stage_grid_global.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/real_stages/stage_grid_wrist.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/real_stages/story_grid_global.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/real_stages/story_start_combo.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/real_stages/success_final_grid.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/real_stitch/endpoints_hop4_A.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/real_stitch/endpoints_hop4_B.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/real_stitch/endpoints_hop4_C3.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/real_stitch/endpoints_hop4_v0lit.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitch_unseen/square_expert_play/unseen_square_expert_play_demo_181_t0135_L40best_b0.95_L8_N128_P16.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitch_unseen/square_expert_play/unseen_square_expert_play_demo_198_t0110_L40best_b0.95_L8_N128_P16.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitch_unseen/square_expert_play/unseen_square_expert_play_demo_54_t0122_L40best_b0.95_L8_N128_P16.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitch_unseen/square_sub_20100/unseen_square_sub_20100_demo_116_t0062_Mbest_b0.95_L8_N128_P16.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitch_unseen/square_sub_20100/unseen_square_sub_20100_demo_147_t0234_Mbest_b0.95_L8_N128_P16.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitch_unseen/square_sub_20100/unseen_square_sub_20100_demo_181_t0252_Mbest_b0.95_L8_N128_P16.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitch_unseen/two_piece_expert_play/unseen_two_piece_expert_play_demo_128_t0115_L40best_b0.95_L8_N128_P16.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitch_unseen/two_piece_expert_play/unseen_two_piece_expert_play_demo_18_t0096_L40best_b0.95_L8_N128_P16.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitch_unseen/two_piece_expert_play/unseen_two_piece_expert_play_demo_38_t0067_L40best_b0.95_L8_N128_P16.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitch_unseen/two_piece_expert_suboptimal/unseen_two_piece_expert_suboptimal_demo_1_t0070_Mproghead_b0.95_L8_N128_P16.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitch_unseen/two_piece_expert_suboptimal/unseen_two_piece_expert_suboptimal_demo_27_t0156_Mproghead_b0.95_L8_N128_P16.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitch_unseen/two_piece_expert_suboptimal/unseen_two_piece_expert_suboptimal_demo_5_t0159_Mproghead_b0.95_L8_N128_P16.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching/square_expert_play/tree_square_expert_play_demo_102_t0145_L40best_b0.95_L8_N128_P16.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching/square_expert_play/tree_square_expert_play_demo_102_t0145_L40best_b0.95_L8_N128_P16_dec.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching/square_expert_play/tree_square_expert_play_demo_102_t0145_L40best_b0.95_L8_N128_P16_dec256.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching/square_expert_play/tree_square_expert_play_demo_102_t0145_L40best_b0.95_L8_N128_P16_r256.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching/square_expert_play/tree_square_expert_play_demo_110_t0104_L40best_b0.95_L8_N128_P16.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching/square_expert_play/tree_square_expert_play_demo_110_t0104_L40best_b0.95_L8_N128_P16_dec.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching/square_expert_play/tree_square_expert_play_demo_110_t0104_L40best_b0.95_L8_N128_P16_dec256.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching/square_expert_play/tree_square_expert_play_demo_110_t0104_L40best_b0.95_L8_N128_P16_r256.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching/square_expert_play/tree_square_expert_play_demo_160_t0165_L40best_b0.95_L8_N128_P16.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching/square_expert_play/tree_square_expert_play_demo_160_t0165_L40best_b0.95_L8_N128_P16_dec.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching/square_expert_play/tree_square_expert_play_demo_160_t0165_L40best_b0.95_L8_N128_P16_dec256.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching/square_expert_play/tree_square_expert_play_demo_160_t0165_L40best_b0.95_L8_N128_P16_r256.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching/square_expert_play/tree_square_expert_play_demo_172_t0038_L40best_b0.95_L8_N128_P16_split2b256.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching/square_expert_play/tree_square_expert_play_demo_181_t0135_L40best_b0.95_L8_N128_P16_split256.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching/square_expert_play/tree_square_expert_play_demo_181_t0135_L40best_b0.95_L8_N128_P16_split2b256.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching/square_expert_play/tree_square_expert_play_demo_221_t0249_L40best_b0.95_L8_N128_P16.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching/square_expert_play/tree_square_expert_play_demo_221_t0249_L40best_b0.95_L8_N128_P16_dec.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching/square_expert_play/tree_square_expert_play_demo_221_t0249_L40best_b0.95_L8_N128_P16_dec256.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching/square_expert_play/tree_square_expert_play_demo_221_t0249_L40best_b0.95_L8_N128_P16_r256.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching/square_expert_play/tree_square_expert_play_demo_36_t0056_L40best_b0.95_L8_N128_P16.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching/square_expert_play/tree_square_expert_play_demo_36_t0056_L40best_b0.95_L8_N128_P16_dec.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching/square_expert_play/tree_square_expert_play_demo_36_t0056_L40best_b0.95_L8_N128_P16_dec256.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching/square_expert_play/tree_square_expert_play_demo_36_t0056_L40best_b0.95_L8_N128_P16_r256.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching/square_expert_play/tree_square_expert_play_demo_36_t0056_L40best_b0.95_L8_N128_P16_split2b256.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching/square_expert_play/tree_square_expert_play_demo_84_t0390_L40best_b0.95_L8_N128_P16.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching/square_expert_play/tree_square_expert_play_demo_84_t0390_L40best_b0.95_L8_N128_P16_dec.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching/square_expert_play/tree_square_expert_play_demo_84_t0390_L40best_b0.95_L8_N128_P16_dec256.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching/square_expert_play/tree_square_expert_play_demo_84_t0390_L40best_b0.95_L8_N128_P16_r256.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching/two_piece_expert_play/tree_two_piece_expert_play_demo_102_t0198_L40best_b0.95_L8_N128_P16.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching/two_piece_expert_play/tree_two_piece_expert_play_demo_102_t0198_L40best_b0.95_L8_N128_P16_dec.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching/two_piece_expert_play/tree_two_piece_expert_play_demo_102_t0198_L40best_b0.95_L8_N128_P16_dec256.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching/two_piece_expert_play/tree_two_piece_expert_play_demo_102_t0198_L40best_b0.95_L8_N128_P16_r256.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching/two_piece_expert_play/tree_two_piece_expert_play_demo_106_t0035_L40best_b0.95_L8_N128_P16.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching/two_piece_expert_play/tree_two_piece_expert_play_demo_106_t0035_L40best_b0.95_L8_N128_P16_dec.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching/two_piece_expert_play/tree_two_piece_expert_play_demo_106_t0035_L40best_b0.95_L8_N128_P16_dec256.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching/two_piece_expert_play/tree_two_piece_expert_play_demo_106_t0035_L40best_b0.95_L8_N128_P16_r256.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching/two_piece_expert_play/tree_two_piece_expert_play_demo_129_t0084_L40best_b0.95_L8_N128_P16.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching/two_piece_expert_play/tree_two_piece_expert_play_demo_129_t0084_L40best_b0.95_L8_N128_P16_dec.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching/two_piece_expert_play/tree_two_piece_expert_play_demo_129_t0084_L40best_b0.95_L8_N128_P16_dec256.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching/two_piece_expert_play/tree_two_piece_expert_play_demo_129_t0084_L40best_b0.95_L8_N128_P16_r256.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching/two_piece_expert_play/tree_two_piece_expert_play_demo_136_t0154_L40best_b0.95_L8_N128_P16_split256.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching/two_piece_expert_play/tree_two_piece_expert_play_demo_143_t0154_L40best_b0.95_L8_N128_P16.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching/two_piece_expert_play/tree_two_piece_expert_play_demo_143_t0154_L40best_b0.95_L8_N128_P16_dec.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching/two_piece_expert_play/tree_two_piece_expert_play_demo_143_t0154_L40best_b0.95_L8_N128_P16_dec256.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching/two_piece_expert_play/tree_two_piece_expert_play_demo_143_t0154_L40best_b0.95_L8_N128_P16_r256.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching/two_piece_expert_play/tree_two_piece_expert_play_demo_153_t0112_L40best_b0.95_L8_N128_P16_split2b256.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching/two_piece_expert_play/tree_two_piece_expert_play_demo_171_t0244_L40best_b0.95_L8_N128_P16.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching/two_piece_expert_play/tree_two_piece_expert_play_demo_171_t0244_L40best_b0.95_L8_N128_P16_dec.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching/two_piece_expert_play/tree_two_piece_expert_play_demo_171_t0244_L40best_b0.95_L8_N128_P16_dec256.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching/two_piece_expert_play/tree_two_piece_expert_play_demo_171_t0244_L40best_b0.95_L8_N128_P16_r256.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching/two_piece_expert_play/tree_two_piece_expert_play_demo_18_t0096_L40best_b0.95_L8_N128_P16_split256.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching/two_piece_expert_play/tree_two_piece_expert_play_demo_198_t0166_L40best_b0.95_L8_N128_P16_split2b256.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching/two_piece_expert_play/tree_two_piece_expert_play_demo_64_t0192_L40best_b0.95_L8_N128_P16_split2b256.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching/two_piece_expert_play/tree_two_piece_expert_play_demo_6_t0180_L40best_b0.95_L8_N128_P16_split2b256.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching/two_piece_expert_play/tree_two_piece_expert_play_demo_80_t0025_L40best_b0.95_L8_N128_P16_split2b256.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching/two_piece_expert_play/tree_two_piece_expert_play_demo_99_t0057_L40best_b0.95_L8_N128_P16.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching/two_piece_expert_play/tree_two_piece_expert_play_demo_99_t0057_L40best_b0.95_L8_N128_P16_dec.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching/two_piece_expert_play/tree_two_piece_expert_play_demo_99_t0057_L40best_b0.95_L8_N128_P16_dec256.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching/two_piece_expert_play/tree_two_piece_expert_play_demo_99_t0057_L40best_b0.95_L8_N128_P16_r256.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching/two_piece_expert_play_tipping/tree_two_piece_expert_play_tipping_demo_209_t0155_Mbest_b0.95_L8_N128_P16_dec256.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching/two_piece_expert_play_tipping/tree_two_piece_expert_play_tipping_demo_239_t0258_Mbest_b0.95_L8_N128_P16_dec256.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching/two_piece_expert_play_tipping/tree_two_piece_expert_play_tipping_demo_433_t0082_Mbest_b0.95_L8_N128_P16_dec256.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching/two_piece_expert_play_tipping/tree_two_piece_expert_play_tipping_demo_459_t0032_Mbest_b0.95_L8_N128_P16_dec256.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching/two_piece_expert_play_tipping/tree_two_piece_expert_play_tipping_demo_510_t0054_Mbest_b0.95_L8_N128_P16_dec256.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching/two_piece_expert_play_tipping/tree_two_piece_expert_play_tipping_demo_695_t0099_Mbest_b0.95_L8_N128_P16_dec256.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching_chain/square_expert_play/tree_square_expert_play_demo_102_t0145_L40best_b0.95_L34_N128_P16_dec256.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching_chain/square_expert_play/tree_square_expert_play_demo_110_t0104_L40best_b0.95_L34_N128_P16_dec256.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching_chain/square_expert_play/tree_square_expert_play_demo_160_t0165_L40best_b0.95_L34_N128_P16_dec256.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching_chain/square_expert_play/tree_square_expert_play_demo_221_t0249_L40best_b0.95_L34_N128_P16_dec256.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching_chain/square_expert_play/tree_square_expert_play_demo_36_t0056_L40best_b0.95_L34_N128_P16_dec256.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching_chain/square_expert_play/tree_square_expert_play_demo_84_t0390_L40best_b0.95_L34_N128_P16_dec256.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching_chain/two_piece_expert_play/tree_two_piece_expert_play_demo_102_t0198_L40best_b0.95_L34_N128_P16_dec256.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching_chain/two_piece_expert_play/tree_two_piece_expert_play_demo_106_t0035_L40best_b0.95_L34_N128_P16_dec256.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching_chain/two_piece_expert_play/tree_two_piece_expert_play_demo_129_t0084_L40best_b0.95_L34_N128_P16_dec256.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching_chain/two_piece_expert_play/tree_two_piece_expert_play_demo_143_t0154_L40best_b0.95_L34_N128_P16_dec256.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching_chain/two_piece_expert_play/tree_two_piece_expert_play_demo_171_t0244_L40best_b0.95_L34_N128_P16_dec256.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching_chain/two_piece_expert_play/tree_two_piece_expert_play_demo_99_t0057_L40best_b0.95_L34_N128_P16_dec256.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching_chain/two_piece_expert_play_tipping/tree_two_piece_expert_play_tipping_demo_209_t0155_Mbest_b0.95_L34_N128_P16_dec256.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching_chain/two_piece_expert_play_tipping/tree_two_piece_expert_play_tipping_demo_209_t0155_Mbest_b0.95_L34_N128_P16_foldsame.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching_chain/two_piece_expert_play_tipping/tree_two_piece_expert_play_tipping_demo_239_t0258_Mbest_b0.95_L34_N128_P16_dec256.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching_chain/two_piece_expert_play_tipping/tree_two_piece_expert_play_tipping_demo_239_t0258_Mbest_b0.95_L34_N128_P16_foldsame.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching_chain/two_piece_expert_play_tipping/tree_two_piece_expert_play_tipping_demo_433_t0082_Mbest_b0.95_L34_N128_P16_dec256.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching_chain/two_piece_expert_play_tipping/tree_two_piece_expert_play_tipping_demo_433_t0082_Mbest_b0.95_L34_N128_P16_foldsame.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching_chain/two_piece_expert_play_tipping/tree_two_piece_expert_play_tipping_demo_459_t0032_Mbest_b0.95_L34_N128_P16_dec256.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching_chain/two_piece_expert_play_tipping/tree_two_piece_expert_play_tipping_demo_459_t0032_Mbest_b0.95_L34_N128_P16_foldsame.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching_chain/two_piece_expert_play_tipping/tree_two_piece_expert_play_tipping_demo_510_t0054_Mbest_b0.95_L34_N128_P16_dec256.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching_chain/two_piece_expert_play_tipping/tree_two_piece_expert_play_tipping_demo_510_t0054_Mbest_b0.95_L34_N128_P16_foldsame.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching_chain/two_piece_expert_play_tipping/tree_two_piece_expert_play_tipping_demo_695_t0099_Mbest_b0.95_L34_N128_P16_dec256.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/figs/stitching_chain/two_piece_expert_play_tipping/tree_two_piece_expert_play_tipping_demo_695_t0099_Mbest_b0.95_L34_N128_P16_foldsame.png filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/real_proposal_report.pdf filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/real_reward_study.pdf filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/tex/flagship_paper.pdf filter=lfs diff=lfs merge=lfs -textgen_q_rsm/rsm_rise/pipeline/docs/tex/flagship_tables_latest.pdf filter=lfs diff=lfs merge=lfs -text
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122{ "method": "genq_reward_latent", "env": "visual-pointmaze-medium-navigate-v0", "seed": 0, "wandb_url": null, "representation": "image_reward_predictive_latent", "occ_model": "diffusion", "z_dim": 8, "reward": "dense", "truth_kind": "fresh_rollout", "gen_sample_counts": [ 1, 2, 4, 8, 16, 32, 64, 128, 256 ], "train/loss": [ 1.023522973060608, 0.19105927646160126, 0.1606016755104065, 0.18757879734039307, 0.18000784516334534, 0.13725411891937256, 0.14592890441417694, 0.14458250999450684, 0.13206292688846588, 0.13802334666252136, 0.1301162838935852, 0.16003751754760742, 0.1559370756149292, 0.13223066926002502, 0.15051677823066711, 0.12414824962615967, 0.14838171005249023, 0.1357429176568985, 0.12985064089298248, 0.13411641120910645, 0.13461871445178986, 0.1175081878900528, 0.15497374534606934, 0.1391388177871704, 0.12791691720485687, 0.14376839995384216, 0.12200479209423065, 0.1354222595691681, 0.12789097428321838, 0.1462569534778595, 0.11730469018220901, 0.13860100507736206, 0.12506838142871857, 0.14251679182052612, 0.15122273564338684, 0.12967534363269806, 0.11680444329977036, 0.13652893900871277, 0.11743645370006561, 0.12052425742149353, 0.12437745928764343, 0.13077199459075928, 0.11803334951400757, 0.14000144600868225, 0.12209025770425797, 0.13256481289863586, 0.11510388553142548, 0.11319650709629059, 0.13896140456199646, 0.13421301543712616, 0.1303102672100067 ], "train/q_mse": [ 0.02418842547168858 ], "latent/reward_mse": 0.0004603317065630108, "eval/q_mse": 0.02418842547168858, "eval/q_mae": 0.11661465483356177, "eval/q_corr": 0.7688938001942438, "eval/q_spearman": 0.7925993287458046, "eval/q_mse_by_n": { "1": 0.10427708295616979, "2": 0.05951837038308591, "4": 0.042929799724609516, "8": 0.03615196083966341, "16": 0.027244554452114746, "32": 0.026974146359083698, "64": 0.02428700414242801, "128": 0.024489868299928785, "256": 0.024278866972587534 }, "eval/q_corr_by_n": { "1": 0.4259941946101464, "2": 0.5729064749947367, "4": 0.653214372303005, "8": 0.6969564579575995, "16": 0.7326162891774732, "32": 0.7516596854054147, "64": 0.7608004812015723, "128": 0.7657684814654997, "256": 0.7693020782172023 }, "eval/q_mse_vs_N": [ 0.10427708295616979, 0.05951837038308591, 0.042929799724609516, 0.03615196083966341, 0.027244554452114746, 0.026974146359083698, 0.02428700414242801, 0.024489868299928785, 0.024278866972587534 ], "eval/N_final": 256, "eval/truth_std": 0.17342706411927783, "wall_clock_s": 211.27295351028442, "n_anchors": 400, "anchor_protocol": "dataset_anchor", "dataset_note": "self_rendered_from_state_pointmaze (no OGBench visual-pointmaze exists)"}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124{ "method": "mc", "env": "visual-pointmaze-medium-navigate-v0", "seed": 0, "wandb_url": null, "representation": "ant_state_29d", "reward": "dense", "truth_kind": "fresh_rollout", "train/loss": [ 0.300428181886673, 0.02267445996403694, 0.0215071402490139, 0.02142311818897724, 0.028002843260765076, 0.020109882578253746, 0.020046889781951904, 0.02153805084526539, 0.018007999286055565, 0.01716446503996849, 0.01681779883801937, 0.017358364537358284, 0.02150731161236763, 0.018860554322600365, 0.020630372688174248, 0.01959878019988537, 0.018222834914922714, 0.017338993027806282, 0.01767083629965782, 0.01721610687673092, 0.016842637211084366, 0.01914386823773384, 0.015379784628748894, 0.01741034723818302, 0.018324950709939003, 0.015394306741654873, 0.01669416017830372, 0.01766800507903099, 0.01653364673256874, 0.015180330723524094, 0.015547486953437328, 0.013367079198360443, 0.015776604413986206, 0.015588213689625263, 0.014996509999036789, 0.015366061590611935, 0.01568116620182991, 0.015002715401351452, 0.016817599534988403, 0.018457632511854172, 0.013548828661441803, 0.015665411949157715, 0.013671178370714188, 0.016047248616814613, 0.01627308875322342, 0.013607887551188469, 0.017151955515146255, 0.015409056097269058, 0.01558898389339447, 0.012062326073646545, 0.015025422908365726 ], "train/q_mse": [ 0.300428181886673, 0.02267445996403694, 0.0215071402490139, 0.02142311818897724, 0.028002843260765076, 0.020109882578253746, 0.020046889781951904, 0.02153805084526539, 0.018007999286055565, 0.01716446503996849, 0.01681779883801937, 0.017358364537358284, 0.02150731161236763, 0.018860554322600365, 0.020630372688174248, 0.01959878019988537, 0.018222834914922714, 0.017338993027806282, 0.01767083629965782, 0.01721610687673092, 0.016842637211084366, 0.01914386823773384, 0.015379784628748894, 0.01741034723818302, 0.018324950709939003, 0.015394306741654873, 0.01669416017830372, 0.01766800507903099, 0.01653364673256874, 0.015180330723524094, 0.015547486953437328, 0.013367079198360443, 0.015776604413986206, 0.015588213689625263, 0.014996509999036789, 0.015366061590611935, 0.01568116620182991, 0.015002715401351452, 0.016817599534988403, 0.018457632511854172, 0.013548828661441803, 0.015665411949157715, 0.013671178370714188, 0.016047248616814613, 0.01627308875322342, 0.013607887551188469, 0.017151955515146255, 0.015409056097269058, 0.01558898389339447, 0.012062326073646545, 0.015025422908365726 ], "eval/q_mse": 0.02082740504568421, "eval/q_mae": 0.09879234870651768, "eval/q_corr": 0.8353318666663025, "eval/q_spearman": 0.8860669754185964, "eval/truth_std": 0.17342706411927783, "wall_clock_s": 51.000584840774536, "n_anchors": 400, "anchor_protocol": "dataset_anchor", "dataset_note": "self_rendered_from_state_pointmaze (no OGBench visual-pointmaze exists)"}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124{ "method": "td", "env": "visual-pointmaze-medium-navigate-v0", "seed": 0, "wandb_url": null, "representation": "ant_state_29d", "reward": "dense", "truth_kind": "fresh_rollout", "train/loss": [ 0.12668415904045105, 1.8332171748625115e-05, 1.2668673662119545e-05, 5.6685854360694066e-05, 2.666049294930417e-05, 0.00012213226000312716, 1.2408975635480601e-05, 7.281507714651525e-05, 1.4251440006773919e-05, 2.8672966436715797e-05, 1.9756591427722014e-05, 1.800885183911305e-05, 2.9631743018398993e-05, 2.119257078447845e-05, 2.3705892090220004e-05, 3.014030517078936e-05, 5.9920595958828926e-05, 3.7254212656989694e-05, 0.0001071523511200212, 5.2011237130500376e-05, 3.0067789339227602e-05, 1.841087214415893e-05, 3.670252408483066e-05, 3.926284261979163e-05, 3.8311438402161e-05, 6.802458665333688e-05, 7.342189201153815e-05, 0.0001920453505590558, 4.1177685488946736e-05, 4.1980551031883806e-05, 0.00010299332643626258, 4.048525806865655e-05, 0.00014721110346727073, 4.002904461231083e-05, 0.00011492889461806044, 5.7826000556815416e-05, 5.0739210564643145e-05, 2.990572465932928e-05, 6.57828277326189e-05, 4.4449054257711396e-05, 9.90485496004112e-05, 6.106894579716027e-05, 3.74849587387871e-05, 4.809353413293138e-05, 8.4279352449812e-05, 9.354538633488119e-05, 3.541153637343086e-05, 4.724852624349296e-05, 3.650022699730471e-05, 6.568254320882261e-05, 6.494991248473525e-05 ], "train/q_mse": [ 0.12668415904045105, 1.8332171748625115e-05, 1.2668673662119545e-05, 5.6685854360694066e-05, 2.666049294930417e-05, 0.00012213226000312716, 1.2408975635480601e-05, 7.281507714651525e-05, 1.4251440006773919e-05, 2.8672966436715797e-05, 1.9756591427722014e-05, 1.800885183911305e-05, 2.9631743018398993e-05, 2.119257078447845e-05, 2.3705892090220004e-05, 3.014030517078936e-05, 5.9920595958828926e-05, 3.7254212656989694e-05, 0.0001071523511200212, 5.2011237130500376e-05, 3.0067789339227602e-05, 1.841087214415893e-05, 3.670252408483066e-05, 3.926284261979163e-05, 3.8311438402161e-05, 6.802458665333688e-05, 7.342189201153815e-05, 0.0001920453505590558, 4.1177685488946736e-05, 4.1980551031883806e-05, 0.00010299332643626258, 4.048525806865655e-05, 0.00014721110346727073, 4.002904461231083e-05, 0.00011492889461806044, 5.7826000556815416e-05, 5.0739210564643145e-05, 2.990572465932928e-05, 6.57828277326189e-05, 4.4449054257711396e-05, 9.90485496004112e-05, 6.106894579716027e-05, 3.74849587387871e-05, 4.809353413293138e-05, 8.4279352449812e-05, 9.354538633488119e-05, 3.541153637343086e-05, 4.724852624349296e-05, 3.650022699730471e-05, 6.568254320882261e-05, 6.494991248473525e-05 ], "eval/q_mse": 0.047415442621615254, "eval/q_mae": 0.17140060018722703, "eval/q_corr": 0.6945215405391422, "eval/q_spearman": 0.7104207526297038, "eval/truth_std": 0.17342706411927783, "wall_clock_s": 128.8499734401703, "n_anchors": 400, "anchor_protocol": "dataset_anchor", "dataset_note": "self_rendered_from_state_pointmaze (no OGBench visual-pointmaze exists)"}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122{ "method": "genq_reward_latent", "env": "visual-pointmaze-medium-navigate-v0", "seed": 1, "wandb_url": null, "representation": "image_reward_predictive_latent", "occ_model": "diffusion", "z_dim": 8, "reward": "dense", "truth_kind": "fresh_rollout", "gen_sample_counts": [ 1, 2, 4, 8, 16, 32, 64, 128, 256 ], "train/loss": [ 0.9809990525245667, 0.17933084070682526, 0.16511279344558716, 0.1322927176952362, 0.1478947550058365, 0.13946112990379333, 0.15920886397361755, 0.14355158805847168, 0.12853004038333893, 0.12848305702209473, 0.1428503841161728, 0.13594722747802734, 0.12514980137348175, 0.12934759259223938, 0.14530916512012482, 0.1301221251487732, 0.13413327932357788, 0.1347767412662506, 0.1427159607410431, 0.13929331302642822, 0.14646552503108978, 0.1483486294746399, 0.15737994015216827, 0.1122862696647644, 0.11022555083036423, 0.10935921221971512, 0.1225469708442688, 0.13203954696655273, 0.13515713810920715, 0.11667963862419128, 0.11377006769180298, 0.13136602938175201, 0.12783783674240112, 0.12338382005691528, 0.12003913521766663, 0.10868240147829056, 0.11822055280208588, 0.12240321189165115, 0.1288052499294281, 0.13882607221603394, 0.124045729637146, 0.14778918027877808, 0.12555858492851257, 0.10658851265907288, 0.11684204638004303, 0.11461761593818665, 0.12805622816085815, 0.11907884478569031, 0.1175164133310318, 0.12526899576187134, 0.12224960327148438 ], "train/q_mse": [ 0.034146342858883016 ], "latent/reward_mse": 0.00025965768145397305, "eval/q_mse": 0.034146342858883016, "eval/q_mae": 0.14120046044467233, "eval/q_corr": 0.841380566438283, "eval/q_spearman": 0.8576217351358445, "eval/q_mse_by_n": { "1": 0.10166398215520857, "2": 0.06788726373972398, "4": 0.05383199234810165, "8": 0.042872705614016536, "16": 0.04083606126413326, "32": 0.03533675406431094, "64": 0.03641804118495191, "128": 0.03474232110105016, "256": 0.03467494483447413 }, "eval/q_corr_by_n": { "1": 0.5432091431547831, "2": 0.6889803738721912, "4": 0.7474373967836503, "8": 0.7723009237960272, "16": 0.8134244967202252, "32": 0.8309243589671356, "64": 0.8304903471946687, "128": 0.8355637822877324, "256": 0.8395095947416329 }, "eval/q_mse_vs_N": [ 0.10166398215520857, 0.06788726373972398, 0.05383199234810165, 0.042872705614016536, 0.04083606126413326, 0.03533675406431094, 0.03641804118495191, 0.03474232110105016, 0.03467494483447413 ], "eval/N_final": 256, "eval/truth_std": 0.16826422062875934, "wall_clock_s": 190.27805066108704, "n_anchors": 400, "anchor_protocol": "dataset_anchor", "dataset_note": "self_rendered_from_state_pointmaze (no OGBench visual-pointmaze exists)"}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124{ "method": "mc", "env": "visual-pointmaze-medium-navigate-v0", "seed": 1, "wandb_url": null, "representation": "ant_state_29d", "reward": "dense", "truth_kind": "fresh_rollout", "train/loss": [ 0.7778210639953613, 0.02339986339211464, 0.023852061480283737, 0.02484820783138275, 0.020530669018626213, 0.020015805959701538, 0.02033216878771782, 0.020929066464304924, 0.02100355550646782, 0.018495939671993256, 0.016828354448080063, 0.018103748559951782, 0.015990406274795532, 0.015134772285819054, 0.017066648229956627, 0.019263707101345062, 0.01830333098769188, 0.016004566103219986, 0.01835515722632408, 0.018100393936038017, 0.016789056360721588, 0.01756531558930874, 0.017896192148327827, 0.019197577610611916, 0.01762261986732483, 0.01672225259244442, 0.016293030232191086, 0.015451420098543167, 0.01821363903582096, 0.015113407745957375, 0.017661530524492264, 0.017328113317489624, 0.017640316858887672, 0.018558043986558914, 0.015614695847034454, 0.017359744757413864, 0.014327095821499825, 0.019603803753852844, 0.01634526252746582, 0.01730777695775032, 0.015174825675785542, 0.016079675406217575, 0.018623583018779755, 0.016195299103856087, 0.014258256182074547, 0.012366688810288906, 0.012679745443165302, 0.015978572890162468, 0.01520790345966816, 0.013839712366461754, 0.0132619459182024 ], "train/q_mse": [ 0.7778210639953613, 0.02339986339211464, 0.023852061480283737, 0.02484820783138275, 0.020530669018626213, 0.020015805959701538, 0.02033216878771782, 0.020929066464304924, 0.02100355550646782, 0.018495939671993256, 0.016828354448080063, 0.018103748559951782, 0.015990406274795532, 0.015134772285819054, 0.017066648229956627, 0.019263707101345062, 0.01830333098769188, 0.016004566103219986, 0.01835515722632408, 0.018100393936038017, 0.016789056360721588, 0.01756531558930874, 0.017896192148327827, 0.019197577610611916, 0.01762261986732483, 0.01672225259244442, 0.016293030232191086, 0.015451420098543167, 0.01821363903582096, 0.015113407745957375, 0.017661530524492264, 0.017328113317489624, 0.017640316858887672, 0.018558043986558914, 0.015614695847034454, 0.017359744757413864, 0.014327095821499825, 0.019603803753852844, 0.01634526252746582, 0.01730777695775032, 0.015174825675785542, 0.016079675406217575, 0.018623583018779755, 0.016195299103856087, 0.014258256182074547, 0.012366688810288906, 0.012679745443165302, 0.015978572890162468, 0.01520790345966816, 0.013839712366461754, 0.0132619459182024 ], "eval/q_mse": 0.02434390918869931, "eval/q_mae": 0.10471990462915841, "eval/q_corr": 0.8223561782154234, "eval/q_spearman": 0.8820593253707835, "eval/truth_std": 0.16826422062875934, "wall_clock_s": 82.57715368270874, "n_anchors": 400, "anchor_protocol": "dataset_anchor", "dataset_note": "self_rendered_from_state_pointmaze (no OGBench visual-pointmaze exists)"}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124{ "method": "td", "env": "visual-pointmaze-medium-navigate-v0", "seed": 1, "wandb_url": null, "representation": "ant_state_29d", "reward": "dense", "truth_kind": "fresh_rollout", "train/loss": [ 0.08922570943832397, 2.3586251700180583e-05, 3.551862755557522e-05, 0.00023087025329004973, 4.25379621447064e-05, 3.934617416234687e-05, 0.00012464394967537373, 3.5465072869556025e-05, 1.847404746513348e-05, 5.548719491343945e-05, 0.00011864618863910437, 3.941592149203643e-05, 5.4817210184410214e-05, 0.0001261690049432218, 6.886602204758674e-05, 4.5921126002212986e-05, 0.00026340721524320543, 3.491710958769545e-05, 6.15324461250566e-05, 3.6591445677913725e-05, 4.809158053831197e-05, 3.477423160802573e-05, 3.493107942631468e-05, 8.450048335362226e-05, 5.450391472550109e-05, 0.0003894520632456988, 0.00010916698374785483, 4.6757017116760835e-05, 4.382079350762069e-05, 6.6999280534219e-05, 4.934016760671511e-05, 5.072278145235032e-05, 4.0917060687206686e-05, 7.26800863048993e-05, 9.916475391946733e-05, 5.48424432054162e-05, 0.00011761068890336901, 8.198009163606912e-05, 8.76081467140466e-05, 5.357425834517926e-05, 7.92598002590239e-05, 0.00025363703025504947, 6.0045160353183746e-05, 4.806789002032019e-05, 5.262159538688138e-05, 5.703686474589631e-05, 0.0001106592026189901, 9.103187767323107e-05, 5.136866093380377e-05, 0.0001198111058329232, 5.662136391038075e-05 ], "train/q_mse": [ 0.08922570943832397, 2.3586251700180583e-05, 3.551862755557522e-05, 0.00023087025329004973, 4.25379621447064e-05, 3.934617416234687e-05, 0.00012464394967537373, 3.5465072869556025e-05, 1.847404746513348e-05, 5.548719491343945e-05, 0.00011864618863910437, 3.941592149203643e-05, 5.4817210184410214e-05, 0.0001261690049432218, 6.886602204758674e-05, 4.5921126002212986e-05, 0.00026340721524320543, 3.491710958769545e-05, 6.15324461250566e-05, 3.6591445677913725e-05, 4.809158053831197e-05, 3.477423160802573e-05, 3.493107942631468e-05, 8.450048335362226e-05, 5.450391472550109e-05, 0.0003894520632456988, 0.00010916698374785483, 4.6757017116760835e-05, 4.382079350762069e-05, 6.6999280534219e-05, 4.934016760671511e-05, 5.072278145235032e-05, 4.0917060687206686e-05, 7.26800863048993e-05, 9.916475391946733e-05, 5.48424432054162e-05, 0.00011761068890336901, 8.198009163606912e-05, 8.76081467140466e-05, 5.357425834517926e-05, 7.92598002590239e-05, 0.00025363703025504947, 6.0045160353183746e-05, 4.806789002032019e-05, 5.262159538688138e-05, 5.703686474589631e-05, 0.0001106592026189901, 9.103187767323107e-05, 5.136866093380377e-05, 0.0001198111058329232, 5.662136391038075e-05 ], "eval/q_mse": 0.046722826478564225, "eval/q_mae": 0.18053077077449248, "eval/q_corr": 0.6928299200693895, "eval/q_spearman": 0.6980194251214069, "eval/truth_std": 0.16826422062875934, "wall_clock_s": 135.48422956466675, "n_anchors": 400, "anchor_protocol": "dataset_anchor", "dataset_note": "self_rendered_from_state_pointmaze (no OGBench visual-pointmaze exists)"}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122{ "method": "genq_reward_latent", "env": "visual-pointmaze-medium-navigate-v0", "seed": 2, "wandb_url": null, "representation": "image_reward_predictive_latent", "occ_model": "diffusion", "z_dim": 8, "reward": "dense", "truth_kind": "fresh_rollout", "gen_sample_counts": [ 1, 2, 4, 8, 16, 32, 64, 128, 256 ], "train/loss": [ 1.024316668510437, 0.1793454885482788, 0.15517249703407288, 0.1340932697057724, 0.13335293531417847, 0.13150489330291748, 0.13454917073249817, 0.14695987105369568, 0.13363848626613617, 0.12148027122020721, 0.12004993110895157, 0.15736988186836243, 0.12241700291633606, 0.12524090707302094, 0.12828771770000458, 0.1318449079990387, 0.15014547109603882, 0.12478946149349213, 0.12095083296298981, 0.13287462294101715, 0.11742374300956726, 0.13670894503593445, 0.14853531122207642, 0.1266043484210968, 0.14328953623771667, 0.12064675986766815, 0.13112778961658478, 0.11093735694885254, 0.12830224633216858, 0.13057976961135864, 0.10531724989414215, 0.13120026886463165, 0.13122409582138062, 0.12979282438755035, 0.10491982102394104, 0.12394106388092041, 0.13706372678279877, 0.13685330748558044, 0.12740539014339447, 0.11308732628822327, 0.1389036774635315, 0.13147905468940735, 0.11338790506124496, 0.11925211548805237, 0.13030390441417694, 0.11573618650436401, 0.11731089651584625, 0.12009034305810928, 0.12889808416366577, 0.10449075698852539, 0.11116305738687515 ], "train/q_mse": [ 0.024432747446616034 ], "latent/reward_mse": 0.0002573542296886444, "eval/q_mse": 0.024432747446616034, "eval/q_mae": 0.11475445740433432, "eval/q_corr": 0.8041591442347077, "eval/q_spearman": 0.8449954062212889, "eval/q_mse_by_n": { "1": 0.0998142523482076, "2": 0.07049776675502882, "4": 0.042721090125311195, "8": 0.037813734067507834, "16": 0.026469064864782607, "32": 0.026449487809399503, "64": 0.02434675654013557, "128": 0.02408864906773499, "256": 0.024358060718852038 }, "eval/q_corr_by_n": { "1": 0.4527950314830981, "2": 0.5788944407145811, "4": 0.6266348581722568, "8": 0.7055368038021134, "16": 0.7794822560595883, "32": 0.7870327906012677, "64": 0.7987446807160185, "128": 0.80674082562435, "256": 0.8059638740570279 }, "eval/q_mse_vs_N": [ 0.0998142523482076, 0.07049776675502882, 0.042721090125311195, 0.037813734067507834, 0.026469064864782607, 0.026449487809399503, 0.02434675654013557, 0.02408864906773499, 0.024358060718852038 ], "eval/N_final": 256, "eval/truth_std": 0.17654507489690366, "wall_clock_s": 190.1649649143219, "n_anchors": 400, "anchor_protocol": "dataset_anchor", "dataset_note": "self_rendered_from_state_pointmaze (no OGBench visual-pointmaze exists)"}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124{ "method": "mc", "env": "visual-pointmaze-medium-navigate-v0", "seed": 2, "wandb_url": null, "representation": "ant_state_29d", "reward": "dense", "truth_kind": "fresh_rollout", "train/loss": [ 0.4429917633533478, 0.022357996553182602, 0.023187624290585518, 0.021833859384059906, 0.0202195905148983, 0.019669605419039726, 0.017073694616556168, 0.020152775570750237, 0.01691555790603161, 0.01923917606472969, 0.016583403572440147, 0.018169526010751724, 0.017124615609645844, 0.01890822872519493, 0.02017965354025364, 0.019468169659376144, 0.02015000954270363, 0.017852913588285446, 0.016369212418794632, 0.017571432515978813, 0.016337791457772255, 0.016603713855147362, 0.015020797029137611, 0.016736339777708054, 0.015627248212695122, 0.013909053057432175, 0.01728198677301407, 0.02094826102256775, 0.016746126115322113, 0.017170626670122147, 0.017031293362379074, 0.016752181574702263, 0.016802242025732994, 0.020353741943836212, 0.014388898387551308, 0.015708858147263527, 0.017150770872831345, 0.015197831206023693, 0.015437373891472816, 0.017017479985952377, 0.013739853166043758, 0.01366988755762577, 0.015335265547037125, 0.01730331778526306, 0.014708343893289566, 0.01554938592016697, 0.01459048967808485, 0.012942909263074398, 0.015236981213092804, 0.01549330074340105, 0.013740262016654015 ], "train/q_mse": [ 0.4429917633533478, 0.022357996553182602, 0.023187624290585518, 0.021833859384059906, 0.0202195905148983, 0.019669605419039726, 0.017073694616556168, 0.020152775570750237, 0.01691555790603161, 0.01923917606472969, 0.016583403572440147, 0.018169526010751724, 0.017124615609645844, 0.01890822872519493, 0.02017965354025364, 0.019468169659376144, 0.02015000954270363, 0.017852913588285446, 0.016369212418794632, 0.017571432515978813, 0.016337791457772255, 0.016603713855147362, 0.015020797029137611, 0.016736339777708054, 0.015627248212695122, 0.013909053057432175, 0.01728198677301407, 0.02094826102256775, 0.016746126115322113, 0.017170626670122147, 0.017031293362379074, 0.016752181574702263, 0.016802242025732994, 0.020353741943836212, 0.014388898387551308, 0.015708858147263527, 0.017150770872831345, 0.015197831206023693, 0.015437373891472816, 0.017017479985952377, 0.013739853166043758, 0.01366988755762577, 0.015335265547037125, 0.01730331778526306, 0.014708343893289566, 0.01554938592016697, 0.01459048967808485, 0.012942909263074398, 0.015236981213092804, 0.01549330074340105, 0.013740262016654015 ], "eval/q_mse": 0.028572852573103207, "eval/q_mae": 0.1124454424148431, "eval/q_corr": 0.8065496786031818, "eval/q_spearman": 0.8727120169501059, "eval/truth_std": 0.17654507489690366, "wall_clock_s": 72.24020314216614, "n_anchors": 400, "anchor_protocol": "dataset_anchor", "dataset_note": "self_rendered_from_state_pointmaze (no OGBench visual-pointmaze exists)"}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124{ "method": "td", "env": "visual-pointmaze-medium-navigate-v0", "seed": 2, "wandb_url": null, "representation": "ant_state_29d", "reward": "dense", "truth_kind": "fresh_rollout", "train/loss": [ 0.12534111738204956, 1.9910268747480586e-05, 1.6004145436454564e-05, 4.661513230530545e-05, 0.0003531512338668108, 3.990440018242225e-05, 5.7517652749083936e-05, 2.0071815015398897e-05, 1.9873396013281308e-05, 1.5575658835587092e-05, 5.665469143423252e-05, 9.225113899447024e-05, 3.0335413612192497e-05, 5.0036567699862644e-05, 5.527953544515185e-05, 4.24383906647563e-05, 3.107404336333275e-05, 8.414429612457752e-05, 3.052110696444288e-05, 3.6292054574005306e-05, 8.18166954559274e-05, 8.938631799537688e-05, 6.787099118810147e-05, 7.867449312470853e-05, 0.00014428363647311926, 4.576490755425766e-05, 3.0030154448468238e-05, 2.6521336621954106e-05, 5.1336428441572934e-05, 9.244908869732171e-05, 6.353151547955349e-05, 4.4155141949886456e-05, 0.0001034806773532182, 7.633137283846736e-05, 0.00010885050141951069, 0.00014073187776375562, 9.10240487428382e-05, 0.00021795034990645945, 8.466524013783783e-05, 0.00012538922601379454, 7.03674741089344e-05, 4.6943401684984565e-05, 5.272848284221254e-05, 4.764578989124857e-05, 9.951114770956337e-05, 8.630350203020498e-05, 0.00010707996261771768, 0.00011547016765689477, 5.236967990640551e-05, 0.00011771705612773076, 6.523892807308584e-05 ], "train/q_mse": [ 0.12534111738204956, 1.9910268747480586e-05, 1.6004145436454564e-05, 4.661513230530545e-05, 0.0003531512338668108, 3.990440018242225e-05, 5.7517652749083936e-05, 2.0071815015398897e-05, 1.9873396013281308e-05, 1.5575658835587092e-05, 5.665469143423252e-05, 9.225113899447024e-05, 3.0335413612192497e-05, 5.0036567699862644e-05, 5.527953544515185e-05, 4.24383906647563e-05, 3.107404336333275e-05, 8.414429612457752e-05, 3.052110696444288e-05, 3.6292054574005306e-05, 8.18166954559274e-05, 8.938631799537688e-05, 6.787099118810147e-05, 7.867449312470853e-05, 0.00014428363647311926, 4.576490755425766e-05, 3.0030154448468238e-05, 2.6521336621954106e-05, 5.1336428441572934e-05, 9.244908869732171e-05, 6.353151547955349e-05, 4.4155141949886456e-05, 0.0001034806773532182, 7.633137283846736e-05, 0.00010885050141951069, 0.00014073187776375562, 9.10240487428382e-05, 0.00021795034990645945, 8.466524013783783e-05, 0.00012538922601379454, 7.03674741089344e-05, 4.6943401684984565e-05, 5.272848284221254e-05, 4.764578989124857e-05, 9.951114770956337e-05, 8.630350203020498e-05, 0.00010707996261771768, 0.00011547016765689477, 5.236967990640551e-05, 0.00011771705612773076, 6.523892807308584e-05 ], "eval/q_mse": 0.04703190033019146, "eval/q_mae": 0.17782433999639735, "eval/q_corr": 0.6880166747998998, "eval/q_spearman": 0.7019134494590591, "eval/truth_std": 0.17654507489690366, "wall_clock_s": 173.68622732162476, "n_anchors": 400, "anchor_protocol": "dataset_anchor", "dataset_note": "self_rendered_from_state_pointmaze (no OGBench visual-pointmaze exists)"}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122{ "method": "genq_reward_latent", "env": "visual-pointmaze-medium-navigate-v0", "seed": 3, "wandb_url": null, "representation": "image_reward_predictive_latent", "occ_model": "diffusion", "z_dim": 8, "reward": "dense", "truth_kind": "fresh_rollout", "gen_sample_counts": [ 1, 2, 4, 8, 16, 32, 64, 128, 256 ], "train/loss": [ 0.9786122441291809, 0.1813828945159912, 0.16335684061050415, 0.15657462179660797, 0.14482948184013367, 0.15136945247650146, 0.1602517068386078, 0.14487171173095703, 0.1275518387556076, 0.14118008315563202, 0.13817457854747772, 0.1265709549188614, 0.14510628581047058, 0.1097148209810257, 0.12812486290931702, 0.11592552810907364, 0.14503419399261475, 0.11103656888008118, 0.13784858584403992, 0.10638585686683655, 0.12266869097948074, 0.13578736782073975, 0.11891372501850128, 0.11895227432250977, 0.12104280292987823, 0.11480166018009186, 0.10633327066898346, 0.13845336437225342, 0.10790373384952545, 0.11080335080623627, 0.12742257118225098, 0.10211851447820663, 0.1400298923254013, 0.12587080895900726, 0.1037636399269104, 0.11045695096254349, 0.12478771060705185, 0.11771151423454285, 0.14330628514289856, 0.11053226888179779, 0.11037909984588623, 0.12294399738311768, 0.1331074982881546, 0.11681242287158966, 0.1415989100933075, 0.12663546204566956, 0.10575957596302032, 0.10996787250041962, 0.11652432382106781, 0.1042134165763855, 0.11657209694385529 ], "train/q_mse": [ 0.03261971514659783 ], "latent/reward_mse": 0.00018257884948980063, "eval/q_mse": 0.03261971514659783, "eval/q_mae": 0.13390268875282402, "eval/q_corr": 0.7574858238002674, "eval/q_spearman": 0.8033770836067724, "eval/q_mse_by_n": { "1": 0.11800017661099597, "2": 0.06831705131717261, "4": 0.049247032290697046, "8": 0.04359604283427686, "16": 0.03706276048290737, "32": 0.03516112533392767, "64": 0.03321869847703921, "128": 0.03189653154641794, "256": 0.03161514213291374 }, "eval/q_corr_by_n": { "1": 0.4650659249309307, "2": 0.567179225609397, "4": 0.613312688133767, "8": 0.6924841970155693, "16": 0.7218435078278452, "32": 0.7363646775038664, "64": 0.7393515761838985, "128": 0.752980012927233, "256": 0.7597189862536244 }, "eval/q_mse_vs_N": [ 0.11800017661099597, 0.06831705131717261, 0.049247032290697046, 0.04359604283427686, 0.03706276048290737, 0.03516112533392767, 0.03321869847703921, 0.03189653154641794, 0.03161514213291374 ], "eval/N_final": 256, "eval/truth_std": 0.1676409617116019, "wall_clock_s": 214.69173336029053, "n_anchors": 400, "anchor_protocol": "dataset_anchor", "dataset_note": "self_rendered_from_state_pointmaze (no OGBench visual-pointmaze exists)"}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124{ "method": "mc", "env": "visual-pointmaze-medium-navigate-v0", "seed": 3, "wandb_url": null, "representation": "ant_state_29d", "reward": "dense", "truth_kind": "fresh_rollout", "train/loss": [ 0.11427582055330276, 0.025900479406118393, 0.02182270586490631, 0.018609585240483284, 0.02048398181796074, 0.02097250521183014, 0.019679706543684006, 0.01927187666296959, 0.016564100980758667, 0.02113707736134529, 0.01816052943468094, 0.01731155999004841, 0.01948174461722374, 0.01947575993835926, 0.020028414204716682, 0.017292534932494164, 0.018862828612327576, 0.0204632505774498, 0.017529692500829697, 0.01708166114985943, 0.01849568821489811, 0.01659216359257698, 0.01689644157886505, 0.01867891661822796, 0.018060501664876938, 0.018033597618341446, 0.017130481079220772, 0.014515886083245277, 0.01813732273876667, 0.01816505566239357, 0.01644013077020645, 0.019669361412525177, 0.016517076641321182, 0.01640458032488823, 0.017151495441794395, 0.019820772111415863, 0.017135582864284515, 0.015625646337866783, 0.015960179269313812, 0.01435169205069542, 0.015589943155646324, 0.019253745675086975, 0.014245660975575447, 0.015107457526028156, 0.015367028303444386, 0.015443369746208191, 0.016586344689130783, 0.012922870926558971, 0.015143996104598045, 0.014632021076977253, 0.017257817089557648 ], "train/q_mse": [ 0.11427582055330276, 0.025900479406118393, 0.02182270586490631, 0.018609585240483284, 0.02048398181796074, 0.02097250521183014, 0.019679706543684006, 0.01927187666296959, 0.016564100980758667, 0.02113707736134529, 0.01816052943468094, 0.01731155999004841, 0.01948174461722374, 0.01947575993835926, 0.020028414204716682, 0.017292534932494164, 0.018862828612327576, 0.0204632505774498, 0.017529692500829697, 0.01708166114985943, 0.01849568821489811, 0.01659216359257698, 0.01689644157886505, 0.01867891661822796, 0.018060501664876938, 0.018033597618341446, 0.017130481079220772, 0.014515886083245277, 0.01813732273876667, 0.01816505566239357, 0.01644013077020645, 0.019669361412525177, 0.016517076641321182, 0.01640458032488823, 0.017151495441794395, 0.019820772111415863, 0.017135582864284515, 0.015625646337866783, 0.015960179269313812, 0.01435169205069542, 0.015589943155646324, 0.019253745675086975, 0.014245660975575447, 0.015107457526028156, 0.015367028303444386, 0.015443369746208191, 0.016586344689130783, 0.012922870926558971, 0.015143996104598045, 0.014632021076977253, 0.017257817089557648 ], "eval/q_mse": 0.03152841940559754, "eval/q_mae": 0.11649606934512256, "eval/q_corr": 0.7776767608263415, "eval/q_spearman": 0.8543777773611083, "eval/truth_std": 0.1676409617116019, "wall_clock_s": 75.966548204422, "n_anchors": 400, "anchor_protocol": "dataset_anchor", "dataset_note": "self_rendered_from_state_pointmaze (no OGBench visual-pointmaze exists)"}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124{ "method": "td", "env": "visual-pointmaze-medium-navigate-v0", "seed": 3, "wandb_url": null, "representation": "ant_state_29d", "reward": "dense", "truth_kind": "fresh_rollout", "train/loss": [ 0.13432824611663818, 2.9250650186440907e-05, 2.1772801119368523e-05, 1.998736843233928e-05, 0.0001087924829334952, 4.3424755858723074e-05, 3.897686838172376e-05, 2.1876137907383963e-05, 7.836107397451997e-05, 1.8753249605651945e-05, 0.00012637728650588542, 3.2191601349040866e-05, 6.535898137371987e-05, 7.396026194328442e-05, 2.215734639321454e-05, 4.957913915859535e-05, 0.00018714769976213574, 0.00010593638580758125, 2.382395541644655e-05, 2.576542647148017e-05, 2.5808321879594587e-05, 7.161621761042625e-05, 5.069085455033928e-05, 9.0986599388998e-05, 8.170856744982302e-05, 3.36167577188462e-05, 6.0377988120308146e-05, 4.2951814975822344e-05, 0.00010280728747602552, 8.601638546679169e-05, 0.00011885826097568497, 4.1312734538223594e-05, 6.003670932841487e-05, 4.013587022200227e-05, 2.867394869099371e-05, 0.0001542841928312555, 4.245143645675853e-05, 4.938837082590908e-05, 4.1362305637449026e-05, 3.563420250429772e-05, 0.00010009656398324296, 0.00010307768388884142, 6.730636232532561e-05, 5.510987466550432e-05, 0.00011000169615726918, 5.2625480748247355e-05, 5.1343056838959455e-05, 4.147748404648155e-05, 0.000153022599988617, 3.814846422756091e-05, 5.6674896768527105e-05 ], "train/q_mse": [ 0.13432824611663818, 2.9250650186440907e-05, 2.1772801119368523e-05, 1.998736843233928e-05, 0.0001087924829334952, 4.3424755858723074e-05, 3.897686838172376e-05, 2.1876137907383963e-05, 7.836107397451997e-05, 1.8753249605651945e-05, 0.00012637728650588542, 3.2191601349040866e-05, 6.535898137371987e-05, 7.396026194328442e-05, 2.215734639321454e-05, 4.957913915859535e-05, 0.00018714769976213574, 0.00010593638580758125, 2.382395541644655e-05, 2.576542647148017e-05, 2.5808321879594587e-05, 7.161621761042625e-05, 5.069085455033928e-05, 9.0986599388998e-05, 8.170856744982302e-05, 3.36167577188462e-05, 6.0377988120308146e-05, 4.2951814975822344e-05, 0.00010280728747602552, 8.601638546679169e-05, 0.00011885826097568497, 4.1312734538223594e-05, 6.003670932841487e-05, 4.013587022200227e-05, 2.867394869099371e-05, 0.0001542841928312555, 4.245143645675853e-05, 4.938837082590908e-05, 4.1362305637449026e-05, 3.563420250429772e-05, 0.00010009656398324296, 0.00010307768388884142, 6.730636232532561e-05, 5.510987466550432e-05, 0.00011000169615726918, 5.2625480748247355e-05, 5.1343056838959455e-05, 4.147748404648155e-05, 0.000153022599988617, 3.814846422756091e-05, 5.6674896768527105e-05 ], "eval/q_mse": 0.062091866483208545, "eval/q_mae": 0.19175105180722984, "eval/q_corr": 0.653040559134656, "eval/q_spearman": 0.6757079106744416, "eval/truth_std": 0.1676409617116019, "wall_clock_s": 150.6241955757141, "n_anchors": 400, "anchor_protocol": "dataset_anchor", "dataset_note": "self_rendered_from_state_pointmaze (no OGBench visual-pointmaze exists)"}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122{ "method": "genq_reward_latent", "env": "visual-pointmaze-medium-navigate-v0", "seed": 4, "wandb_url": null, "representation": "image_reward_predictive_latent", "occ_model": "diffusion", "z_dim": 8, "reward": "dense", "truth_kind": "fresh_rollout", "gen_sample_counts": [ 1, 2, 4, 8, 16, 32, 64, 128, 256 ], "train/loss": [ 1.0221143960952759, 0.15464206039905548, 0.13698916137218475, 0.15096651017665863, 0.1399756371974945, 0.13827411830425262, 0.15386801958084106, 0.14700762927532196, 0.1270446479320526, 0.14089421927928925, 0.14881587028503418, 0.13726650178432465, 0.14134633541107178, 0.10434136539697647, 0.14067550003528595, 0.12321922183036804, 0.14194923639297485, 0.12255091965198517, 0.12179884314537048, 0.11405657231807709, 0.13789606094360352, 0.13840842247009277, 0.14163300395011902, 0.12925845384597778, 0.14221712946891785, 0.11165930330753326, 0.11027666926383972, 0.134271040558815, 0.11549004167318344, 0.12998327612876892, 0.11937310546636581, 0.1511804759502411, 0.10254085063934326, 0.13579848408699036, 0.11421668529510498, 0.11789098381996155, 0.12832027673721313, 0.1332865059375763, 0.12517359852790833, 0.11915998160839081, 0.13494136929512024, 0.1402449905872345, 0.11254194378852844, 0.11143847554922104, 0.1254590004682541, 0.11728259921073914, 0.13448892533779144, 0.12565918266773224, 0.10986718535423279, 0.1203315481543541, 0.1103968620300293 ], "train/q_mse": [ 0.0325285088809079 ], "latent/reward_mse": 0.00012722922838293016, "eval/q_mse": 0.0325285088809079, "eval/q_mae": 0.14042291027594347, "eval/q_corr": 0.8343707391026225, "eval/q_spearman": 0.859819811373821, "eval/q_mse_by_n": { "1": 0.11749048527107937, "2": 0.06507731086298359, "4": 0.05152496529628317, "8": 0.038036719248839834, "16": 0.04049392737856005, "32": 0.034567335346529574, "64": 0.03224953411325952, "128": 0.032026738340288394, "256": 0.03178017218581198 }, "eval/q_corr_by_n": { "1": 0.5001571625411021, "2": 0.6424750229272684, "4": 0.7033067227423613, "8": 0.7732711422483145, "16": 0.790210644271934, "32": 0.8066095136313705, "64": 0.8267415568147836, "128": 0.8369205649892222, "256": 0.8349037227999108 }, "eval/q_mse_vs_N": [ 0.11749048527107937, 0.06507731086298359, 0.05152496529628317, 0.038036719248839834, 0.04049392737856005, 0.034567335346529574, 0.03224953411325952, 0.032026738340288394, 0.03178017218581198 ], "eval/N_final": 256, "eval/truth_std": 0.17247575124413256, "wall_clock_s": 204.09846472740173, "n_anchors": 400, "anchor_protocol": "dataset_anchor", "dataset_note": "self_rendered_from_state_pointmaze (no OGBench visual-pointmaze exists)"}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124{ "method": "mc", "env": "visual-pointmaze-medium-navigate-v0", "seed": 4, "wandb_url": null, "representation": "ant_state_29d", "reward": "dense", "truth_kind": "fresh_rollout", "train/loss": [ 0.34835368394851685, 0.021781086921691895, 0.022151704877614975, 0.02001960203051567, 0.020774640142917633, 0.02400769107043743, 0.02091117948293686, 0.022001339122653008, 0.019430074840784073, 0.019683439284563065, 0.02220391482114792, 0.021904882043600082, 0.021217767149209976, 0.01888200454413891, 0.01898941770195961, 0.016956716775894165, 0.015432142652571201, 0.014268948696553707, 0.015532889403402805, 0.01790783181786537, 0.015784412622451782, 0.019660845398902893, 0.0204515028744936, 0.013847408816218376, 0.015860646963119507, 0.016796434298157692, 0.017031237483024597, 0.016207076609134674, 0.01771123707294464, 0.016995955258607864, 0.016243355348706245, 0.016266588121652603, 0.015557675622403622, 0.015755996108055115, 0.01845301315188408, 0.017771422863006592, 0.013419459573924541, 0.016886193305253983, 0.015301067382097244, 0.01601841300725937, 0.01298343762755394, 0.017222832888364792, 0.017420273274183273, 0.01316698919981718, 0.016125483438372612, 0.016258180141448975, 0.018020782619714737, 0.016702108085155487, 0.014704195782542229, 0.014174933545291424, 0.014707410708069801 ], "train/q_mse": [ 0.34835368394851685, 0.021781086921691895, 0.022151704877614975, 0.02001960203051567, 0.020774640142917633, 0.02400769107043743, 0.02091117948293686, 0.022001339122653008, 0.019430074840784073, 0.019683439284563065, 0.02220391482114792, 0.021904882043600082, 0.021217767149209976, 0.01888200454413891, 0.01898941770195961, 0.016956716775894165, 0.015432142652571201, 0.014268948696553707, 0.015532889403402805, 0.01790783181786537, 0.015784412622451782, 0.019660845398902893, 0.0204515028744936, 0.013847408816218376, 0.015860646963119507, 0.016796434298157692, 0.017031237483024597, 0.016207076609134674, 0.01771123707294464, 0.016995955258607864, 0.016243355348706245, 0.016266588121652603, 0.015557675622403622, 0.015755996108055115, 0.01845301315188408, 0.017771422863006592, 0.013419459573924541, 0.016886193305253983, 0.015301067382097244, 0.01601841300725937, 0.01298343762755394, 0.017222832888364792, 0.017420273274183273, 0.01316698919981718, 0.016125483438372612, 0.016258180141448975, 0.018020782619714737, 0.016702108085155487, 0.014704195782542229, 0.014174933545291424, 0.014707410708069801 ], "eval/q_mse": 0.025218780195969598, "eval/q_mae": 0.10768196192798157, "eval/q_corr": 0.8232307744599302, "eval/q_spearman": 0.8845570284814278, "eval/truth_std": 0.17247575124413256, "wall_clock_s": 80.08448624610901, "n_anchors": 400, "anchor_protocol": "dataset_anchor", "dataset_note": "self_rendered_from_state_pointmaze (no OGBench visual-pointmaze exists)"}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124{ "method": "td", "env": "visual-pointmaze-medium-navigate-v0", "seed": 4, "wandb_url": null, "representation": "ant_state_29d", "reward": "dense", "truth_kind": "fresh_rollout", "train/loss": [ 0.12689602375030518, 5.8314453781349584e-05, 0.0002390430890955031, 4.2148400098085403e-05, 6.272075552260503e-05, 0.00012217811308801174, 3.392712096683681e-05, 1.4556029782397673e-05, 2.6110506951226853e-05, 5.428169606602751e-05, 1.7343005310976878e-05, 1.8382921552984044e-05, 2.6903804609901272e-05, 2.159901850973256e-05, 0.00012590631376951933, 3.1839350413065404e-05, 0.00014260338502936065, 2.5799236027523875e-05, 4.8569097998552024e-05, 5.67318857065402e-05, 3.83693040930666e-05, 3.2438882044516504e-05, 3.35777185682673e-05, 2.5082532374653965e-05, 5.6030432460829616e-05, 4.5425469579640776e-05, 8.850930316839367e-05, 4.3394320528022945e-05, 7.397429726552218e-05, 7.845193613320589e-05, 2.165625846828334e-05, 6.838806439191103e-05, 9.929090447258204e-05, 2.5584453396731988e-05, 2.6925225029117428e-05, 3.4887045330833644e-05, 7.293863745871931e-05, 5.698925087926909e-05, 4.541434464044869e-05, 0.00011787991388700902, 2.5135776013485156e-05, 2.705133374547586e-05, 9.204699017573148e-05, 0.00019238758250139654, 6.033916724845767e-05, 6.98754665791057e-05, 0.00014157664554659277, 6.125553045421839e-05, 6.424242747016251e-05, 5.788148337160237e-05, 7.827226363588125e-05 ], "train/q_mse": [ 0.12689602375030518, 5.8314453781349584e-05, 0.0002390430890955031, 4.2148400098085403e-05, 6.272075552260503e-05, 0.00012217811308801174, 3.392712096683681e-05, 1.4556029782397673e-05, 2.6110506951226853e-05, 5.428169606602751e-05, 1.7343005310976878e-05, 1.8382921552984044e-05, 2.6903804609901272e-05, 2.159901850973256e-05, 0.00012590631376951933, 3.1839350413065404e-05, 0.00014260338502936065, 2.5799236027523875e-05, 4.8569097998552024e-05, 5.67318857065402e-05, 3.83693040930666e-05, 3.2438882044516504e-05, 3.35777185682673e-05, 2.5082532374653965e-05, 5.6030432460829616e-05, 4.5425469579640776e-05, 8.850930316839367e-05, 4.3394320528022945e-05, 7.397429726552218e-05, 7.845193613320589e-05, 2.165625846828334e-05, 6.838806439191103e-05, 9.929090447258204e-05, 2.5584453396731988e-05, 2.6925225029117428e-05, 3.4887045330833644e-05, 7.293863745871931e-05, 5.698925087926909e-05, 4.541434464044869e-05, 0.00011787991388700902, 2.5135776013485156e-05, 2.705133374547586e-05, 9.204699017573148e-05, 0.00019238758250139654, 6.033916724845767e-05, 6.98754665791057e-05, 0.00014157664554659277, 6.125553045421839e-05, 6.424242747016251e-05, 5.788148337160237e-05, 7.827226363588125e-05 ], "eval/q_mse": 0.045694480890922005, "eval/q_mae": 0.1738537517968264, "eval/q_corr": 0.6883529997958632, "eval/q_spearman": 0.7279944874655466, "eval/truth_std": 0.17247575124413256, "wall_clock_s": 132.9508650302887, "n_anchors": 400, "anchor_protocol": "dataset_anchor", "dataset_note": "self_rendered_from_state_pointmaze (no OGBench visual-pointmaze exists)"}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687"""Run the (self-rendered) visual-pointmaze policy-evaluation cells for one seed.
python run_genq.py --method genq --seed 0 python run_genq.py --method mc --seed 0 python run_genq.py --method td --seed 0
genq uses the reward-predictive CNN latent occupancy in a FROZEN latent(genq_visual.run) over rendered 64x64x3 images — NEVER raw pixels in the occupancymodel. mc/td run on the 4-D pointmaze state (qpos[2]+qvel[2]) as the non-latentreference (genq_visual.run_mc / run_td). All score against FRESH-ROLLOUT truth: thePointMaze scripted oracle-subgoal+noise controller, reset from the dataset anchor's xy(qpos), via gc_core.gc_fresh_truth_pointmaze. Protocol = dataset_anchor.
NOTE: `visual-pointmaze-medium-navigate-v0` is NOT an OGBench env (no registry entry,dataset 404s). The images are SELF-RENDERED from the state pointmaze dataset's qpos(build_visual_pointmaze_data.py). Truth never uses pixels, so it is unaffected.Writes results/{seed}/{method}.json."""import argparseimport jsonimport osimport sys
_HERE = os.path.dirname(os.path.abspath(__file__))sys.path.insert(0, os.path.join(_HERE, "..", "..")) # preliminary_analysis on path
import torch # noqa: E402_nt = int(os.environ.get("OMP_NUM_THREADS", "0") or 0)if _nt > 0: torch.set_num_threads(_nt)
from config import make_cfg # noqa: E402import genq_visual # noqa: E402
ENV = "visual-pointmaze-medium-navigate-v0"_FN = {"genq": "run", "mc": "run_mc", "td": "run_td"}_OUT_NAME = {"genq": "genq", "mc": "mc", "td": "td"}
def result_path(seed, method): d = os.path.join(_HERE, "results", str(seed)) os.makedirs(d, exist_ok=True) return os.path.join(d, f"{_OUT_NAME[method]}.json")
def run_one(method, seed, **ov): cfg = make_cfg(**ov) result = getattr(genq_visual, _FN[method])(ENV, seed, cfg) # PointMaze obs IS rendered from the resettable maze state; the truth resets to the # dataset validation anchor's xy and rolls the scripted oracle (dataset-anchor protocol). result["anchor_protocol"] = "dataset_anchor" result["dataset_note"] = "self_rendered_from_state_pointmaze (no OGBench visual-pointmaze exists)" path = result_path(seed, method) with open(path, "w") as f: json.dump(result, f, indent=2, allow_nan=True) print(f"[visual-pointmaze] wrote {path} eval/q_mse={result['eval/q_mse']:.5f} " f"eval/q_corr={result.get('eval/q_corr')}", flush=True) return result
def main(): ap = argparse.ArgumentParser() ap.add_argument("--method", choices=list(_FN), default="genq") ap.add_argument("--seed", type=int, default=None, help="single seed; default 0..4") ap.add_argument("--reward", default="dense") ap.add_argument("--steps", type=int, default=None) ap.add_argument("--latent_steps", type=int, default=None) ap.add_argument("--n_anchors", type=int, default=None) ap.add_argument("--truth_M", type=int, default=None) ap.add_argument("--truth_H", type=int, default=None) ap.add_argument("--vis_train_traj", type=int, default=None) ap.add_argument("--vis_val_traj", type=int, default=None) ap.add_argument("--wandb_mode", default=None) args = ap.parse_args() seeds = [args.seed] if args.seed is not None else list(range(5)) ov = {"reward": args.reward} for k in ("steps", "latent_steps", "n_anchors", "truth_M", "truth_H", "vis_train_traj", "vis_val_traj", "wandb_mode"): v = getattr(args, k) if v is not None: ov[k] = v for s in seeds: run_one(args.method, s, **ov)
if __name__ == "__main__": main()1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768#!/usr/bin/env bash# SEQUENTIAL policy-eval runner for the self-rendered visual-pointmaze cell.## Blue Vela GPUs are mode=exclusive_process -> only ONE CUDA context per GPU. The# packed "&"+wait pattern collides (cudaErrorDevicesUnavailable), so cells run# SEQUENTIALLY, one (method,seed) per loop iteration. The image CNN encoder is heavier# than the state MLPs, so keep <=1-2 cells per GPU; sequential is the safe default.## Usage:# SEEDS="0" METHODS="genq mc td" bash run_seq.sh# Resume-safe: only runs a (method,seed) cell whose JSON is missing / not fresh_rollout.set -u
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"ROOT="$(cd "$HERE/../../.." && pwd)"PA="$ROOT/preliminary_analysis"PY="$ROOT/.venv/bin/python"[ -x "$PY" ] || PY="/proj/inf-scaling/zwhong/projs/gen_q/.venv/bin/python"DRIVER="$HERE/run_genq.py"
SEEDS="${SEEDS:-0}"METHODS="${METHODS:-genq mc td}"REWARD="${REWARD:-dense}"GENQ_STEPS="${GENQ_STEPS:-40000}"LATENT_STEPS="${LATENT_STEPS:-20000}"TRUTH_M="${TRUTH_M:-8}"TRUTH_H="${TRUTH_H:-350}"N_ANCHORS="${N_ANCHORS:-400}"# rendered dataset is 300 train / 100 val traj; use all of it.VIS_TRAIN_TRAJ="${VIS_TRAIN_TRAJ:-300}"VIS_VAL_TRAJ="${VIS_VAL_TRAJ:-100}"
if [ -f "$ROOT/.env" ]; then set -a; . "$ROOT/.env"; set +a; fiexport OMP_NUM_THREADS=3 MKL_NUM_THREADS=3 OPENBLAS_NUM_THREADS=3export NUMEXPR_NUM_THREADS=3 VECLIB_MAXIMUM_THREADS=3export XLA_FLAGS="--xla_cpu_multi_thread_eigen=false intra_op_parallelism_threads=3"export JAX_PLATFORMS=cpuexport XLA_PYTHON_CLIENT_MEM_FRACTION=0.1export MUJOCO_GL=egl
cd "$PA"mkdir -p "$HERE/results"echo "[run_seq vpm] SEEDS='$SEEDS' METHODS='$METHODS' steps=$GENQ_STEPS latent=$LATENT_STEPS M=$TRUTH_M H=$TRUTH_H anchors=$N_ANCHORS"
fail=0for SEED in $SEEDS; do for METHOD in $METHODS; do out="$HERE/results/$SEED/$METHOD.json" if [ -f "$out" ] && grep -q '"truth_kind": "fresh_rollout"' "$out" 2>/dev/null; then echo "[run_seq vpm] SKIP existing $METHOD s$SEED"; continue fi echo "[run_seq vpm] === $METHOD seed=$SEED ===" args=(--method "$METHOD" --seed "$SEED" --reward "$REWARD" \ --steps "$GENQ_STEPS" --n_anchors "$N_ANCHORS" \ --truth_M "$TRUTH_M" --truth_H "$TRUTH_H" \ --vis_train_traj "$VIS_TRAIN_TRAJ" --vis_val_traj "$VIS_VAL_TRAJ") if [ "$METHOD" = "genq" ]; then args+=(--latent_steps "$LATENT_STEPS"); fi if ! "$PY" "$DRIVER" "${args[@]}" > "$HERE/results/${METHOD}_s${SEED}.log" 2>&1; then echo "[run_seq vpm] CELL FAILED: $METHOD-s$SEED" tail -8 "$HERE/results/${METHOD}_s${SEED}.log" fail=1 fi donedone
"$PY" plots.py --env "visual-pointmaze-medium-navigate-v0" || trueecho "[run_seq vpm] done (fail=$fail)"exit "$fail"12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152# visual-puzzle-3x3-play-v0 — Milestone 1 (Policy Evaluation), issue #35
Image-observation + combinatorial cell. **Expected outcome: an HONEST NEGATIVE,inherited from the STATE `puzzle-3x3-play-v0` honest negative** (all of mc/td/genq at~0 correlation). This is the correct, reported finding — not a failure of the imagerecipe and not something to tune away.
## What this cell runs
- **genq** = image reward-predictive **latent** occupancy (`genq_visual_puzzle.run`). CNN encoder `z = E(image 64x64x3)`; goal-conditioned reward decoder `R(z, g)` fit to the puzzle **match-fraction** reward (`gc_core.puzzle_reward`, the issue-#35 reward); freeze; conditional **diffusion** occupancy `p(z' | z_now, a, g)` on `z' = stopgrad(E(image_{t+k}))`, `k ~ Geom(1-γ)`; `Q = mean_i R(z_i, g)`. NEVER raw pixels (CLAUDE.md image rule).- **mc / td** = trained-MC / IQL-TD critics over the **46-D `[qpos|qvel]` state** (the non-latent reference, documented via `representation`), with the SAME match-fraction reward and the button-state vector as the occupancy target. This mirrors the `genq_visual` (visual-antmaze) precedent where mc/td run on the underlying ant state.- **Ground truth** = fresh-RESET fresh rollouts (Protocol B), **identical to the STATE puzzle**: `ButtonMarkovOracle(gripper_always_closed=True)` rolled from `set_state(qpos, qvel, button_states)`, renormalized discounted match-fraction reward toward the target button pattern, averaged over M rollouts. The live PuzzleEnv has all privileged info, so the truth is independent of whether the model observation is an image or a state vector — the image-ness only changes the occupancy MODEL input. The shared anchor pack (`gc_core.fresh_reset_anchors`) is built ONCE per seed and shared by genq/mc/td so all three score the SAME (s, a, g).
## Why the negative is expected (mechanism)
The STATE puzzle is an honest negative because the truth is near-degenerate: thediscounted match-fraction return toward a single-target-button goal has **truth std~0.011–0.014** across anchors (vs ~0.38 for the graded visual-antmaze navigationtruth). The Lights-Out button task is essentially "the target button gets pressedwithin the horizon, or it doesn't" — there is no graded, rankable Q across anchors, soPearson/Spearman correlation against truth is ~0 for **every** estimator (the statepuzzle's mc/td/genq all land at |corr| ≤ 0.15). Passing the same degenerate truththrough an image reward-latent does not create signal that the task does not contain.
So the image case is expected to **confirm** the state negative. If it differs, that isitself the reportable finding — but it must come from an honest run, never from tuning.
## Files
- Driver: `../../genq_visual_puzzle.py` (genq image-latent + mc/td state reference).- Per-seed runner: `run_seed.py` (builds shared truth once, runs genq+mc+td).- Batch runner: `run_seq.sh` (one seed per process inside one bsub `-gpu num=1`).- Results: `results/{seed}/{genq,mc,td}.json` — schema matches the other M1 envs (`eval/q_mse`, `eval/q_corr`, `eval/q_mse_by_n`, `eval/q_corr_by_n`, `truth_kind="fresh_rollout"`, `anchor_protocol="fresh_reset"`).- Figures: `figures/{mse,corr}.png` (Gen-Q curve vs N, MC/TD reference lines).123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121{ "method": "genq_reward_latent", "env": "visual-puzzle-3x3-play-v0", "seed": 0, "wandb_url": null, "representation": "image_reward_predictive_latent", "occ_model": "diffusion", "z_dim": 8, "reward": "dense", "truth_kind": "fresh_rollout", "anchor_protocol": "fresh_reset", "gen_sample_counts": [ 1, 2, 4, 8, 16, 32, 64, 128, 256 ], "train/loss": [ 1.021519422531128, 0.4601687490940094, 0.2952587604522705, 0.29642564058303833, 0.2566065192222595, 0.2608852982521057, 0.2649744153022766, 0.21888938546180725, 0.22235921025276184, 0.21022295951843262, 0.2057866007089615, 0.2536538243293762, 0.25915318727493286, 0.19905629754066467, 0.23954977095127106, 0.2539094388484955, 0.254019558429718, 0.23310111463069916, 0.23211494088172913, 0.2157919853925705, 0.19920235872268677, 0.20999859273433685, 0.26213425397872925, 0.23050303757190704, 0.20321311056613922, 0.15958988666534424, 0.2099725306034088, 0.22476862370967865, 0.2110440880060196, 0.2102266550064087, 0.20764213800430298, 0.2283616065979004, 0.19830217957496643, 0.21698564291000366, 0.19947651028633118, 0.19465507566928864, 0.23041236400604248, 0.23858603835105896, 0.20363286137580872, 0.18325605988502502, 0.179934561252594, 0.2046785056591034, 0.2069043219089508, 0.21145755052566528, 0.17085985839366913, 0.17966949939727783, 0.17462216317653656, 0.17755067348480225, 0.20074118673801422, 0.220272958278656, 0.20178523659706116 ], "train/q_mse": [ 0.07146202586195333 ], "latent/reward_mse": 2.6356749003753066e-05, "eval/q_mse": 0.07146202586195333, "eval/q_mae": 0.2648176458120056, "eval/q_corr": -0.004094141213230109, "eval/q_spearman": -0.0030695840290528957, "eval/q_mse_by_n": { "1": 0.1073083887446366, "2": 0.0790610194466088, "4": 0.08006403860746969, "8": 0.0804523668037022, "16": 0.07249970764970978, "32": 0.07105027784024304, "64": 0.07174116280155583, "128": 0.07225206335540099, "256": 0.07167250843326349 }, "eval/q_corr_by_n": { "1": 0.06457914123567231, "2": 0.10567364195550466, "4": -0.03288992926825715, "8": -0.007945798637642304, "16": -0.0037951998332696603, "32": 0.0016083051179053229, "64": 0.021072154041039445, "128": -0.007717643607183906, "256": 0.007820503672876053 }, "eval/q_mse_vs_N": [ 0.1073083887446366, 0.0790610194466088, 0.08006403860746969, 0.0804523668037022, 0.07249970764970978, 0.07105027784024304, 0.07174116280155583, 0.07225206335540099, 0.07167250843326349 ], "eval/N_final": 256, "eval/truth_std": 0.01520020918542479, "wall_clock_s": 216.02018404006958, "n_anchors": 200}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123{ "method": "mc", "env": "visual-puzzle-3x3-play-v0", "seed": 0, "wandb_url": null, "representation": "puzzle_state_46d", "reward": "dense", "truth_kind": "fresh_rollout", "anchor_protocol": "fresh_reset", "train/loss": [ 0.27377158403396606, 0.01449478231370449, 0.02048783376812935, 0.015084651298820972, 0.01668834313750267, 0.014009361155331135, 0.012490876019001007, 0.014363992027938366, 0.016287554055452347, 0.01540954690426588, 0.012552689760923386, 0.015072048641741276, 0.014254258945584297, 0.012741902843117714, 0.013847781345248222, 0.01286780834197998, 0.012072085402905941, 0.013999857008457184, 0.011457929387688637, 0.012684045359492302, 0.012237176299095154, 0.01200703252106905, 0.01054402906447649, 0.007818711921572685, 0.010167859494686127, 0.009926622733473778, 0.00923527404665947, 0.0085448008030653, 0.008351923897862434, 0.00709732249379158, 0.006109965965151787, 0.005684474483132362, 0.006194375921040773, 0.007862245664000511, 0.005147951189428568, 0.008025170303881168, 0.005333418026566505, 0.0056441547349095345, 0.004884111694991589, 0.005278090946376324, 0.004985888954252005, 0.0041185906156897545, 0.004817157052457333, 0.0044778380542993546, 0.0044335005804896355, 0.0047149658203125, 0.003720856737345457, 0.004310415126383305, 0.003513350849971175, 0.004647546447813511, 0.0034227771684527397 ], "train/q_mse": [ 0.27377158403396606, 0.01449478231370449, 0.02048783376812935, 0.015084651298820972, 0.01668834313750267, 0.014009361155331135, 0.012490876019001007, 0.014363992027938366, 0.016287554055452347, 0.01540954690426588, 0.012552689760923386, 0.015072048641741276, 0.014254258945584297, 0.012741902843117714, 0.013847781345248222, 0.01286780834197998, 0.012072085402905941, 0.013999857008457184, 0.011457929387688637, 0.012684045359492302, 0.012237176299095154, 0.01200703252106905, 0.01054402906447649, 0.007818711921572685, 0.010167859494686127, 0.009926622733473778, 0.00923527404665947, 0.0085448008030653, 0.008351923897862434, 0.00709732249379158, 0.006109965965151787, 0.005684474483132362, 0.006194375921040773, 0.007862245664000511, 0.005147951189428568, 0.008025170303881168, 0.005333418026566505, 0.0056441547349095345, 0.004884111694991589, 0.005278090946376324, 0.004985888954252005, 0.0041185906156897545, 0.004817157052457333, 0.0044778380542993546, 0.0044335005804896355, 0.0047149658203125, 0.003720856737345457, 0.004310415126383305, 0.003513350849971175, 0.004647546447813511, 0.0034227771684527397 ], "eval/q_mse": 0.19029518513677396, "eval/q_mae": 0.41816644217965093, "eval/q_corr": 0.06425732763454055, "eval/q_spearman": 0.08165093517280701, "eval/truth_std": 0.01520020918542479, "wall_clock_s": 45.317344188690186, "n_anchors": 200}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123{ "method": "td", "env": "visual-puzzle-3x3-play-v0", "seed": 0, "wandb_url": null, "representation": "puzzle_state_46d", "reward": "dense", "truth_kind": "fresh_rollout", "anchor_protocol": "fresh_reset", "train/loss": [ 0.0031114162411540747, 5.278137450659415e-06, 4.615293619281147e-06, 4.854130111198174e-06, 6.227544872672297e-06, 4.015372724097688e-06, 4.181146323389839e-06, 5.594997674052138e-06, 3.2843117878655903e-06, 5.333041372068692e-06, 5.873735972272698e-06, 8.308212272822857e-06, 5.001714725949569e-06, 5.982739821774885e-06, 5.971228347334545e-06, 3.7389995668490883e-06, 3.4900795071735047e-06, 3.7658824112440925e-06, 9.169029908662196e-06, 6.395014224835904e-06, 2.927656851170468e-06, 4.1803928070294205e-06, 7.145042218326125e-06, 4.241586793796159e-06, 3.831414232990937e-06, 3.6492870094662067e-06, 4.057833393744659e-06, 4.213066858937964e-06, 8.094826625892892e-06, 5.4807915148558095e-06, 3.109188583039213e-06, 6.9497018557740375e-06, 3.9180404201033525e-06, 4.068935595569201e-06, 7.827791705494747e-06, 4.551379333861405e-06, 3.7780212096549803e-06, 5.656886514771031e-06, 3.2655070754117332e-06, 4.729612101073144e-06, 4.336786332714837e-06, 4.0762784010439645e-06, 2.9380630621744785e-06, 5.181247615837492e-06, 3.665640178951435e-06, 3.3901685583259678e-06, 3.6557812563842162e-06, 3.735813834282453e-06, 9.290849448007066e-06, 3.672404545795871e-06, 4.4350563257467e-06 ], "train/q_mse": [ 0.0031114162411540747, 5.278137450659415e-06, 4.615293619281147e-06, 4.854130111198174e-06, 6.227544872672297e-06, 4.015372724097688e-06, 4.181146323389839e-06, 5.594997674052138e-06, 3.2843117878655903e-06, 5.333041372068692e-06, 5.873735972272698e-06, 8.308212272822857e-06, 5.001714725949569e-06, 5.982739821774885e-06, 5.971228347334545e-06, 3.7389995668490883e-06, 3.4900795071735047e-06, 3.7658824112440925e-06, 9.169029908662196e-06, 6.395014224835904e-06, 2.927656851170468e-06, 4.1803928070294205e-06, 7.145042218326125e-06, 4.241586793796159e-06, 3.831414232990937e-06, 3.6492870094662067e-06, 4.057833393744659e-06, 4.213066858937964e-06, 8.094826625892892e-06, 5.4807915148558095e-06, 3.109188583039213e-06, 6.9497018557740375e-06, 3.9180404201033525e-06, 4.068935595569201e-06, 7.827791705494747e-06, 4.551379333861405e-06, 3.7780212096549803e-06, 5.656886514771031e-06, 3.2655070754117332e-06, 4.729612101073144e-06, 4.336786332714837e-06, 4.0762784010439645e-06, 2.9380630621744785e-06, 5.181247615837492e-06, 3.665640178951435e-06, 3.3901685583259678e-06, 3.6557812563842162e-06, 3.735813834282453e-06, 9.290849448007066e-06, 3.672404545795871e-06, 4.4350563257467e-06 ], "eval/q_mse": 0.18432445600994302, "eval/q_mae": 0.4290393310427376, "eval/q_corr": -0.07532079281012344, "eval/q_spearman": -0.10866327462847249, "eval/truth_std": 0.01520020918542479, "wall_clock_s": 113.64547228813171, "n_anchors": 200}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121{ "method": "genq_reward_latent", "env": "visual-puzzle-3x3-play-v0", "seed": 1, "wandb_url": null, "representation": "image_reward_predictive_latent", "occ_model": "diffusion", "z_dim": 8, "reward": "dense", "truth_kind": "fresh_rollout", "anchor_protocol": "fresh_reset", "gen_sample_counts": [ 1, 2, 4, 8, 16, 32, 64, 128, 256 ], "train/loss": [ 0.9807145595550537, 0.4400460720062256, 0.3610970675945282, 0.2688695192337036, 0.28034707903862, 0.26231133937835693, 0.2494300901889801, 0.25018224120140076, 0.22944794595241547, 0.2130129635334015, 0.24376246333122253, 0.21491679549217224, 0.2273327112197876, 0.2546854615211487, 0.2323516309261322, 0.2361908107995987, 0.24614675343036652, 0.24467571079730988, 0.20755019783973694, 0.21395747363567352, 0.20720559358596802, 0.2488359808921814, 0.2267460823059082, 0.2283811867237091, 0.2064915895462036, 0.21840515732765198, 0.20661449432373047, 0.22264894843101501, 0.20823489129543304, 0.21716240048408508, 0.18364380300045013, 0.1748126745223999, 0.20742008090019226, 0.1701427400112152, 0.17814505100250244, 0.1915898323059082, 0.2118266522884369, 0.2002684473991394, 0.20539897680282593, 0.19456911087036133, 0.1846393644809723, 0.22991949319839478, 0.24090014398097992, 0.1669967770576477, 0.2002880573272705, 0.19123905897140503, 0.19090206921100616, 0.20155873894691467, 0.187917560338974, 0.20528344810009003, 0.18759356439113617 ], "train/q_mse": [ 0.05793036026812584 ], "latent/reward_mse": 3.492172254482284e-05, "eval/q_mse": 0.05793036026812584, "eval/q_mae": 0.23773052804047787, "eval/q_corr": 0.07948781752793167, "eval/q_spearman": 0.08533443600767049, "eval/q_mse_by_n": { "1": 0.09512565332175407, "2": 0.08388511346914757, "4": 0.06447527291491785, "8": 0.06367595947903232, "16": 0.059387474398493616, "32": 0.057744328526531954, "64": 0.05741584154619247, "128": 0.05834494982701078, "256": 0.05779518197889028 }, "eval/q_corr_by_n": { "1": -0.009039003390065904, "2": 0.09248342893143635, "4": 0.009978365452553872, "8": 0.16447670988236304, "16": 0.14018888300798776, "32": 0.06812872585293074, "64": 0.09095566774236519, "128": 0.03979257628922054, "256": 0.04134770628953202 }, "eval/q_mse_vs_N": [ 0.09512565332175407, 0.08388511346914757, 0.06447527291491785, 0.06367595947903232, 0.059387474398493616, 0.057744328526531954, 0.05741584154619247, 0.05834494982701078, 0.05779518197889028 ], "eval/N_final": 256, "eval/truth_std": 0.014050113983847026, "wall_clock_s": 241.66425371170044, "n_anchors": 200}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123{ "method": "mc", "env": "visual-puzzle-3x3-play-v0", "seed": 1, "wandb_url": null, "representation": "puzzle_state_46d", "reward": "dense", "truth_kind": "fresh_rollout", "anchor_protocol": "fresh_reset", "train/loss": [ 0.33153998851776123, 0.016061093658208847, 0.017301592975854874, 0.016898270696401596, 0.01317935436964035, 0.015605157241225243, 0.015999682247638702, 0.013921011239290237, 0.013126138597726822, 0.016829876229166985, 0.01352191437035799, 0.01486215740442276, 0.015201425179839134, 0.013477513566613197, 0.012067161500453949, 0.010814988985657692, 0.013562566600739956, 0.013427294790744781, 0.01393778994679451, 0.01043575070798397, 0.01355486549437046, 0.009328169748187065, 0.009050591848790646, 0.010213538073003292, 0.00885345134884119, 0.006860203109681606, 0.01009971834719181, 0.010200081393122673, 0.007873302325606346, 0.008852760307490826, 0.008487625047564507, 0.007925750687718391, 0.006615819409489632, 0.0068536484614014626, 0.005707425065338612, 0.00560744758695364, 0.0063984571024775505, 0.005186611320823431, 0.005942762829363346, 0.004300490487366915, 0.005335991270840168, 0.004683281295001507, 0.00566362589597702, 0.004111667163670063, 0.004999744705855846, 0.005114395171403885, 0.0035127270966768265, 0.00385737675242126, 0.004656015429645777, 0.003737775608897209, 0.003998672589659691 ], "train/q_mse": [ 0.33153998851776123, 0.016061093658208847, 0.017301592975854874, 0.016898270696401596, 0.01317935436964035, 0.015605157241225243, 0.015999682247638702, 0.013921011239290237, 0.013126138597726822, 0.016829876229166985, 0.01352191437035799, 0.01486215740442276, 0.015201425179839134, 0.013477513566613197, 0.012067161500453949, 0.010814988985657692, 0.013562566600739956, 0.013427294790744781, 0.01393778994679451, 0.01043575070798397, 0.01355486549437046, 0.009328169748187065, 0.009050591848790646, 0.010213538073003292, 0.00885345134884119, 0.006860203109681606, 0.01009971834719181, 0.010200081393122673, 0.007873302325606346, 0.008852760307490826, 0.008487625047564507, 0.007925750687718391, 0.006615819409489632, 0.0068536484614014626, 0.005707425065338612, 0.00560744758695364, 0.0063984571024775505, 0.005186611320823431, 0.005942762829363346, 0.004300490487366915, 0.005335991270840168, 0.004683281295001507, 0.00566362589597702, 0.004111667163670063, 0.004999744705855846, 0.005114395171403885, 0.0035127270966768265, 0.00385737675242126, 0.004656015429645777, 0.003737775608897209, 0.003998672589659691 ], "eval/q_mse": 0.1666778275137994, "eval/q_mae": 0.3882469346361848, "eval/q_corr": -0.03360009612223268, "eval/q_spearman": -0.046043760435793425, "eval/truth_std": 0.014050113983847026, "wall_clock_s": 84.53309535980225, "n_anchors": 200}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123{ "method": "td", "env": "visual-puzzle-3x3-play-v0", "seed": 1, "wandb_url": null, "representation": "puzzle_state_46d", "reward": "dense", "truth_kind": "fresh_rollout", "anchor_protocol": "fresh_reset", "train/loss": [ 0.0012204032391309738, 6.125352228991687e-06, 5.217079888097942e-06, 4.791495484823827e-06, 3.2437026220577536e-06, 3.5753496376855765e-06, 4.218249159748666e-06, 4.293704023439204e-06, 3.894338078680448e-06, 4.730663931695744e-06, 4.639120561478194e-06, 3.2838054266903782e-06, 3.957793978770496e-06, 6.253728770388989e-06, 3.5554949135985225e-06, 4.4017469917889684e-06, 3.6687652027467266e-06, 3.864938662445638e-06, 4.212437033856986e-06, 4.194202574581141e-06, 3.5583732369559584e-06, 3.567800831660861e-06, 3.91760841012001e-06, 4.5055608097754885e-06, 3.901361196767539e-06, 4.029919637105195e-06, 3.964070401707431e-06, 3.7007548598921858e-06, 4.193703716737218e-06, 4.805036041943822e-06, 3.574690708774142e-06, 4.073217496625148e-06, 6.4449277488165535e-06, 5.942266398051288e-06, 3.554948307282757e-06, 4.008534233435057e-06, 4.516137778409757e-06, 3.960966751037631e-06, 3.709805696416879e-06, 3.565084398360341e-06, 5.899311872781254e-06, 3.450305939622922e-06, 3.187440142937703e-06, 4.070351678819861e-06, 2.9936820737930248e-06, 3.9672340790275484e-06, 2.9289030862855725e-06, 3.862484845740255e-06, 4.573448677547276e-06, 3.3329736197629245e-06, 3.6034641652804567e-06 ], "train/q_mse": [ 0.0012204032391309738, 6.125352228991687e-06, 5.217079888097942e-06, 4.791495484823827e-06, 3.2437026220577536e-06, 3.5753496376855765e-06, 4.218249159748666e-06, 4.293704023439204e-06, 3.894338078680448e-06, 4.730663931695744e-06, 4.639120561478194e-06, 3.2838054266903782e-06, 3.957793978770496e-06, 6.253728770388989e-06, 3.5554949135985225e-06, 4.4017469917889684e-06, 3.6687652027467266e-06, 3.864938662445638e-06, 4.212437033856986e-06, 4.194202574581141e-06, 3.5583732369559584e-06, 3.567800831660861e-06, 3.91760841012001e-06, 4.5055608097754885e-06, 3.901361196767539e-06, 4.029919637105195e-06, 3.964070401707431e-06, 3.7007548598921858e-06, 4.193703716737218e-06, 4.805036041943822e-06, 3.574690708774142e-06, 4.073217496625148e-06, 6.4449277488165535e-06, 5.942266398051288e-06, 3.554948307282757e-06, 4.008534233435057e-06, 4.516137778409757e-06, 3.960966751037631e-06, 3.709805696416879e-06, 3.565084398360341e-06, 5.899311872781254e-06, 3.450305939622922e-06, 3.187440142937703e-06, 4.070351678819861e-06, 2.9936820737930248e-06, 3.9672340790275484e-06, 2.9289030862855725e-06, 3.862484845740255e-06, 4.573448677547276e-06, 3.3329736197629245e-06, 3.6034641652804567e-06 ], "eval/q_mse": 0.189145102131425, "eval/q_mae": 0.43468024216468065, "eval/q_corr": 0.08796130859680275, "eval/q_spearman": 0.10375194018198786, "eval/truth_std": 0.014050113983847026, "wall_clock_s": 176.03912734985352, "n_anchors": 200}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121{ "method": "genq_reward_latent", "env": "visual-puzzle-3x3-play-v0", "seed": 2, "wandb_url": null, "representation": "image_reward_predictive_latent", "occ_model": "diffusion", "z_dim": 8, "reward": "dense", "truth_kind": "fresh_rollout", "anchor_protocol": "fresh_reset", "gen_sample_counts": [ 1, 2, 4, 8, 16, 32, 64, 128, 256 ], "train/loss": [ 1.0270042419433594, 0.4926109313964844, 0.25451451539993286, 0.24574831128120422, 0.2283048927783966, 0.20877614617347717, 0.2705289125442505, 0.2481229305267334, 0.2179751694202423, 0.2228512316942215, 0.18179479241371155, 0.24287348985671997, 0.2439499795436859, 0.2246687263250351, 0.23155605792999268, 0.20789775252342224, 0.23746022582054138, 0.17210029065608978, 0.19767284393310547, 0.1915525197982788, 0.20987069606781006, 0.18757885694503784, 0.22028657793998718, 0.20491041243076324, 0.2406948208808899, 0.17528264224529266, 0.17716437578201294, 0.21971076726913452, 0.23385220766067505, 0.21838140487670898, 0.20587867498397827, 0.20277276635169983, 0.19320036470890045, 0.209520161151886, 0.2010309249162674, 0.18754874169826508, 0.20517519116401672, 0.1789780706167221, 0.19141335785388947, 0.1696317493915558, 0.21181648969650269, 0.20939485728740692, 0.14459873735904694, 0.2180784046649933, 0.21029719710350037, 0.18462111055850983, 0.1691209077835083, 0.15534928441047668, 0.22393280267715454, 0.188382089138031, 0.1731264293193817 ], "train/q_mse": [ 0.05786949887487825 ], "latent/reward_mse": 2.9891922167735174e-05, "eval/q_mse": 0.05786949887487825, "eval/q_mae": 0.2373290019754777, "eval/q_corr": 0.01914517078675529, "eval/q_spearman": 0.031309757096339534, "eval/q_mse_by_n": { "1": 0.09020440271734823, "2": 0.08067756407134383, "4": 0.06299363260594396, "8": 0.06765017370959912, "16": 0.06134006430543755, "32": 0.06051339577774429, "64": 0.05766905909917022, "128": 0.05903817699298815, "256": 0.05837154201006975 }, "eval/q_corr_by_n": { "1": -0.005713607682170413, "2": -0.07272741581351423, "4": 0.03221002397828272, "8": -0.11647711909730074, "16": -0.06127867419748186, "32": 0.07472428029086302, "64": 0.00941746659748049, "128": -0.01715974434839922, "256": 0.04954112923775513 }, "eval/q_mse_vs_N": [ 0.09020440271734823, 0.08067756407134383, 0.06299363260594396, 0.06765017370959912, 0.06134006430543755, 0.06051339577774429, 0.05766905909917022, 0.05903817699298815, 0.05837154201006975 ], "eval/N_final": 256, "eval/truth_std": 0.011446896413730248, "wall_clock_s": 214.33634328842163, "n_anchors": 200}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123{ "method": "mc", "env": "visual-puzzle-3x3-play-v0", "seed": 2, "wandb_url": null, "representation": "puzzle_state_46d", "reward": "dense", "truth_kind": "fresh_rollout", "anchor_protocol": "fresh_reset", "train/loss": [ 0.40898996591567993, 0.015920303761959076, 0.014010515064001083, 0.013672862201929092, 0.017288688570261, 0.015668045729398727, 0.01285402849316597, 0.014039140194654465, 0.014095981605350971, 0.016332391649484634, 0.016876138746738434, 0.01484333910048008, 0.013885890133678913, 0.011035697534680367, 0.012117761187255383, 0.010388154536485672, 0.011715492233633995, 0.013304205611348152, 0.010947076603770256, 0.01304270327091217, 0.010827884078025818, 0.013813907280564308, 0.010653816163539886, 0.007922614924609661, 0.009903037920594215, 0.010088683106005192, 0.009109705686569214, 0.009340403601527214, 0.008670229464769363, 0.008110998198390007, 0.008070522919297218, 0.007171010598540306, 0.007696999236941338, 0.0073455688543617725, 0.007664284203201532, 0.006526111159473658, 0.005847295746207237, 0.0065309698693454266, 0.00772154051810503, 0.005802817642688751, 0.005282590165734291, 0.005653972737491131, 0.005036684684455395, 0.0042710937559604645, 0.004249030724167824, 0.0037705216091126204, 0.0037338915280997753, 0.004787066485732794, 0.004263255745172501, 0.004285373724997044, 0.003377311397343874 ], "train/q_mse": [ 0.40898996591567993, 0.015920303761959076, 0.014010515064001083, 0.013672862201929092, 0.017288688570261, 0.015668045729398727, 0.01285402849316597, 0.014039140194654465, 0.014095981605350971, 0.016332391649484634, 0.016876138746738434, 0.01484333910048008, 0.013885890133678913, 0.011035697534680367, 0.012117761187255383, 0.010388154536485672, 0.011715492233633995, 0.013304205611348152, 0.010947076603770256, 0.01304270327091217, 0.010827884078025818, 0.013813907280564308, 0.010653816163539886, 0.007922614924609661, 0.009903037920594215, 0.010088683106005192, 0.009109705686569214, 0.009340403601527214, 0.008670229464769363, 0.008110998198390007, 0.008070522919297218, 0.007171010598540306, 0.007696999236941338, 0.0073455688543617725, 0.007664284203201532, 0.006526111159473658, 0.005847295746207237, 0.0065309698693454266, 0.00772154051810503, 0.005802817642688751, 0.005282590165734291, 0.005653972737491131, 0.005036684684455395, 0.0042710937559604645, 0.004249030724167824, 0.0037705216091126204, 0.0037338915280997753, 0.004787066485732794, 0.004263255745172501, 0.004285373724997044, 0.003377311397343874 ], "eval/q_mse": 0.18494481683358927, "eval/q_mae": 0.40741203380782176, "eval/q_corr": -0.00558418397262717, "eval/q_spearman": -0.001841750417431737, "eval/truth_std": 0.011446896413730248, "wall_clock_s": 49.77327489852905, "n_anchors": 200}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123{ "method": "td", "env": "visual-puzzle-3x3-play-v0", "seed": 2, "wandb_url": null, "representation": "puzzle_state_46d", "reward": "dense", "truth_kind": "fresh_rollout", "anchor_protocol": "fresh_reset", "train/loss": [ 0.0009117407607845962, 5.4393603932112455e-06, 4.474584784475155e-06, 4.81739289170946e-06, 4.826188160222955e-06, 5.254487405181862e-06, 5.732536010327749e-06, 4.0249865378427785e-06, 4.44261240772903e-06, 4.8801621232996695e-06, 4.367894689494278e-06, 8.360007996088825e-06, 4.803511728823651e-06, 4.238138444634387e-06, 5.181236701901071e-06, 3.949918209400494e-06, 4.308625193516491e-06, 3.623529892138322e-06, 3.5488419598550536e-06, 3.957788067054935e-06, 3.946439392166212e-06, 4.449716016097227e-06, 3.952579845645232e-06, 4.324317615100881e-06, 4.5290798880159855e-06, 3.1656122700951528e-06, 5.1037868615821935e-06, 4.201405317871831e-06, 8.674192940816283e-06, 4.629396244126838e-06, 4.312078090151772e-06, 3.1061936169862747e-06, 3.6707233448396437e-06, 4.410880592331523e-06, 3.857937826978741e-06, 5.9873386817344e-06, 5.843794497195631e-06, 3.567578687579953e-06, 5.250517460808624e-06, 4.246754542691633e-06, 7.172588993853424e-06, 7.115767857612809e-06, 3.6871113024972146e-06, 3.488460151856998e-06, 3.4000220239249757e-06, 5.6668345678190235e-06, 3.277311861893395e-06, 3.5255882266937988e-06, 4.133057245780947e-06, 4.664694642997347e-06, 3.9704059417999815e-06 ], "train/q_mse": [ 0.0009117407607845962, 5.4393603932112455e-06, 4.474584784475155e-06, 4.81739289170946e-06, 4.826188160222955e-06, 5.254487405181862e-06, 5.732536010327749e-06, 4.0249865378427785e-06, 4.44261240772903e-06, 4.8801621232996695e-06, 4.367894689494278e-06, 8.360007996088825e-06, 4.803511728823651e-06, 4.238138444634387e-06, 5.181236701901071e-06, 3.949918209400494e-06, 4.308625193516491e-06, 3.623529892138322e-06, 3.5488419598550536e-06, 3.957788067054935e-06, 3.946439392166212e-06, 4.449716016097227e-06, 3.952579845645232e-06, 4.324317615100881e-06, 4.5290798880159855e-06, 3.1656122700951528e-06, 5.1037868615821935e-06, 4.201405317871831e-06, 8.674192940816283e-06, 4.629396244126838e-06, 4.312078090151772e-06, 3.1061936169862747e-06, 3.6707233448396437e-06, 4.410880592331523e-06, 3.857937826978741e-06, 5.9873386817344e-06, 5.843794497195631e-06, 3.567578687579953e-06, 5.250517460808624e-06, 4.246754542691633e-06, 7.172588993853424e-06, 7.115767857612809e-06, 3.6871113024972146e-06, 3.488460151856998e-06, 3.4000220239249757e-06, 5.6668345678190235e-06, 3.277311861893395e-06, 3.5255882266937988e-06, 4.133057245780947e-06, 4.664694642997347e-06, 3.9704059417999815e-06 ], "eval/q_mse": 0.1951895251679614, "eval/q_mae": 0.44165005798381674, "eval/q_corr": 0.07182346057517712, "eval/q_spearman": 0.08533443600767049, "eval/truth_std": 0.011446896413730248, "wall_clock_s": 118.18665862083435, "n_anchors": 200}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121{ "method": "genq_reward_latent", "env": "visual-puzzle-3x3-play-v0", "seed": 3, "wandb_url": null, "representation": "image_reward_predictive_latent", "occ_model": "diffusion", "z_dim": 8, "reward": "dense", "truth_kind": "fresh_rollout", "anchor_protocol": "fresh_reset", "gen_sample_counts": [ 1, 2, 4, 8, 16, 32, 64, 128, 256 ], "train/loss": [ 0.9782455563545227, 0.44427141547203064, 0.2513529062271118, 0.25645506381988525, 0.25300535559654236, 0.22159214317798615, 0.24054694175720215, 0.24258647859096527, 0.21553190052509308, 0.22055687010288239, 0.23031868040561676, 0.1973576545715332, 0.2200295776128769, 0.17224003374576569, 0.24014726281166077, 0.2027468979358673, 0.23267236351966858, 0.2181975543498993, 0.22526872158050537, 0.20029038190841675, 0.1863209307193756, 0.19829438626766205, 0.22926747798919678, 0.18782304227352142, 0.19903340935707092, 0.21145157516002655, 0.20335812866687775, 0.21936026215553284, 0.19507180154323578, 0.161751389503479, 0.20948335528373718, 0.16540610790252686, 0.17502406239509583, 0.227451354265213, 0.18766430020332336, 0.21271398663520813, 0.18983983993530273, 0.21147474646568298, 0.20223787426948547, 0.17084136605262756, 0.18709564208984375, 0.181624636054039, 0.19940930604934692, 0.18329596519470215, 0.2112322747707367, 0.1833573281764984, 0.17285016179084778, 0.17316660284996033, 0.20006756484508514, 0.18272365629673004, 0.19811692833900452 ], "train/q_mse": [ 0.05627379084375046 ], "latent/reward_mse": 2.1702486264985055e-05, "eval/q_mse": 0.05627379084375046, "eval/q_mae": 0.23506933954390952, "eval/q_corr": 0.050921992630317124, "eval/q_spearman": 0.07428393350308007, "eval/q_mse_by_n": { "1": 0.0890390743371805, "2": 0.06560755607663402, "4": 0.06144249002532289, "8": 0.055597929424343696, "16": 0.06065228176157518, "32": 0.0582575657367786, "64": 0.05718524699761326, "128": 0.05662805287235198, "256": 0.057369118352628055 }, "eval/q_corr_by_n": { "1": 0.08379193345611254, "2": -0.029921736963810452, "4": -0.007816767436413236, "8": -0.06402912864250075, "16": -0.017607984206427386, "32": 0.01195957887538429, "64": -0.11360552681113051, "128": 0.04791701715106784, "256": 0.04951509644648982 }, "eval/q_mse_vs_N": [ 0.0890390743371805, 0.06560755607663402, 0.06144249002532289, 0.055597929424343696, 0.06065228176157518, 0.0582575657367786, 0.05718524699761326, 0.05662805287235198, 0.057369118352628055 ], "eval/N_final": 256, "eval/truth_std": 0.01145595607353215, "wall_clock_s": 208.27379155158997, "n_anchors": 200}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123{ "method": "mc", "env": "visual-puzzle-3x3-play-v0", "seed": 3, "wandb_url": null, "representation": "puzzle_state_46d", "reward": "dense", "truth_kind": "fresh_rollout", "anchor_protocol": "fresh_reset", "train/loss": [ 0.32887721061706543, 0.0184823889285326, 0.016251366585493088, 0.015726014971733093, 0.016073077917099, 0.015450923703610897, 0.01689937710762024, 0.01215272769331932, 0.014407731592655182, 0.017734870314598083, 0.01689053326845169, 0.01443566009402275, 0.014742393977940083, 0.014288846403360367, 0.015843406319618225, 0.012200770899653435, 0.013554404489696026, 0.011608617380261421, 0.01359566766768694, 0.011341533623635769, 0.010478483512997627, 0.01161889173090458, 0.010681595653295517, 0.00920659489929676, 0.008972404524683952, 0.010758858174085617, 0.010782594792544842, 0.006825141608715057, 0.008270544931292534, 0.007726939860731363, 0.007580457255244255, 0.007060015574097633, 0.008039627224206924, 0.0065657468512654305, 0.00760623486712575, 0.0070298947393894196, 0.005899860057979822, 0.0057176207192242146, 0.005949524696916342, 0.005750499665737152, 0.0046784947626292706, 0.004173046909272671, 0.003770597046241164, 0.004624794237315655, 0.00455064419656992, 0.004738840274512768, 0.004517941270023584, 0.0044085122644901276, 0.004201848059892654, 0.003777845995500684, 0.0032655836548656225 ], "train/q_mse": [ 0.32887721061706543, 0.0184823889285326, 0.016251366585493088, 0.015726014971733093, 0.016073077917099, 0.015450923703610897, 0.01689937710762024, 0.01215272769331932, 0.014407731592655182, 0.017734870314598083, 0.01689053326845169, 0.01443566009402275, 0.014742393977940083, 0.014288846403360367, 0.015843406319618225, 0.012200770899653435, 0.013554404489696026, 0.011608617380261421, 0.01359566766768694, 0.011341533623635769, 0.010478483512997627, 0.01161889173090458, 0.010681595653295517, 0.00920659489929676, 0.008972404524683952, 0.010758858174085617, 0.010782594792544842, 0.006825141608715057, 0.008270544931292534, 0.007726939860731363, 0.007580457255244255, 0.007060015574097633, 0.008039627224206924, 0.0065657468512654305, 0.00760623486712575, 0.0070298947393894196, 0.005899860057979822, 0.0057176207192242146, 0.005949524696916342, 0.005750499665737152, 0.0046784947626292706, 0.004173046909272671, 0.003770597046241164, 0.004624794237315655, 0.00455064419656992, 0.004738840274512768, 0.004517941270023584, 0.0044085122644901276, 0.004201848059892654, 0.003777845995500684, 0.0032655836548656225 ], "eval/q_mse": 0.16179320176005468, "eval/q_mae": 0.38252232596642183, "eval/q_corr": 0.03019245794959327, "eval/q_spearman": 0.047271594047414586, "eval/truth_std": 0.01145595607353215, "wall_clock_s": 50.29546141624451, "n_anchors": 200}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123{ "method": "td", "env": "visual-puzzle-3x3-play-v0", "seed": 3, "wandb_url": null, "representation": "puzzle_state_46d", "reward": "dense", "truth_kind": "fresh_rollout", "anchor_protocol": "fresh_reset", "train/loss": [ 0.002337625715881586, 5.740203505411046e-06, 4.30700356446323e-06, 5.171712473384105e-06, 5.102906470710877e-06, 4.104509116586996e-06, 5.143627276993357e-06, 4.495537268667249e-06, 4.2764086174429394e-06, 4.64982485937071e-06, 3.9826500142225996e-06, 5.766546109953197e-06, 5.146061994310003e-06, 3.4094923648808617e-06, 4.137223186262418e-06, 4.748269020637963e-06, 3.421435849304544e-06, 4.680872280005133e-06, 5.169044925423805e-06, 5.0218741307617165e-06, 3.403627033549128e-06, 7.118766916391905e-06, 3.8282214518403634e-06, 3.5068019315076526e-06, 4.453886504052207e-06, 4.005321443401044e-06, 3.963611561630387e-06, 3.5469520298647694e-06, 3.3036731110769324e-06, 8.62198976392392e-06, 3.7550055367319146e-06, 4.1472167140454985e-06, 5.99345867158263e-06, 3.56340137841471e-06, 6.240554284886457e-06, 4.807648110727314e-06, 5.522140781977214e-06, 4.200266175757861e-06, 4.711405381385703e-06, 5.466799848363735e-06, 3.907559403160121e-06, 3.46969591191737e-06, 3.7734655506937997e-06, 4.850208370044129e-06, 3.5566936276154593e-06, 4.298575731809251e-06, 3.6074325180379674e-06, 3.9186616049846634e-06, 4.085369255335536e-06, 6.069251412554877e-06, 3.325084662719746e-06 ], "train/q_mse": [ 0.002337625715881586, 5.740203505411046e-06, 4.30700356446323e-06, 5.171712473384105e-06, 5.102906470710877e-06, 4.104509116586996e-06, 5.143627276993357e-06, 4.495537268667249e-06, 4.2764086174429394e-06, 4.64982485937071e-06, 3.9826500142225996e-06, 5.766546109953197e-06, 5.146061994310003e-06, 3.4094923648808617e-06, 4.137223186262418e-06, 4.748269020637963e-06, 3.421435849304544e-06, 4.680872280005133e-06, 5.169044925423805e-06, 5.0218741307617165e-06, 3.403627033549128e-06, 7.118766916391905e-06, 3.8282214518403634e-06, 3.5068019315076526e-06, 4.453886504052207e-06, 4.005321443401044e-06, 3.963611561630387e-06, 3.5469520298647694e-06, 3.3036731110769324e-06, 8.62198976392392e-06, 3.7550055367319146e-06, 4.1472167140454985e-06, 5.99345867158263e-06, 3.56340137841471e-06, 6.240554284886457e-06, 4.807648110727314e-06, 5.522140781977214e-06, 4.200266175757861e-06, 4.711405381385703e-06, 5.466799848363735e-06, 3.907559403160121e-06, 3.46969591191737e-06, 3.7734655506937997e-06, 4.850208370044129e-06, 3.5566936276154593e-06, 4.298575731809251e-06, 3.6074325180379674e-06, 3.9186616049846634e-06, 4.085369255335536e-06, 6.069251412554877e-06, 3.325084662719746e-06 ], "eval/q_mse": 0.18596360105044027, "eval/q_mae": 0.4310753625336595, "eval/q_corr": -0.03173402573719374, "eval/q_spearman": -0.03990459237768764, "eval/truth_std": 0.01145595607353215, "wall_clock_s": 120.29559874534607, "n_anchors": 200}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121{ "method": "genq_reward_latent", "env": "visual-puzzle-3x3-play-v0", "seed": 4, "wandb_url": null, "representation": "image_reward_predictive_latent", "occ_model": "diffusion", "z_dim": 8, "reward": "dense", "truth_kind": "fresh_rollout", "anchor_protocol": "fresh_reset", "gen_sample_counts": [ 1, 2, 4, 8, 16, 32, 64, 128, 256 ], "train/loss": [ 1.019892930984497, 0.4248729646205902, 0.24708840250968933, 0.2582969665527344, 0.22500845789909363, 0.2464507818222046, 0.21035492420196533, 0.23091760277748108, 0.21091020107269287, 0.22798123955726624, 0.22061222791671753, 0.23976722359657288, 0.23086977005004883, 0.19707626104354858, 0.22658410668373108, 0.21895770728588104, 0.2098456770181656, 0.23431675136089325, 0.2306627482175827, 0.17886599898338318, 0.21544533967971802, 0.21031345427036285, 0.19956238567829132, 0.2020793855190277, 0.22815555334091187, 0.22237959504127502, 0.18172472715377808, 0.2112666368484497, 0.2072489857673645, 0.1945192962884903, 0.20812903344631195, 0.2288488745689392, 0.19235049188137054, 0.21484673023223877, 0.19197353720664978, 0.24012184143066406, 0.19207161664962769, 0.20557308197021484, 0.1931607574224472, 0.18545930087566376, 0.21581211686134338, 0.2206421196460724, 0.2071656733751297, 0.18323364853858948, 0.2132566273212433, 0.20354220271110535, 0.19931909441947937, 0.2050253450870514, 0.20356571674346924, 0.2419741153717041, 0.17199712991714478 ], "train/q_mse": [ 0.05085395739655462 ], "latent/reward_mse": 2.5474451831541955e-05, "eval/q_mse": 0.05085395739655462, "eval/q_mae": 0.22185915743218212, "eval/q_corr": -0.07876983680106972, "eval/q_spearman": -0.09270143767739743, "eval/q_mse_by_n": { "1": 0.07356545741001524, "2": 0.06689598549545636, "4": 0.06212354072828871, "8": 0.05356314045762392, "16": 0.051019222542325, "32": 0.051775144911726176, "64": 0.05168495096245526, "128": 0.05030355230130683, "256": 0.05120412134205859 }, "eval/q_corr_by_n": { "1": -0.03533544947859579, "2": 0.028833294246466093, "4": -0.05981882305186983, "8": -0.022338602362678286, "16": -0.08931320993877863, "32": -0.00946746217080926, "64": -0.12481975146034914, "128": -0.04517909642739885, "256": -0.07561273191550247 }, "eval/q_mse_vs_N": [ 0.07356545741001524, 0.06689598549545636, 0.06212354072828871, 0.05356314045762392, 0.051019222542325, 0.051775144911726176, 0.05168495096245526, 0.05030355230130683, 0.05120412134205859 ], "eval/N_final": 256, "eval/truth_std": 0.012477610209021018, "wall_clock_s": 240.11588740348816, "n_anchors": 200}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123{ "method": "mc", "env": "visual-puzzle-3x3-play-v0", "seed": 4, "wandb_url": null, "representation": "puzzle_state_46d", "reward": "dense", "truth_kind": "fresh_rollout", "anchor_protocol": "fresh_reset", "train/loss": [ 0.3973221182823181, 0.013537771999835968, 0.015678435564041138, 0.015875155106186867, 0.017030376940965652, 0.015400794334709644, 0.015258473344147205, 0.01566459611058235, 0.010292736813426018, 0.018598206341266632, 0.016016345471143723, 0.012465794570744038, 0.014229320921003819, 0.016180628910660744, 0.01499403826892376, 0.011049514636397362, 0.012883918359875679, 0.013760831207036972, 0.011692577973008156, 0.014100328087806702, 0.012667085975408554, 0.010539358481764793, 0.010846260003745556, 0.009626545011997223, 0.010217661038041115, 0.009936617687344551, 0.009830178692936897, 0.008203509263694286, 0.006727797910571098, 0.0091972965747118, 0.007912425324320793, 0.008086002431809902, 0.008157597854733467, 0.006099458783864975, 0.006586033385246992, 0.006268269848078489, 0.006526589393615723, 0.005477622151374817, 0.004991190508008003, 0.005297564435750246, 0.004588456824421883, 0.005517447367310524, 0.004829523153603077, 0.005221773404628038, 0.004591044038534164, 0.004627092741429806, 0.004188260994851589, 0.004291519522666931, 0.0043603889644145966, 0.0036656265147030354, 0.004810389131307602 ], "train/q_mse": [ 0.3973221182823181, 0.013537771999835968, 0.015678435564041138, 0.015875155106186867, 0.017030376940965652, 0.015400794334709644, 0.015258473344147205, 0.01566459611058235, 0.010292736813426018, 0.018598206341266632, 0.016016345471143723, 0.012465794570744038, 0.014229320921003819, 0.016180628910660744, 0.01499403826892376, 0.011049514636397362, 0.012883918359875679, 0.013760831207036972, 0.011692577973008156, 0.014100328087806702, 0.012667085975408554, 0.010539358481764793, 0.010846260003745556, 0.009626545011997223, 0.010217661038041115, 0.009936617687344551, 0.009830178692936897, 0.008203509263694286, 0.006727797910571098, 0.0091972965747118, 0.007912425324320793, 0.008086002431809902, 0.008157597854733467, 0.006099458783864975, 0.006586033385246992, 0.006268269848078489, 0.006526589393615723, 0.005477622151374817, 0.004991190508008003, 0.005297564435750246, 0.004588456824421883, 0.005517447367310524, 0.004829523153603077, 0.005221773404628038, 0.004591044038534164, 0.004627092741429806, 0.004188260994851589, 0.004291519522666931, 0.0043603889644145966, 0.0036656265147030354, 0.004810389131307602 ], "eval/q_mse": 0.17283664920890093, "eval/q_mae": 0.3975993708263472, "eval/q_corr": 0.01978606616708757, "eval/q_spearman": 0.03376542431958184, "eval/truth_std": 0.012477610209021018, "wall_clock_s": 84.21893644332886, "n_anchors": 200}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123{ "method": "td", "env": "visual-puzzle-3x3-play-v0", "seed": 4, "wandb_url": null, "representation": "puzzle_state_46d", "reward": "dense", "truth_kind": "fresh_rollout", "anchor_protocol": "fresh_reset", "train/loss": [ 0.0016132708406075835, 5.28473719896283e-06, 4.727103259938303e-06, 4.402791091706604e-06, 3.3223111586266896e-06, 3.7768290894746315e-06, 5.115973181091249e-06, 5.008134849049384e-06, 4.792467279912671e-06, 3.981813733844319e-06, 3.7284023619577056e-06, 5.092437277198769e-06, 6.037279945303453e-06, 3.4828635762096383e-06, 3.96143286707229e-06, 5.226540451985784e-06, 4.216956313030096e-06, 3.6615813314710977e-06, 3.93502432416426e-06, 4.533366336545441e-06, 4.87484794575721e-06, 4.411196186993038e-06, 3.908722646883689e-06, 3.9617702896066476e-06, 3.2414773158961907e-06, 3.4550882901385194e-06, 3.6995527352701174e-06, 3.507384462864138e-06, 3.0945584512664936e-06, 3.95306597056333e-06, 5.549504749069456e-06, 3.846819708996918e-06, 5.695990694221109e-06, 4.43494354840368e-06, 4.27822487836238e-06, 4.084134161530528e-06, 3.250039753766032e-06, 3.831450612779008e-06, 6.13951215200359e-06, 4.288238869776251e-06, 4.407696906127967e-06, 3.7216980217635864e-06, 4.2679212128859945e-06, 3.0003220672369935e-06, 4.292792255000677e-06, 5.7487836784275714e-06, 5.628341114061186e-06, 4.015937520307489e-06, 3.1506799587077694e-06, 3.535206815286074e-06, 4.741995326185133e-06 ], "train/q_mse": [ 0.0016132708406075835, 5.28473719896283e-06, 4.727103259938303e-06, 4.402791091706604e-06, 3.3223111586266896e-06, 3.7768290894746315e-06, 5.115973181091249e-06, 5.008134849049384e-06, 4.792467279912671e-06, 3.981813733844319e-06, 3.7284023619577056e-06, 5.092437277198769e-06, 6.037279945303453e-06, 3.4828635762096383e-06, 3.96143286707229e-06, 5.226540451985784e-06, 4.216956313030096e-06, 3.6615813314710977e-06, 3.93502432416426e-06, 4.533366336545441e-06, 4.87484794575721e-06, 4.411196186993038e-06, 3.908722646883689e-06, 3.9617702896066476e-06, 3.2414773158961907e-06, 3.4550882901385194e-06, 3.6995527352701174e-06, 3.507384462864138e-06, 3.0945584512664936e-06, 3.95306597056333e-06, 5.549504749069456e-06, 3.846819708996918e-06, 5.695990694221109e-06, 4.43494354840368e-06, 4.27822487836238e-06, 4.084134161530528e-06, 3.250039753766032e-06, 3.831450612779008e-06, 6.13951215200359e-06, 4.288238869776251e-06, 4.407696906127967e-06, 3.7216980217635864e-06, 4.2679212128859945e-06, 3.0003220672369935e-06, 4.292792255000677e-06, 5.7487836784275714e-06, 5.628341114061186e-06, 4.015937520307489e-06, 3.1506799587077694e-06, 3.535206815286074e-06, 4.741995326185133e-06 ], "eval/q_mse": 0.19437737321053766, "eval/q_mae": 0.4407005841027336, "eval/q_corr": 0.0682576828322628, "eval/q_spearman": 0.08410663393683149, "eval/truth_std": 0.012477610209021018, "wall_clock_s": 176.08823823928833, "n_anchors": 200}12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576"""Run genq(image-latent) + mc + td for visual-puzzle-3x3-play-v0, ONE seed.
The fresh-RESET fresh-rollout truth (ButtonMarkovOracle, match-fraction reward) is theEXPENSIVE part and is identical across the three methods, so we build the shared anchorpack + truth ONCE and pass it to all three. This mirrors the STATE puzzle honest-negativeexactly, only the model observation differs (image latent for genq; 46-D [qpos|qvel]state for the mc/td reference). See ../../genq_visual_puzzle.py for the recipe.
python run_seed.py --seed 0 python run_seed.py --seed 0 --methods genq # subset"""import argparseimport jsonimport osimport sys
_HERE = os.path.dirname(os.path.abspath(__file__))sys.path.insert(0, os.path.join(_HERE, "..", "..")) # preliminary_analysis on path
import torch # noqa: E402_nt = int(os.environ.get("OMP_NUM_THREADS", "0") or 0)if _nt > 0: torch.set_num_threads(_nt)
from config import make_cfg # noqa: E402import genq_visual_puzzle as gvp # noqa: E402
ENV = "visual-puzzle-3x3-play-v0"_FN = {"genq": gvp.run, "mc": gvp.run_mc, "td": gvp.run_td}
def result_path(seed, method): d = os.path.join(_HERE, "results", str(seed)) os.makedirs(d, exist_ok=True) return os.path.join(d, f"{method}.json")
def main(): ap = argparse.ArgumentParser() ap.add_argument("--seed", type=int, default=0) ap.add_argument("--methods", default="genq,mc,td") ap.add_argument("--reward", default="dense") ap.add_argument("--steps", type=int, default=None) ap.add_argument("--latent_steps", type=int, default=None) ap.add_argument("--n_anchors", type=int, default=None) ap.add_argument("--truth_M", type=int, default=None) ap.add_argument("--truth_H", type=int, default=None) ap.add_argument("--vis_train_traj", type=int, default=None) ap.add_argument("--wandb_mode", default="offline") args = ap.parse_args()
ov = {"reward": args.reward, "wandb_mode": args.wandb_mode} for k in ("steps", "latent_steps", "n_anchors", "truth_M", "truth_H", "vis_train_traj"): v = getattr(args, k) if v is not None: ov[k] = v cfg = make_cfg(**ov) # Puzzle reward scale: the match-fraction reward needs no sigma/eps tuning, but # prepare_eval_anchors' manipspace branch (used only by the gc_core path) would set # them; here we build the pack directly, so leave the (unused) defaults.
methods = [m.strip() for m in args.methods.split(",") if m.strip()] pack = None truth = None for method in methods: result, pack, truth = _FN[method](ENV, args.seed, cfg, pack=pack, truth=truth) path = result_path(args.seed, method) with open(path, "w") as f: json.dump(result, f, indent=2, allow_nan=True) print(f"[vis-puzzle] wrote {path} eval/q_mse={result['eval/q_mse']:.5f} " f"eval/q_corr={result.get('eval/q_corr')} truth_std={result['eval/truth_std']:.5f}", flush=True)
if __name__ == "__main__": main()123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566#!/usr/bin/env bash# Sequential visual-puzzle-3x3 policy-eval runner (#35). One seed at a time inside a# single bsub -gpu num=1 allocation (Blue Vela GPUs are exclusive_process — no packed &).# Each seed builds the fresh-RESET truth ONCE and shares it across genq/mc/td.# Image CNN is heavy; keep ONE seed per process. Resume-safe.## bsub -G grp_runtime -q normal -gpu "num=1/task:mode=shared" -M 128G \# -o preliminary_analysis/bsub_outputs/vispuzzle_%J.out \# -e preliminary_analysis/bsub_outputs/vispuzzle_%J.err \# -- bash preliminary_analysis/experiments/visual_puzzle_3x3_play_v0/run_seq.sh "0"set -uSEEDS="${1:-0}"STEPS="${STEPS:-40000}"LATENT_STEPS="${LATENT_STEPS:-20000}"N_ANCHORS="${N_ANCHORS:-200}"TRUTH_M="${TRUTH_M:-8}"TRUTH_H="${TRUTH_H:-200}"
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"ROOT="$(cd "$HERE/../../.." && pwd)"PA="$ROOT/preliminary_analysis"PY="$ROOT/.venv/bin/python"[ -x "$PY" ] || PY="/proj/inf-scaling/zwhong/projs/gen_q/.venv/bin/python"DRIVER="$HERE/run_seed.py"
if [ -f "$ROOT/.env" ]; then set -a; . "$ROOT/.env"; set +a; fiexport OMP_NUM_THREADS=3 MKL_NUM_THREADS=3 OPENBLAS_NUM_THREADS=3export NUMEXPR_NUM_THREADS=3 VECLIB_MAXIMUM_THREADS=3export XLA_FLAGS="--xla_cpu_multi_thread_eigen=false intra_op_parallelism_threads=3"export JAX_PLATFORMS=cpu XLA_PYTHON_CLIENT_MEM_FRACTION=0.3 MUJOCO_GL=eglexport WANDB_MODE=offline# Resolve the OGBench data dir robustly: $HOME differs between login (/proj/...) and# compute (/u/zwhong) nodes, so prefer the proj-space copy where the datasets live.if [ -z "${OGBENCH_DATA_DIR:-}" ]; then for cand in /proj/inf-scaling/zwhong/.ogbench/data "$HOME/.ogbench/data" /u/zwhong/.ogbench/data; do [ -f "$cand/visual-puzzle-3x3-play-v0.npz" ] && OGBENCH_DATA_DIR="$cand" && break donefiexport OGBENCH_DATA_DIR="${OGBENCH_DATA_DIR:-/proj/inf-scaling/zwhong/.ogbench/data}"echo "[vispuzzle-seq] OGBENCH_DATA_DIR=$OGBENCH_DATA_DIR"
mkdir -p "$HERE/results"cd "$PA"echo "[vispuzzle-seq] host=$(hostname) SEEDS='$SEEDS' steps=$STEPS latent=$LATENT_STEPS n_anchors=$N_ANCHORS M=$TRUTH_M H=$TRUTH_H"
fail=0for SEED in $SEEDS; do # Resume: skip a seed only if all three method JSONs already carry fresh_rollout truth. done_all=1 for METHOD in genq mc td; do out="$HERE/results/$SEED/$METHOD.json" grep -q '"truth_kind": "fresh_rollout"' "$out" 2>/dev/null || done_all=0 done if [ "$done_all" = "1" ]; then echo "[vispuzzle-seq] SKIP seed=$SEED (all done)"; continue; fi echo "[vispuzzle-seq] === seed=$SEED ===" "$PY" "$DRIVER" --seed "$SEED" --methods genq,mc,td \ --reward dense --steps "$STEPS" --latent_steps "$LATENT_STEPS" \ --n_anchors "$N_ANCHORS" --truth_M "$TRUTH_M" --truth_H "$TRUTH_H" \ --wandb_mode offline \ > "$HERE/results/seed${SEED}.log" 2>&1 \ || { echo "[vispuzzle-seq] FAILED seed=$SEED"; tail -15 "$HERE/results/seed${SEED}.log"; fail=1; }done
"$PY" plots.py --env "visual-puzzle-3x3-play-v0" || trueecho "[vispuzzle-seq] done fail=$fail"exit "$fail"1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612"""Self-contained goal-conditioned core for the policy-evaluation methods.
This module vendors (copies / lightly adapts) the goal-conditioned occupancy +fresh-rollout machinery so ``preliminary_analysis/`` does not import fromany legacy tree at all. OGBench is goal-conditioned RL, so every quantity here isconditioned on a goal g:
Q^pi(s, a, g) = E_{x ~ d^pi_gamma(. | s, a, g)} [ r(x; g) ], r(x; g) = exp(-||x_xy - g||^2 / 2 sigma^2) (dense) or 1[||x_xy - g|| < eps] (sparse).
The occupancy model is a conditional diffusion (or flow-matching) model p_theta(x_{t+k} | s_t, a_t, g), k ~ Geom(1-gamma).
Goals for training come from HINDSIGHT relabeling (the data has no goal labels):g = xy of a state downstream of the occupancy target in the same trajectory.
GROUND TRUTH (headline, for MSE / correlation) is ALWAYS fresh on-policy rollouts:``gc_fresh_truth_pointmaze`` rolls the data-collection behaviour policy (OGBenchscripted oracle-subgoal controller + N(0,0.2) noise) M times from each anchor andaverages the renormalized discounted goal-reaching return. We never substitutein-dataset return-to-go for the truth."""import numpy as npimport torch
import models
# ----------------------------------------------------------------------------# dataset + geometric-horizon / hindsight-goal sampling# ----------------------------------------------------------------------------def trajectory_bounds(terminals): N = len(terminals) ends = np.where(terminals > 0.5)[0] + 1 if len(ends) == 0 or ends[-1] != N: ends = np.append(ends, N) end_per_idx = np.empty(N, dtype=np.int64) start = 0 for e in ends: end_per_idx[start:e] = e start = e return end_per_idx
MANIPSPACE_FAMILIES = ("cube", "scene", "puzzle")
def manipspace_family(env_id): """Return 'cube' / 'scene' / 'puzzle' for a manipspace env_id, else None.""" for fam in MANIPSPACE_FAMILIES: if env_id.startswith(fam) or f"-{fam}" in env_id or f"_{fam}" in env_id: return fam return None
def is_manipspace(env_id): return manipspace_family(env_id) is not None
def load_ogbench_gc(env_id, gamma, dataset_dir="~/.ogbench/data", state_slice="auto"): """Return (train, val) dicts with obs/act/end.
`state_slice` controls the CONDITIONING state representation in `obs`: - "auto": xy (obs[:, :2]) for mazes, full obs otherwise (back-compat default). - "full": keep the full observation (e.g. AntMaze raw 29-D state occupancy). - "xy": force xy. The occupancy TARGET is always the xy position (first 2 dims) for mazes; callers slice `obs[:, :pos]` for the target. For full-state mazes the conditioning is the full state while the target stays xy — that is "raw N-D state occupancy".
For the **manipspace** families (cube / scene / puzzle) the obs is a lossy projection that does not expose raw object coordinates, so we load the dataset with ``add_info=True`` and derive the per-step occupancy TARGET from privileged qpos (object position; see ``manipspace_target_array``). The conditioning ``obs`` stays the full normalized observation; only the target/goal use privileged coords. The returned dicts then also carry an ``obj`` array ([N, pos_dim]) — the privileged occupancy target — and the methods use ``obj`` instead of ``obs[:, :pos]``. """ import ogbench fam = manipspace_family(env_id) if fam is not None: return _load_manipspace_gc(env_id, fam, dataset_dir) # AntSoccer is special: the task is to dribble the BALL, not move the ant. The # occupancy target / goal is the BALL xy (obs[:, 15:17]), NOT the ant xy (obs[:, :2]). # Conditioning is the full 42-D state; the target rides in `obj` like the manipspace # privileged target. if "antsoccer" in env_id: return _load_antsoccer_gc(env_id, dataset_dir) env, train_ds, val_ds = ogbench.make_env_and_datasets(env_id, dataset_dir=dataset_dir) is_maze = any(k in env_id for k in ("pointmaze", "antmaze", "humanoidmaze", "antsoccer")) # AntSoccer: the reward / occupancy TARGET is the BALL xy, not the agent xy. The # obs is the full MuJoCo state (qpos[22]+qvel[20] == obs[:42]); ball xy = obs[15:17] # (the ball free-joint position). We therefore condition on the FULL 42-D state and # carry a ``target_slice`` so ``_target_array`` / goal sampling read the ball xy. is_antsoccer = "antsoccer" in env_id target_slice = (15, 17) if is_antsoccer else None if state_slice == "auto": mode = "full" if is_antsoccer else ("xy" if is_maze else "full") else: mode = state_slice sl = (lambda x: x[:, :2]) if mode == "xy" else (lambda x: x) out = [] for ds in (train_ds, val_ds): obs = sl(np.asarray(ds["observations"], dtype=np.float32)) act = np.asarray(ds["actions"], dtype=np.float32) end = trajectory_bounds(np.asarray(ds["terminals"], dtype=np.float32)) d = dict(obs=obs, act=act, end=end, N=len(obs), s_dim=obs.shape[1], a_dim=act.shape[1]) if target_slice is not None: d["target_slice"] = target_slice d["pos_dim"] = target_slice[1] - target_slice[0] out.append(d) return out[0], out[1], env, is_maze
# AntSoccer observation layout (verified empirically via set_agent_ball_xy + get_ob):# obs[:, 0:2] = ant (agent) xy# obs[:, 15:17] = BALL xy <- the task-relevant position / occupancy targetANTSOCCER_BALL_SLICE = (15, 17)
def _load_antsoccer_gc(env_id, dataset_dir): """AntSoccer loader. Conditioning obs = full 42-D state; occupancy TARGET = ball xy (obs[:, 15:17]) carried in ``obj`` so ``_target_array`` returns the ball, NOT the ant. ``add_info=True`` provides per-step qpos[22]/qvel[20] for resettable rollouts.""" import ogbench lo, hi = ANTSOCCER_BALL_SLICE env, train_ds, val_ds = ogbench.make_env_and_datasets( env_id, dataset_dir=dataset_dir, add_info=True) out = [] for ds in (train_ds, val_ds): obs = np.asarray(ds["observations"], dtype=np.float32) act = np.asarray(ds["actions"], dtype=np.float32) end = trajectory_bounds(np.asarray(ds["terminals"], dtype=np.float32)) obj = obs[:, lo:hi].copy() # ball xy = occupancy target out.append(dict(obs=obs, act=act, end=end, N=len(obs), s_dim=obs.shape[1], a_dim=act.shape[1], obj=obj, qpos=np.asarray(ds["qpos"], dtype=np.float32), qvel=np.asarray(ds["qvel"], dtype=np.float32), antsoccer=True, pos_dim=2)) return out[0], out[1], env, True
# qpos slices of EVERY block's free-joint position, per family.# Verified for cube-single (block_0 free body is the last 7-D free joint, pos = qpos[14:17])# and cube-double (block_0 = qpos[14:17], block_1 = qpos[21:24]) by matching# info['privileged/block_<i>_pos'] to the qpos slice at reset.def _manipspace_block_qpos_slices(env, fam): """Resolve the per-block qpos slices [lo, hi) giving each cube's 3-D position.
Returns a LIST of (lo, hi) windows, one per block (cube-single -> 1 window, cube-double -> 2). The occupancy TARGET concatenates all block positions so that the model predicts the future configuration of EVERY block; this is required for cube-double where the eval ``target_block`` alternates between blocks and a single fixed block_0 target gives no Q-signal for target_block==1 (see issue #35). For puzzle the occupancy target is the button-state vector (handled separately), so this returns None. """ if fam == "puzzle": return None ob, info = env.reset(seed=0) qpos = np.asarray(info["qpos"], dtype=np.float64) block_keys = sorted(k for k in info if k.startswith("privileged/block_") and k.endswith("_pos")) slices = [] for k in block_keys: bp = np.asarray(info[k], dtype=np.float64) found = None for i in range(len(qpos) - 2): if np.allclose(qpos[i:i + 3], bp, atol=1e-5): found = (i, i + 3) break if found is None: raise gc_core_error(f"could not locate qpos slice for {k} ({fam})") slices.append(found) if not slices: raise gc_core_error(f"no block_*_pos keys found for {fam}") return slices
class gc_core_error(RuntimeError): pass
# ----------------------------------------------------------------------------# Scene multi-task occupancy target: a fixed-dim, task-AGNOSTIC representation.# ----------------------------------------------------------------------------# scene-play-v0 is a *multi-task* env: each episode the data-collection oracle is# keyed on info['privileged/target_task'] in {cube, button, drawer, window} and# manipulates a DIFFERENT object. A cube-only occupancy target (as cube-single uses)# is degenerate here — ~73% of anchors are NOT cube tasks, so the cube barely moves# and a cube-position reward carries no signal. We therefore use the env's own 7-D# *oracle goal representation* (SceneEnv.compute_oracle_observation) as the occupancy# TARGET x and goal g for ALL four tasks. It is fixed-dim and exposes every# manipulated object in one vector:# [ (block_0_pos - center) * 10 (3) | button_states (2) | drawer_pos * 18 (1) |# window_pos * 15 (1) ] == 7-D.# The per-task goal g is this same vector with the manipulated component replaced by# its target value. ||x - g|| then measures how close the manipulated object is to# its target across every task, exactly mirroring the maze xy goal-reaching reward.# See issue #35: this is the documented scene deviation from FRESH_RESET_SPEC's# "target_block_pos" (which only covered the cube sub-task)._SCENE_XYZ_CENTER = np.array([0.425, 0.0, 0.0])_SCENE_XYZ_SCALER = 10.0_SCENE_DRAWER_SCALER = 18.0_SCENE_WINDOW_SCALER = 15.0SCENE_OCC_DIM = 7
def _scene_oracle_vec_from_parts(block0_pos, button_states, drawer_pos, window_pos): """Assemble the 7-D scene oracle representation from raw privileged parts.""" block0_pos = np.asarray(block0_pos, dtype=np.float64).reshape(3) bs = np.asarray(button_states, dtype=np.float64).reshape(-1)[:2] return np.concatenate([ (block0_pos - _SCENE_XYZ_CENTER) * _SCENE_XYZ_SCALER, bs, np.array([float(np.asarray(drawer_pos).ravel()[0]) * _SCENE_DRAWER_SCALER]), np.array([float(np.asarray(window_pos).ravel()[0]) * _SCENE_WINDOW_SCALER]), ]).astype(np.float64)
def _scene_oracle_vec_from_info(info): """7-D scene oracle representation from a live env info dict (current state).""" return _scene_oracle_vec_from_parts( info["privileged/block_0_pos"], info["button_states"], info["privileged/drawer_pos"], info["privileged/window_pos"])
def _scene_target_vec_from_info(info): """7-D scene oracle TARGET config: the current oracle vector with the task's manipulated component replaced by its target value.""" cur = _scene_oracle_vec_from_info(info) task = info["privileged/target_task"] if task == "cube": cur[0:3] = (np.asarray(info["privileged/target_block_pos"], dtype=np.float64) - _SCENE_XYZ_CENTER) * _SCENE_XYZ_SCALER elif task == "button": tb = int(info["privileged/target_button"]) cur[3 + tb] = float(np.asarray(info["privileged/target_button_state"]).ravel()[0]) elif task == "drawer": cur[5] = float(np.asarray(info["privileged/target_drawer_pos"]).ravel()[0]) * _SCENE_DRAWER_SCALER elif task == "window": cur[6] = float(np.asarray(info["privileged/target_window_pos"]).ravel()[0]) * _SCENE_WINDOW_SCALER return cur
def _scene_obj_array_from_dataset(ds): """Reconstruct the per-row 7-D scene oracle target array from dataset qpos + button_states. block_0_pos = qpos[14:17], drawer = qpos[23], window = qpos[24] (verified against the live scene model joint qposadr).""" qpos = np.asarray(ds["qpos"], dtype=np.float64) bs = np.asarray(ds["button_states"], dtype=np.float64) block0 = qpos[:, 14:17] drawer = qpos[:, 23] window = qpos[:, 24] out = np.empty((len(qpos), SCENE_OCC_DIM), dtype=np.float32) out[:, 0:3] = (block0 - _SCENE_XYZ_CENTER[None]) * _SCENE_XYZ_SCALER out[:, 3:5] = bs[:, :2] out[:, 5] = drawer * _SCENE_DRAWER_SCALER out[:, 6] = window * _SCENE_WINDOW_SCALER return out
def _load_manipspace_gc(env_id, fam, dataset_dir): """Manipspace data loader: conditioning obs = full normalized observation, occupancy TARGET = privileged object position (cube), the 7-D oracle representation (scene, multi-task), or the button-state vector (puzzle), derived from the add_info=True dataset (qpos / button_states).""" import ogbench env, train_ds, val_ds = ogbench.make_env_and_datasets( env_id, dataset_dir=dataset_dir, add_info=True) if fam == "puzzle": slice_info = None pos_dim = int(np.asarray(train_ds["button_states"]).shape[1]) elif fam == "scene": slice_info = None pos_dim = SCENE_OCC_DIM else: slice_info = _manipspace_block_qpos_slices(env, fam) # list of (lo, hi) per block pos_dim = sum(hi - lo for (lo, hi) in slice_info) out = [] for ds in (train_ds, val_ds): obs = np.asarray(ds["observations"], dtype=np.float32) act = np.asarray(ds["actions"], dtype=np.float32) end = trajectory_bounds(np.asarray(ds["terminals"], dtype=np.float32)) if fam == "puzzle": obj = np.asarray(ds["button_states"], dtype=np.float32) elif fam == "scene": obj = _scene_obj_array_from_dataset(ds) else: qpos = np.asarray(ds["qpos"], dtype=np.float32) # occupancy target = ALL block positions concatenated [N, 3*n_blocks] obj = np.concatenate([qpos[:, lo:hi] for (lo, hi) in slice_info], axis=1).astype(np.float32) out.append(dict(obs=obs, act=act, end=end, N=len(obs), s_dim=obs.shape[1], a_dim=act.shape[1], obj=obj, manipspace=True, family=fam, pos_dim=pos_dim)) env.close() return out[0], out[1], env, False
def future_idx(t, end, gamma, rng): """Truncated-geometric future index j = t + k, k ~ Geom(1-gamma).""" L = end[t] - t logg = np.log(gamma) Fmax = np.maximum(1.0 - gamma ** L, 1e-12) u = rng.random(len(t)) * Fmax k = np.clip(np.ceil(np.log1p(-u) / logg).astype(np.int64) - 1, 0, L - 1) return t + k
def sample_goal_after(j, end, rng): """Hindsight goal index at or after the occupancy target j (same trajectory).""" e = end[j] span = np.maximum(e - j, 1) return np.clip(j + (rng.random(len(j)) * span).astype(np.int64), 0, e - 1)
def sample_goal_idx(t, end, rng, frac_lo=0.25): """Hindsight goal index downstream of anchor t (biased to latter half).""" L = end[t] - t lo = (frac_lo * L).astype(np.int64) span = np.maximum(L - 1 - lo, 1) return np.clip(t + lo + (rng.random(len(t)) * span).astype(np.int64), 0, end[t] - 1)
def anchors_with_min_horizon(ds, n, min_h, rng): rem = ds["end"] - np.arange(ds["N"]) valid = np.where(rem >= min_h)[0] if len(valid) == 0: valid = np.arange(ds["N"]) return valid[rng.integers(0, len(valid), size=n)]
# ----------------------------------------------------------------------------# goal-reaching reward# ----------------------------------------------------------------------------def reward_of_dist(d, kind, sigma, eps): if kind == "sparse": return (d < eps).astype(np.float64) return np.exp(-(d ** 2) / (2 * sigma ** 2))
def reward_of_dist_t(d, kind, sigma, eps): if kind == "sparse": return (d < eps).float() return torch.exp(-(d ** 2) / (2 * sigma ** 2))
# ----------------------------------------------------------------------------# PUZZLE-specific button-state reward (issue #35 caveat fix)# ----------------------------------------------------------------------------# The puzzle occupancy TARGET x and goal g are BINARY button-state vectors# (length = num_buttons: 9 for 3x3, 16 for 4x4), NOT object positions. The shared# position-distance reward `reward_of_dist` with the manip default sigma=0.05 / eps=0.04# is meaningless here: ||x - g|| = sqrt(Hamming distance), which is 0..sqrt(num_buttons)# (and is exactly 1 at the anchor, where g differs from the current state in the single# target button). exp(-1 / (2*0.05^2)) = exp(-200) ~ 0 saturates the reward to 0 for# every realistic Hamming distance, so the truth has ~no spread and Q is unrankable.## Principled replacement (used IDENTICALLY by occ_q, MC, TD and the fresh-rollout truth):# r(x; g) = match-fraction = mean( round(x) == round(g) ) -- continuous in [0,1].# This is the natural "task-progress toward the goal button pattern" reward: 1 when the# realized button vector equals the goal pattern, ~ (num_buttons-1)/num_buttons at the# anchor (one button off). It is invariant to the binary embedding scale and needs no# sigma tuning. Occupancy samples x are continuous (diffusion output) so we round each# coordinate to the nearest bit before comparison.# sparse variant: r = 1[ all buttons match ] = 1[ Hamming(x,g) == 0 ] -- exact pattern# match (== the env's own Lights-Out success), continuous methods see it as 1[ match# fraction == 1 ].PUZZLE_MATCH_TOL = 0.5 # |round to nearest bit| threshold
def puzzle_reward(x, g, kind): """Button-state match-fraction reward (numpy). x, g: [..., num_buttons].""" x = np.asarray(x, dtype=np.float64) g = np.asarray(g, dtype=np.float64) match = (np.abs(np.round(x) - np.round(g)) < PUZZLE_MATCH_TOL).astype(np.float64) frac = match.mean(axis=-1) if kind == "sparse": return (frac >= 1.0 - 1e-9).astype(np.float64) # exact full-pattern match return frac
def puzzle_reward_t(x, g, kind): """Button-state match-fraction reward (torch). x: [..., D], g: [..., D].""" match = (torch.abs(torch.round(x) - torch.round(g)) < PUZZLE_MATCH_TOL).float() frac = match.mean(dim=-1) if kind == "sparse": return (frac >= 1.0 - 1e-9).float() return frac
# ----------------------------------------------------------------------------# occupancy model build / train / Q (all goal-conditioned)# ----------------------------------------------------------------------------def build_occupancy(occ_model, cond_dim, y_dim, cfg, device): if occ_model == "diffusion": m = models.ConditionalDiffusion(cond_dim, y_dim, hidden_dim=cfg["hidden_dim"], num_layers=cfg["num_layers"], T=cfg.get("diffusion_T", 100), sample_steps=cfg.get("sample_steps", 30)) elif occ_model == "flow": m = models.ConditionalFlowMatching(cond_dim, y_dim, hidden_dim=cfg["hidden_dim"], num_layers=cfg["num_layers"], sample_steps=cfg.get("sample_steps", 30)) else: raise ValueError(f"occ_model must be 'diffusion' or 'flow', got {occ_model!r}") return m.to(device)
def _target_array(ds, cfg): """Occupancy TARGET x per dataset row: privileged object position for manipspace / AntSoccer (``ds['obj']`` — ball xy for antsoccer), a non-leading slice of the obs when ``target_slice`` is set, else the leading xy slice of the obs (mazes).""" if ds.get("manipspace") or ds.get("antsoccer"): return ds["obj"] ts = ds.get("target_slice") if ts is not None: lo, hi = ts return ds["obs"][:, lo:hi] pos = cfg.get("pos_dim", 2) return ds["obs"][:, :pos]
def train_gc_occupancy(occ, ds, gamma, cfg, device, seed, wandb_log=None): """Train p_theta(x_{t+k} | s, a, g) on geometric-horizon targets x with hindsight goals. For mazes x = future xy; for manipspace x = future privileged object position (the goal g is a hindsight object position downstream). Returns the periodic loss curve.""" obs, act, end = ds["obs"], ds["act"], ds["end"] pos = cfg.get("pos_dim", 2) xy = _target_array(ds, cfg) # [N, pos] occupancy target (obj pos or xy) rng = np.random.default_rng(seed) # normalization from a sample t0 = rng.integers(0, ds["N"], 20000) j0 = future_idx(t0, end, gamma, rng) g0 = xy[sample_goal_after(j0, end, rng)] c0 = np.concatenate([obs[t0], act[t0], g0], 1) occ.set_normalization(c0.mean(0), c0.std(0) + 1e-6, xy[j0].mean(0), xy[j0].std(0) + 1e-6) opt = torch.optim.Adam(occ.parameters(), lr=cfg["lr"]) losses = [] log_every = max(1, cfg["steps"] // 50) for step in range(1, cfg["steps"] + 1): t = rng.integers(0, ds["N"], cfg["batch_size"]) j = future_idx(t, end, gamma, rng) g = xy[sample_goal_after(j, end, rng)] c = np.concatenate([obs[t], act[t], g], 1) loss = occ.training_loss(torch.as_tensor(c, dtype=torch.float32, device=device), torch.as_tensor(xy[j], dtype=torch.float32, device=device)) opt.zero_grad(); loss.backward() gn = torch.nn.utils.clip_grad_norm_(occ.parameters(), 10.0) opt.step() if step % log_every == 0 or step == 1: losses.append(float(loss.item())) if wandb_log: wandb_log({"train/loss": float(loss.item()), "train/grad_norm": float(gn)}, step=step) occ.eval() return losses
@torch.no_grad()def occ_q(occ, s, a, g, N, sigma, device, kind="dense", eps=0.5, batch=256, family=None): """Q(s,a,g) = mean over N occupancy samples of the goal-reaching reward.
For puzzle (family=="puzzle") x,g are binary button-state vectors and the reward is the match-fraction (``puzzle_reward_t``), NOT the position-distance reward — see ``puzzle_reward`` for the rationale (issue #35). For all other families x,g are positions and the reward is ``reward_of_dist_t(||x - g||)``.""" out = np.zeros(len(s)) for i in range(0, len(s), batch): sb, ab, gb = s[i:i+batch], a[i:i+batch], g[i:i+batch] c = np.concatenate([sb, ab, gb], 1) ct = torch.as_tensor(c, dtype=torch.float32, device=device) x = occ.sample(ct, N) # [B, N, pos] gt = torch.as_tensor(gb, dtype=torch.float32, device=device).unsqueeze(1) if family == "puzzle": out[i:i+batch] = puzzle_reward_t(x, gt, kind).mean(1).cpu().numpy() else: d = torch.norm(x - gt, dim=-1) out[i:i+batch] = reward_of_dist_t(d, kind, sigma, eps).mean(1).cpu().numpy() return out
# ----------------------------------------------------------------------------# fresh-rollout ground truth (PointMaze): goal-conditioned, on-policy# ----------------------------------------------------------------------------def build_vertex_cells(maze_map): mm = np.asarray(maze_map); I, J = mm.shape def free(i, j): return 0 <= i < I and 0 <= j < J and mm[i, j] == 0 vc = [] for i in range(I): for j in range(J): if mm[i, j] == 0: hx = free(i, j - 1) or free(i, j + 1) hy = free(i - 1, j) or free(i + 1, j) if hx and hy: vc.append((i, j)) return vc
def gc_fresh_truth_pointmaze(env_id, s_anc, a_anc, g_anc, gamma, kind, sigma, eps, M=8, H=350, seed=0, verbose=True): """Fresh-rollout Q^pi(s, a, g) truth for PointMaze anchors.
For each anchor (s_i, a_i, g_i): set the env to s_i, apply the recorded action a_i first (conditioning Q on (s,a)), infer the latent navigation goal from a_i, then roll the scripted oracle-subgoal + N(0,0.2) controller for H steps. Average the renormalized discounted goal-reaching return toward g_i over M rollouts. The rollout trajectory is independent of g_i (the controller follows its own latent goal), so this is a low-variance unbiased estimate of Q^pi(s,a,g). """ import ogbench # For the self-rendered visual-pointmaze cell the env_id carries a "visual-" prefix, # but only the STATE pointmaze env is registered (and its dynamics/oracle are what we # roll for truth). Strip the prefix so the live env is created (cf. the antmaze truth, # which does the same). The image-ness only affects the OCCUPANCY model input. env_name = env_id.replace("visual-", "") env, _, _ = ogbench.make_env_and_datasets(env_name) u = env.unwrapped env.reset() vertex = build_vertex_cells(u.maze_map) vertex_xy = np.array([u.ij_to_xy(ij) for ij in vertex]) rng = np.random.default_rng(seed) disc = (1 - gamma) * gamma ** np.arange(H + 1) mass = disc.sum()
def goal_posterior(s_xy, a): dirs = np.zeros((len(vertex), 2)) for k, gxy in enumerate(vertex_xy): sg, _ = u.get_oracle_subgoal(s_xy, gxy) d = sg - s_xy dirs[k] = d / (np.linalg.norm(d) + 1e-6) w = np.exp(-((a[None, :2] - dirs) ** 2).sum(1) / (2 * 0.2 ** 2)) ssum = w.sum() return (w / ssum) if ssum > 1e-12 else np.ones(len(vertex)) / len(vertex)
A = len(s_anc) truth = np.zeros(A) for ai in range(A): s_i = np.asarray(s_anc[ai][:2], dtype=np.float64).copy() a_i = np.asarray(a_anc[ai], dtype=np.float64).copy() g_i = np.asarray(g_anc[ai][:2], dtype=np.float64) gpost = goal_posterior(s_i, a_i) ret = 0.0 for _ in range(M): g_ij = vertex[rng.choice(len(vertex), p=gpost)] u.set_xy(s_i.copy()) u.set_goal(goal_ij=g_ij) xys = [u.get_xy().copy()] _, _, _, _, info = u.step(a_i) xys.append(u.get_xy().copy()) if info.get("success", False): u.set_goal(goal_ij=vertex[rng.integers(len(vertex))]) for _t in range(1, H): xy = u.get_xy() sg, _ = u.get_oracle_subgoal(xy, u.cur_goal_xy) d = sg - xy d = d / (np.linalg.norm(d) + 1e-6) a = np.clip(d + rng.normal(0, 0.2, 2), -1, 1) _, _, _, _, info = u.step(a) xys.append(u.get_xy().copy()) if info.get("success", False): u.set_goal(goal_ij=vertex[rng.integers(len(vertex))]) xys = np.asarray(xys) d2g = np.linalg.norm(xys - g_i[None], axis=1) rr = reward_of_dist(d2g, kind, sigma, eps) ret += float((disc * rr).sum() / mass) truth[ai] = ret / M if verbose and (ai + 1) % 100 == 0: print(f" [gc-fresh-truth] anchor {ai+1}/{A}", flush=True) env.close() return truth
# ----------------------------------------------------------------------------# fresh-rollout ground truth (AntMaze / visual-AntMaze): SAC expert + oracle subgoal# ----------------------------------------------------------------------------def _load_ant_sac_expert(seed=0): """Load the OGBench SAC locomotion expert used to collect AntMaze data. The repo's `utils`/`agents` packages clash with our module names, so we import with the repo on the path, then clean sys.modules. Returns actor_fn(agent_ob, temperature)->action[8].""" import os import sys import json import numpy as np here = os.path.dirname(os.path.abspath(__file__)) repo = os.path.normpath(os.path.join(here, "..", "ogbench_repo")) impls = os.path.join(repo, "impls") expert = os.path.join(repo, "data_gen_scripts", "experts", "ant") if not os.path.exists(os.path.join(expert, "params_400000.pkl")): raise FreshRolloutUnavailable( f"AntMaze SAC expert checkpoint not found at {expert}/params_400000.pkl") os.environ.setdefault("JAX_PLATFORMS", "cpu") sys.path.insert(0, impls) try: from agents import SACAgent from utils.flax_utils import restore_agent from utils.evaluation import supply_rng agent_cfg = json.load(open(os.path.join(expert, "flags.json")))["agent"] agent = SACAgent.create(seed, np.zeros(29), np.zeros(8), agent_cfg) agent = restore_agent(agent, expert, 400000) actor_fn = supply_rng(agent.sample_actions, rng=agent.rng) finally: if impls in sys.path: sys.path.remove(impls) for mod in [m for m in list(sys.modules) if m == "utils" or m.startswith("utils.") or m == "agents" or m.startswith("agents.")]: del sys.modules[mod] return actor_fn
class FreshRolloutUnavailable(RuntimeError): """Raised when an env *should* support fresh rollouts but a needed asset (e.g. the SAC expert checkpoint) is missing — distinct from envs that fundamentally cannot."""
def gc_fresh_truth_antmaze(env_id, s_anc, a_anc, g_anc, gamma, kind, sigma, eps, M=8, H=300, Khead=20, seed=0, verbose=True, anchor_full=None): """Fresh-rollout Q^pi(s,a,g) truth for AntMaze, using the EXACT data-collection policy: pretrained SAC locomotion expert + oracle-BFS subgoal waypoints + N(0,0.2) noise. The 29-D obs is qpos[15]+qvel[14], so the env IS resettable to a dataset anchor via set_state. Visual-AntMaze shares ant dynamics; pass `anchor_full` (the [A,29] full qpos+qvel anchor states) when the obs itself is an image. """ import numpy as np import ogbench actor_fn = _load_ant_sac_expert(seed) env_name = env_id.replace("visual-", "") env = ogbench.make_env_and_datasets(env_name, env_only=True) u = env.unwrapped env.reset() vertex = build_vertex_cells(u.maze_map) vertex_xy = np.array([u.ij_to_xy(ij) for ij in vertex]) rng = np.random.default_rng(seed) disc = (1 - gamma) * gamma ** np.arange(H + 1)
full = anchor_full if anchor_full is not None else s_anc
def goal_posterior(s_xy, heading): dirs = np.zeros((len(vertex), 2)) for k, gxy in enumerate(vertex_xy): sg, _ = u.get_oracle_subgoal(s_xy, gxy) d = sg - s_xy dirs[k] = d / (np.linalg.norm(d) + 1e-6) w = np.exp((dirs @ heading) / 0.3) return w / w.sum()
A = len(full) truth = np.zeros(A) for ai in range(A): s_full = np.asarray(full[ai], dtype=np.float64) a_i = np.asarray(a_anc[ai], dtype=np.float64) g_i = np.asarray(g_anc[ai][:2], dtype=np.float64) # heading toward the recorded near-future: approximate via the action direction head = a_i[:2] if np.linalg.norm(a_i[:2]) > 1e-6 else np.array([1.0, 0.0]) head = head / (np.linalg.norm(head) + 1e-6) gpost = goal_posterior(s_full[:2], head) ret = 0.0 for _ in range(M): g_ij = vertex[rng.choice(len(vertex), p=gpost)] u.set_state(s_full[:15].copy(), s_full[15:29].copy()) u.set_goal(goal_ij=g_ij) xys = [u.get_xy().copy()] _, _, term, trunc, info = env.step(a_i) xys.append(u.get_xy().copy()) if info.get("success", False): u.set_goal(goal_ij=vertex[rng.integers(len(vertex))]) for _t in range(1, H): sg, _ = u.get_oracle_subgoal(u.get_xy(), u.cur_goal_xy) d = sg - u.get_xy() d = d / (np.linalg.norm(d) + 1e-6) ag_ob = np.concatenate([u.get_ob(ob_type="states")[2:], d]) act = np.clip(np.asarray(actor_fn(ag_ob, temperature=0)) + rng.normal(0, 0.2, 8), -1, 1) _, _, term, trunc, info = env.step(act) xys.append(u.get_xy().copy()) if info.get("success", False): u.set_goal(goal_ij=vertex[rng.integers(len(vertex))]) if term or trunc: break xys = np.asarray(xys) n = len(xys) d2g = np.linalg.norm(xys - g_i[None], axis=1) rr = reward_of_dist(d2g, kind, sigma, eps) ret += float((disc[:n] * rr).sum() / disc[:n].sum()) truth[ai] = ret / M if verbose and (ai + 1) % 25 == 0: print(f" [gc-fresh-truth-ant] anchor {ai+1}/{A}", flush=True) env.close() return truth
# ----------------------------------------------------------------------------# fresh-rollout ground truth (AntSoccer): ant SAC loco expert + antball SAC dribble# expert + oracle subgoal (the EXACT data-collection controller). Goal = BALL xy.# ----------------------------------------------------------------------------def _load_antball_sac_expert(seed=0): """Load the TWO SAC experts that the AntSoccer data-collection controller uses (``generate_antsoccer.py``):
* the ant *locomotion* expert (``experts/ant``, epoch 400000) that navigates the ANT to the ball — agent obs = ob[2:15] (13 joint pos) + ob[22:36] (14 ant qvel) + 2-D oracle-subgoal direction = 29-D, action = 8-D; * the *antball* dribble expert (``experts/antball``, epoch 12000000) that dribbles the BALL to a subgoal — agent obs = ob[2:15] (13) + ob[17:] (25: ball pose+all qvel) + (ball_xy - agent_xy) (2) + (subgoal_xy - ball_xy) (2) = 42-D, action 8-D.
Mirrors ``_load_ant_sac_expert`` (import the repo's ``impls`` package, restore, then clean sys.modules). Returns ``(loco_actor_fn, ball_actor_fn)``, each ``actor_fn(agent_ob, temperature) -> action[8]``. JAX is forced to CPU.""" import os import sys import json import glob import numpy as np here = os.path.dirname(os.path.abspath(__file__)) repo = os.path.normpath(os.path.join(here, "..", "ogbench_repo")) impls = os.path.join(repo, "impls") experts_dir = os.path.join(repo, "data_gen_scripts", "experts") loco_dir = os.path.join(experts_dir, "ant") ball_dir = os.path.join(experts_dir, "antball") if not os.path.exists(os.path.join(loco_dir, "params_400000.pkl")): raise FreshRolloutUnavailable( f"AntSoccer ant loco expert not found at {loco_dir}/params_400000.pkl") if not glob.glob(os.path.join(ball_dir, "params_12000000.pkl")): raise FreshRolloutUnavailable( f"AntSoccer antball dribble expert not found at {ball_dir}/params_12000000.pkl") os.environ.setdefault("JAX_PLATFORMS", "cpu") sys.path.insert(0, impls) try: from agents import SACAgent from utils.flax_utils import restore_agent from utils.evaluation import supply_rng
def _load(expert_dir, epoch, ob_dim): cfg = json.load(open(os.path.join(expert_dir, "flags.json")))["agent"] ag = SACAgent.create(seed, np.zeros(ob_dim), np.zeros(8), cfg) ag = restore_agent(ag, expert_dir, epoch) return supply_rng(ag.sample_actions, rng=ag.rng)
loco_actor_fn = _load(loco_dir, 400000, 29) ball_actor_fn = _load(ball_dir, 12000000, 42) finally: if impls in sys.path: sys.path.remove(impls) for mod in [m for m in list(sys.modules) if m == "utils" or m.startswith("utils.") or m == "agents" or m.startswith("agents.")]: del sys.modules[mod] return loco_actor_fn, ball_actor_fn
def _nearest_free_cell_xy(u, cells_xy, xy): """Index of the free maze cell whose center is closest to a target xy.""" return int(np.argmin(np.linalg.norm(cells_xy - np.asarray(xy)[None], axis=1)))
def gc_fresh_truth_antsoccer(env_id, s_anc, a_anc, g_anc, gamma, kind, sigma, eps, M=4, H=300, seed=0, verbose=True, anchor_full=None): """Fresh-rollout Q^pi(s, a, g) truth for AntSoccer, using the EXACT data-collection controller from ``generate_antsoccer.py``: an ant SAC loco expert that walks the ant to the ball when it is far (``||agent_xy - ball_xy|| > 2``), and an antball SAC dribble expert that drives the ball toward the oracle subgoal otherwise, plus the same N(0, 0.2) action noise. On goal success a new random goal cell is sampled (the 'navigate' generator behaviour). The OCCUPANCY TARGET and REWARD are on the BALL xy (obs[15:17]); g is a ball goal xy. The 42-D obs IS the full qpos[22]+qvel[20] state, so each anchor is reset via ``set_state`` (dataset-anchor protocol, like AntMaze). The controller dribbles toward the free maze cell nearest to the anchor goal g_i, so the rolled policy is consistent with the goal Q(s,a,g) is queried at. """ import numpy as np import ogbench loco_actor_fn, ball_actor_fn = _load_antball_sac_expert(seed) # terminate_at_goal=False so a rollout keeps accumulating reward across multiple goal # completions (per FRESH_RESET_SPEC) — the discounted occupancy reward is defined over # the full geometric horizon, not cut short at the first ball-goal success. env = ogbench.make_env_and_datasets( env_id, env_only=True, terminate_at_goal=False, max_episode_steps=H + 5) u = env.unwrapped env.reset() mm = np.asarray(u.maze_map) cells = [(i, j) for i in range(mm.shape[0]) for j in range(mm.shape[1]) if mm[i, j] == 0] cells_xy = np.array([u.ij_to_xy(ij) for ij in cells]) rng = np.random.default_rng(seed) disc = (1 - gamma) * gamma ** np.arange(H + 1)
full = anchor_full if anchor_full is not None else s_anc
def loco_action(ob, goal_xy): sg, _ = u.get_oracle_subgoal(ob[:2], goal_xy) d = sg - ob[:2] d = d / (np.linalg.norm(d) + 1e-6) agent_ob = np.concatenate([ob[2:15], ob[22:36], d]) return np.asarray(loco_actor_fn(agent_ob, temperature=0))
def ball_action(ob, agent_xy, ball_xy, goal_xy): sg, _ = u.get_oracle_subgoal(ball_xy, goal_xy) agent_ob = np.concatenate([ob[2:15], ob[17:], ball_xy - agent_xy, sg - ball_xy]) return np.asarray(ball_actor_fn(agent_ob, temperature=0))
A = len(full) truth = np.zeros(A) for ai in range(A): s_full = np.asarray(full[ai], dtype=np.float64) a_i = np.asarray(a_anc[ai], dtype=np.float64) g_i = np.asarray(g_anc[ai][:2], dtype=np.float64) # ball goal xy g_cell0 = cells[_nearest_free_cell_xy(u, cells_xy, g_i)] ret = 0.0 for _ in range(M): u.set_state(s_full[:22].copy(), s_full[22:].copy()) u.set_goal(goal_ij=g_cell0) ball_xy0 = np.asarray(u.get_agent_ball_xy()[1]) balls = [ball_xy0.copy()] # step 0: the recorded behaviour action a_i (conditioning Q on (s,a)). ob, _, term, trunc, info = env.step(np.clip(a_i, -1, 1)) balls.append(np.asarray(u.get_agent_ball_xy()[1]).copy()) if info.get("success", False): u.set_goal(goal_ij=cells[rng.integers(len(cells))]) for _t in range(1, H): agent_xy, ball_xy = map(np.asarray, u.get_agent_ball_xy()) goal_xy = np.asarray(u.cur_goal_xy) if np.linalg.norm(agent_xy - ball_xy) > 2: act = loco_action(ob, ball_xy) else: act = ball_action(ob, agent_xy, ball_xy, goal_xy) act = np.clip(act + rng.normal(0, 0.2, act.shape), -1, 1) ob, _, term, trunc, info = env.step(act) balls.append(np.asarray(u.get_agent_ball_xy()[1]).copy()) if info.get("success", False): u.set_goal(goal_ij=cells[rng.integers(len(cells))]) if term or trunc: break balls = np.asarray(balls) n = len(balls) d2g = np.linalg.norm(balls - g_i[None], axis=1) rr = reward_of_dist(d2g, kind, sigma, eps) ret += float((disc[:n] * rr).sum() / disc[:n].sum()) truth[ai] = ret / M if verbose and (ai + 1) % 25 == 0: print(f" [gc-fresh-truth-antsoccer] anchor {ai+1}/{A}", flush=True) env.close() return truth
# ----------------------------------------------------------------------------# fresh-reset anchor protocol (manipspace: cube / scene / puzzle) — Protocol B# ----------------------------------------------------------------------------def _make_manipspace_env(env_id, dataset_dir="~/.ogbench/data"): """Build the live manipspace env per FRESH_RESET_SPEC: data_collection mode, terminate_at_goal=False, long horizon. Returns the gym env.""" import ogbench return ogbench.make_env_and_datasets( env_id, env_only=True, terminate_at_goal=False, mode="data_collection", max_episode_steps=1001, dataset_dir=dataset_dir)
def _make_manipspace_oracles(env, fam): """Family-keyed live markov oracles (NOISY-equivalent closed loop). Returns a dict keyed by ``info['privileged/target_task']`` so set_new_target re-keying works.""" from ogbench.manipspace.oracles.markov.button_markov import ButtonMarkovOracle from ogbench.manipspace.oracles.markov.cube_markov import CubeMarkovOracle if fam == "cube": return {"cube": CubeMarkovOracle(env=env, min_norm=0.4)} if fam == "puzzle": return {"button": ButtonMarkovOracle(env=env, min_norm=0.4, gripper_always_closed=True)} if fam == "scene": from ogbench.manipspace.oracles.markov.drawer_markov import DrawerMarkovOracle from ogbench.manipspace.oracles.markov.window_markov import WindowMarkovOracle return { "cube": CubeMarkovOracle(env=env, min_norm=0.4, max_step=100), "button": ButtonMarkovOracle(env=env, min_norm=0.4), "drawer": DrawerMarkovOracle(env=env, min_norm=0.4), "window": WindowMarkovOracle(env=env, min_norm=0.4), } raise gc_core_error(f"no manipspace oracle for family {fam!r}")
def _manipspace_block_positions(info): """All blocks' current 3-D positions concatenated [3*n_blocks], in block index order (matches the occupancy-target layout from ``_manipspace_block_qpos_slices``).""" block_keys = sorted(k for k in info if k.startswith("privileged/block_") and k.endswith("_pos") and k != "privileged/target_block_pos") return np.concatenate([np.asarray(info[k], dtype=np.float64) for k in block_keys])
def _manipspace_goal(info, fam): """Privileged goal g for an anchor, in the SAME layout as the occupancy target: cube: all-blocks position vector [3*n_blocks] where the target block's slot is its goal (``target_block_pos``) and every distractor block's slot is its CURRENT position — so ||x-g|| rewards moving the target block to its goal while the distractors stay put (cube-single: identical to the old 3-D goal; cube-double: 6-D, the fix for the alternating target_block). scene: the 7-D scene oracle TARGET config (multi-task). puzzle: target button-state vector. """ if fam == "puzzle": # full target button-state pattern (current states with the target button flipped) cur = np.asarray(info["button_states"], dtype=np.float64).copy() tb = int(info["privileged/target_button"]) cur[tb] = float(info["privileged/target_button_state"]) return cur if fam == "scene": return _scene_target_vec_from_info(info) g = _manipspace_block_positions(info).copy() # current positions of all blocks tb = int(info["privileged/target_block"]) g[tb * 3:tb * 3 + 3] = np.asarray(info["privileged/target_block_pos"], dtype=np.float64) return g
def _manipspace_object(info, fam): """Privileged current object value x for reward accumulation, SAME layout as the occupancy target: all blocks' current positions (cube), the current 7-D scene oracle vector (scene, multi-task), or the current button-state vector (puzzle).""" if fam == "puzzle": return np.asarray(info["button_states"], dtype=np.float64) if fam == "scene": return _scene_oracle_vec_from_info(info) return _manipspace_block_positions(info)
def prepare_eval_anchors(env_id, val_ds, cfg, seed): """Return the (s, a, g) anchors a method queries Q at, plus metadata for truth.
Returns a dict: s, a, g : [A, .] conditioning state, behaviour action, goal (the model query) anchor_idx : [A] dataset indices (mazes) or None (manipspace) anchor_full : full qpos+qvel anchor states for antmaze-full, else None anchors_pack : fresh-reset pack (manipspace) or None anchor_protocol: "dataset_anchor" (mazes) | "fresh_reset" (manipspace)
Maze path is unchanged from the original per-method code; manipspace uses ``fresh_reset_anchors`` so the SAME anchors feed both Q(s,a,g) and the truth. """ pos = cfg.get("pos_dim", 2) if is_manipspace(env_id): # manipulation reward scale (NOT the maze sigma=5 / eps=0.5) unless the caller # explicitly overrode it. The maze defaults are meaningless at object scale. if not cfg.get("_reward_scale_set"): fam = manipspace_family(env_id) if fam == "scene": # scene uses the 7-D oracle-space occupancy target (not raw 3-D meters): # block xyz is scaled x10, drawer x18, window x15, button states are 0/1, # so within-task moves are ~1-3 oracle units. Use a reward bandwidth at # that scale (NOT the cube 0.05/0.04 meter scale). if abs(cfg.get("sigma", 5.0) - 5.0) < 1e-9: cfg["sigma"] = 0.5 if abs(cfg.get("epsilon", 0.5) - 0.5) < 1e-9: cfg["epsilon"] = 0.5 else: if abs(cfg.get("sigma", 5.0) - 5.0) < 1e-9: cfg["sigma"] = 0.05 if abs(cfg.get("epsilon", 0.5) - 0.5) < 1e-9: cfg["epsilon"] = 0.04 cfg["_reward_scale_set"] = True pack = fresh_reset_anchors(env_id, cfg["n_anchors"], seed) return dict(s=pack["s"], a=pack["a"], g=pack["g"], anchor_idx=None, anchor_full=None, anchors_pack=pack, anchor_protocol="fresh_reset") rng = np.random.default_rng(seed) anchors = anchors_with_min_horizon(val_ds, cfg["n_anchors"], cfg["min_horizon"], rng) s_a = val_ds["obs"][anchors]; a_a = val_ds["act"][anchors] # Goal lives in TARGET space: ball xy for antsoccer (via ds['obj']), agent xy for # other mazes. _target_array returns ds['obj'] for antsoccer, obs xy slice for mazes. target = _target_array(val_ds, cfg) g_a = target[sample_goal_idx(anchors, val_ds["end"], rng)][:, :pos] state_slice = cfg.get("state_slice", "auto") # The fresh-rollout truth needs the FULL obs to set_state. AntSoccer obs IS the full # qpos+qvel state (always full), so pass anchor_full unconditionally for it. anchor_full = s_a if (("antsoccer" in env_id) or (state_slice == "full" and ("antmaze" in env_id or "humanoidmaze" in env_id))) else None return dict(s=s_a, a=a_a, g=g_a, anchor_idx=anchors, anchor_full=anchor_full, anchors_pack=None, anchor_protocol="dataset_anchor")
def fresh_reset_anchors(env_id, n_anchors, seed, dataset_dir="~/.ogbench/data"): """Protocol B fresh-reset anchors for a manipspace env.
Does ``n_anchors`` independent ``env.reset(seed=...)`` calls (a valid in-distribution start each time) and records per anchor: s : obs (full normalized observation, the conditioning state) qpos : full MuJoCo qpos qvel : full MuJoCo qvel (for set_state) g : privileged goal (target object position 3-D, or puzzle target button-state) a : first oracle action at the reset state (behavior-policy action for Q(s,a)) obj0 : privileged object value at reset (for reference) The SAME anchors are used to query Q(s,a,g) AND to compute the fresh-rollout truth, so the two align per-anchor. Returns a dict of stacked arrays + the family. """ fam = manipspace_family(env_id) if fam is None: raise gc_core_error(f"fresh_reset_anchors called for non-manipspace env {env_id}") env = _make_manipspace_env(env_id, dataset_dir) u = env.unwrapped oracles = _make_manipspace_oracles(env, fam) S, A, G, QP, QV, OBJ, TGT = [], [], [], [], [], [], [] for i in range(n_anchors): np.random.seed(seed * 100003 + i) # oracles use global np.random ob, info = env.reset(seed=seed * 100003 + i) oracle = oracles[info["privileged/target_task"]] oracle.reset(ob, info) a0 = np.clip(np.asarray(oracle.select_action(ob, info), dtype=np.float64), -1, 1) S.append(np.asarray(ob, dtype=np.float32)) A.append(a0.astype(np.float32)) G.append(_manipspace_goal(info, fam).astype(np.float32)) QP.append(np.asarray(info["qpos"], dtype=np.float64)) QV.append(np.asarray(info["qvel"], dtype=np.float64)) OBJ.append(_manipspace_object(info, fam).astype(np.float32)) TGT.append(_capture_manipspace_target(u, fam, info)) env.close() # For puzzle, obj0 IS the button-state vector (needed by set_state). return dict(family=fam, s=np.stack(S), a=np.stack(A), g=np.stack(G), qpos=np.stack(QP), qvel=np.stack(QV), obj0=np.stack(OBJ), target=TGT)
def _capture_manipspace_target(u, fam, info): """Snapshot the task target the oracle drives toward, so the truth env can restore it after set_state (set_state does NOT restore mocap / button / drawer / window targets). For cube: (target_block, mocap_pos, mocap_quat). For puzzle: (target_button, target_button_states). For scene the target depends on info['privileged/target_task'] — we snapshot ALL scene target state so the exact sub-task goal is reproduced (see _restore_manipspace_target).""" if fam == "puzzle": return dict(target_button=int(info["privileged/target_button"]), target_button_states=np.asarray(u._target_button_states).copy()) if fam == "scene": # Capture everything the SceneEnv oracle keys / drives on for any of the 4 tasks, # plus the current button states (needed by SceneEnv.set_state). snap = dict( target_task=str(info["privileged/target_task"]), button_states=np.asarray(info["button_states"]).astype(np.int64).copy(), target_block=int(u._target_block), target_button=int(u._target_button), target_button_states=np.asarray(u._target_button_states).copy(), target_drawer_pos=float(u._target_drawer_pos), target_window_pos=float(u._target_window_pos), ) snap["cube_mocap_pos"] = [np.asarray(u._data.mocap_pos[mid]).copy() for mid in u._cube_target_mocap_ids] snap["cube_mocap_quat"] = [np.asarray(u._data.mocap_quat[mid]).copy() for mid in u._cube_target_mocap_ids] # Drawer / window target SITE positions (the oracle reads target_*_handle_pos # off these sites; set_new_target writes them via site.pos). snap["drawer_target_site_pos"] = np.asarray( u._model.site("drawer_handle_center_target").pos).copy() snap["window_target_site_pos"] = np.asarray( u._model.site("window_handle_center_target").pos).copy() return snap tb = int(info["privileged/target_block"]) mid = u._cube_target_mocap_ids[tb] return dict(target_block=tb, mocap_pos=np.asarray(u._data.mocap_pos[mid]).copy(), mocap_quat=np.asarray(u._data.mocap_quat[mid]).copy())
def _restore_manipspace_target(u, fam, tgt): """Re-apply a captured target onto the live env after set_state, so the oracle drives toward the SAME goal that the recorded g / Q-query used.""" import mujoco if fam == "puzzle": u._target_button = int(tgt["target_button"]) u._target_button_states = np.asarray(tgt["target_button_states"]).copy() return if fam == "scene": u._target_task = tgt["target_task"] u._target_block = int(tgt["target_block"]) u._target_button = int(tgt["target_button"]) u._target_button_states = np.asarray(tgt["target_button_states"]).copy() u._target_drawer_pos = float(tgt["target_drawer_pos"]) u._target_window_pos = float(tgt["target_window_pos"]) for mid, p, q in zip(u._cube_target_mocap_ids, tgt["cube_mocap_pos"], tgt["cube_mocap_quat"]): u._data.mocap_pos[mid] = np.asarray(p).copy() u._data.mocap_quat[mid] = np.asarray(q).copy() u._model.site("drawer_handle_center_target").pos[:] = tgt["drawer_target_site_pos"] u._model.site("window_handle_center_target").pos[:] = tgt["window_target_site_pos"] mujoco.mj_forward(u._model, u._data) return tb = int(tgt["target_block"]) u._target_block = tb mid = u._cube_target_mocap_ids[tb] u._data.mocap_pos[mid] = np.asarray(tgt["mocap_pos"]).copy() u._data.mocap_quat[mid] = np.asarray(tgt["mocap_quat"]).copy() mujoco.mj_forward(u._model, u._data)
def gc_fresh_truth_manipspace(env_id, anchors, gamma, kind, sigma, eps, M=8, H=200, seed=0, verbose=True, dataset_dir="~/.ogbench/data"): """Fresh-rollout Q^pi(s,a,g) truth for manipspace anchors (Protocol B).
`anchors` is the dict returned by ``fresh_reset_anchors``. For each anchor, M times: 1. ``set_state(qpos, qvel)`` (mocap target persists from the original reset, so the goal g is held fixed across the M repeats — we never reset between repeats). 2. apply the recorded behaviour action ``a`` first (conditioning Q on (s,a)). 3. roll the live markov oracle for H steps, re-keying on ``oracle.done`` via ``env.unwrapped.set_new_target()`` (mirrors generate_manipspace.py), adding the same per-episode Gaussian action noise the "noisy" generator uses. Accumulate the renormalized discounted goal-reaching reward toward g, using the privileged OBJECT value each step. Average over M. """ fam = anchors["family"] env = _make_manipspace_env(env_id, dataset_dir) u = env.unwrapped env.reset(seed=seed) oracles = _make_manipspace_oracles(env, fam) rng = np.random.default_rng(seed) disc = (1 - gamma) * gamma ** np.arange(H + 1)
def reward_to_goal(obj, g): # Goal-reaching reward, IDENTICAL to occ_q / MC / TD. For cube/scene x,g are 3-D # object positions and the reward is the position-distance reward_of_dist(||x-g||). # For PUZZLE x,g are binary button-state vectors; the position-distance reward with # the manip sigma is meaningless (||x-g||=sqrt Hamming, saturates exp() to 0), so we # use the match-fraction reward (issue #35 fix) consistently with occ_q/MC/TD. if fam == "puzzle": return float(puzzle_reward(obj, g, kind)) d = float(np.linalg.norm(np.asarray(obj, dtype=np.float64) - np.asarray(g, dtype=np.float64))) return float(reward_of_dist(np.array([d]), kind, sigma, eps)[0])
A = len(anchors["s"]) truth = np.zeros(A) for ai in range(A): qpos = anchors["qpos"][ai].copy() qvel = anchors["qvel"][ai].copy() a_i = anchors["a"][ai].astype(np.float64) g_i = anchors["g"][ai].astype(np.float64) tgt = anchors["target"][ai] ret = 0.0 for _ in range(M): # restore the anchor state, then re-apply the captured task target so the # oracle drives toward the SAME goal g the Q-query used (set_state alone does # NOT restore the mocap / button target). if fam == "puzzle": # puzzle set_state needs the (integer) button-state vector. u.set_state(qpos.copy(), qvel.copy(), np.asarray(anchors["obj0"][ai]).astype(np.int64)) elif fam == "scene": # SceneEnv.set_state(qpos, qvel, button_states) requires the (integer) # current button-state vector, captured per anchor in target["button_states"]. u.set_state(qpos.copy(), qvel.copy(), np.asarray(tgt["button_states"]).astype(np.int64).copy()) else: u.set_state(qpos.copy(), qvel.copy()) _restore_manipspace_target(u, fam, tgt) info = u.compute_ob_info() ob = u.compute_observation() xi = rng.uniform(0, 0.1) # noisy-oracle action noise oracle = oracles[info["privileged/target_task"]] oracle.reset(ob, info) # step 0: the recorded behaviour action a_i ob, _, term, trunc, info = env.step(np.clip(a_i, -1, 1)) objs = [_manipspace_object(info, fam)] if oracle.done: ag_ob, ag_info = u.set_new_target() oracle = oracles[ag_info["privileged/target_task"]] oracle.reset(ag_ob, ag_info) for _t in range(1, H): action = np.asarray(oracle.select_action(ob, info), dtype=np.float64) action = action + rng.normal(0, [xi, xi, xi, xi * 3, xi * 10], action.shape) action = np.clip(action, -1, 1) ob, _, term, trunc, info = env.step(action) objs.append(_manipspace_object(info, fam)) if oracle.done: ag_ob, ag_info = u.set_new_target() oracle = oracles[ag_info["privileged/target_task"]] oracle.reset(ag_ob, ag_info) if term or trunc: break objs = np.asarray(objs) n = len(objs) rr = np.array([reward_to_goal(objs[k], g_i) for k in range(n)]) ret += float((disc[:n] * rr).sum() / disc[:n].sum()) truth[ai] = ret / M if verbose and (ai + 1) % 25 == 0: print(f" [gc-fresh-truth-manip] anchor {ai+1}/{A}", flush=True) env.close() return truth
# ----------------------------------------------------------------------------# fresh-rollout ground truth (HumanoidMaze): humanoid SAC expert + oracle subgoal# ----------------------------------------------------------------------------def _load_humanoid_sac_expert(seed=0): """Load the OGBench SAC locomotion expert used to collect HumanoidMaze data.
Mirrors ``_load_ant_sac_expert`` exactly (same import-and-clean trick around the repo's ``impls/`` package), but with the HUMANOID body: the xy-env agent observation is 69-D (``get_ob(states)[2:]`` = 67-D + 2-D subgoal direction) and the action is 21-D. The expert checkpoint is ``params_40000000.pkl`` (restore_epoch 40000000, per ``experts/humanoid/flags.json``). Returns actor_fn(agent_ob[69], temperature) -> action[21]. JAX is forced to CPU.""" import os import sys import json import numpy as np here = os.path.dirname(os.path.abspath(__file__)) repo = os.path.normpath(os.path.join(here, "..", "ogbench_repo")) impls = os.path.join(repo, "impls") expert = os.path.join(repo, "data_gen_scripts", "experts", "humanoid") restore_epoch = 40000000 ckpt = os.path.join(expert, f"params_{restore_epoch}.pkl") if not os.path.exists(ckpt): raise FreshRolloutUnavailable( f"HumanoidMaze SAC expert checkpoint not found at {ckpt}") os.environ.setdefault("JAX_PLATFORMS", "cpu") sys.path.insert(0, impls) try: from agents import SACAgent from utils.flax_utils import restore_agent from utils.evaluation import supply_rng agent_cfg = json.load(open(os.path.join(expert, "flags.json")))["agent"] # agent_ob = get_ob(states)[2:] (67) + subgoal_dir (2) = 69; action = 21. agent = SACAgent.create(seed, np.zeros(69), np.zeros(21), agent_cfg) agent = restore_agent(agent, expert, restore_epoch) actor_fn = supply_rng(agent.sample_actions, rng=agent.rng) finally: if impls in sys.path: sys.path.remove(impls) for mod in [m for m in list(sys.modules) if m == "utils" or m.startswith("utils.") or m == "agents" or m.startswith("agents.")]: del sys.modules[mod] return actor_fn
def _humanoid_full_state_from_obs(u, ob): """Reconstruct a (qpos[nq], qvel[nv]) reset state from a 69-D HumanoidMaze obs.
The HumanoidMaze observation is NOT raw qpos+qvel (unlike AntMaze's 29-D). It is a derived feature vector (see ogbench/locomaze/humanoid.py:get_ob): xy(2) | joint_angles(21) | head_height(1) | extremities(12) | torso_vertical_orientation(3) | com_velocity(3) | velocity=qvel(27) qpos = [xy(2), root_z+quat(5), joint_angles(21)] (nq=28); qvel = velocity (nv=27). Everything except qpos[2:7] (root height + orientation quaternion, which only enter the obs through xpos/xmat-derived features that are not analytically invertible) is recoverable EXACTLY from the obs. We fill qpos[2:7] from the env's canonical upright init_qpos, so the anchor is a valid upright humanoid at the recorded xy with the recorded joint configuration and full velocity — the closest physically-consistent reset the dataset (which ships no qpos/qvel) permits.""" import numpy as np ob = np.asarray(ob, dtype=np.float64) qpos = u.init_qpos.copy() qvel = u.init_qvel.copy() qpos[:2] = ob[:2] # xy qpos[7:] = ob[2:23] # 21 joint angles qvel[:] = ob[-27:] # 27-D qvel (tail of obs) return qpos, qvel
def gc_fresh_truth_humanoidmaze(env_id, s_anc, a_anc, g_anc, gamma, kind, sigma, eps, M=8, H=300, Khead=20, seed=0, verbose=True, anchor_full=None): """Fresh-rollout Q^pi(s,a,g) truth for HumanoidMaze, using the EXACT data-collection policy: pretrained HUMANOID SAC locomotion expert + oracle-BFS subgoal waypoints + N(0,0.2) action noise (same controller family as AntMaze, different body).
Unlike AntMaze, the HumanoidMaze obs is a 69-D derived feature vector, not raw qpos+qvel, and the dataset ships no qpos/qvel. We reconstruct a valid reset state via ``_humanoid_full_state_from_obs`` (exact xy / joint-angles / qvel; canonical upright root height+quat) and reset with ``set_state``. The agent observation fed to the expert is ``get_ob(states)[2:]`` concatenated with the unit oracle-subgoal direction, exactly as generate_locomaze.py builds it.""" import numpy as np import ogbench actor_fn = _load_humanoid_sac_expert(seed) env_name = env_id.replace("visual-", "") env = ogbench.make_env_and_datasets(env_name, env_only=True) u = env.unwrapped env.reset() vertex = build_vertex_cells(u.maze_map) vertex_xy = np.array([u.ij_to_xy(ij) for ij in vertex]) rng = np.random.default_rng(seed) disc = (1 - gamma) * gamma ** np.arange(H + 1)
# For HumanoidMaze the conditioning obs IS the 69-D state (state_slice="full"), and # `anchor_full` (when passed) carries those same 69-D obs to reconstruct the reset. full = anchor_full if anchor_full is not None else s_anc
def goal_posterior(s_xy, heading): dirs = np.zeros((len(vertex), 2)) for k, gxy in enumerate(vertex_xy): sg, _ = u.get_oracle_subgoal(s_xy, gxy) d = sg - s_xy dirs[k] = d / (np.linalg.norm(d) + 1e-6) w = np.exp((dirs @ heading) / 0.3) return w / w.sum()
A = len(full) truth = np.zeros(A) for ai in range(A): ob_full = np.asarray(full[ai], dtype=np.float64) a_i = np.asarray(a_anc[ai], dtype=np.float64) g_i = np.asarray(g_anc[ai][:2], dtype=np.float64) qpos0, qvel0 = _humanoid_full_state_from_obs(u, ob_full) s_xy0 = ob_full[:2] # heading toward the recorded near-future: approximate via the com-velocity xy # (obs com_velocity is 3-D at index 39:42); fall back to a fixed heading. head = ob_full[39:41] if np.linalg.norm(ob_full[39:41]) > 1e-6 else np.array([1.0, 0.0]) head = head / (np.linalg.norm(head) + 1e-6) gpost = goal_posterior(s_xy0, head) ret = 0.0 for _ in range(M): g_ij = vertex[rng.choice(len(vertex), p=gpost)] u.set_state(qpos0.copy(), qvel0.copy()) u.set_goal(goal_ij=g_ij) xys = [u.get_xy().copy()] _, _, term, trunc, info = env.step(a_i) xys.append(u.get_xy().copy()) if info.get("success", False): u.set_goal(goal_ij=vertex[rng.integers(len(vertex))]) for _t in range(1, H): sg, _ = u.get_oracle_subgoal(u.get_xy(), u.cur_goal_xy) d = sg - u.get_xy() d = d / (np.linalg.norm(d) + 1e-6) ag_ob = np.concatenate([u.get_ob(ob_type="states")[2:], d]) act = np.clip(np.asarray(actor_fn(ag_ob, temperature=0)) + rng.normal(0, 0.2, 21), -1, 1) _, _, term, trunc, info = env.step(act) xys.append(u.get_xy().copy()) if info.get("success", False): u.set_goal(goal_ij=vertex[rng.integers(len(vertex))]) if term or trunc: break xys = np.asarray(xys) n = len(xys) d2g = np.linalg.norm(xys - g_i[None], axis=1) rr = reward_of_dist(d2g, kind, sigma, eps) ret += float((disc[:n] * rr).sum() / disc[:n].sum()) truth[ai] = ret / M if verbose and (ai + 1) % 25 == 0: print(f" [gc-fresh-truth-humanoid] anchor {ai+1}/{A}", flush=True) env.close() return truth
# ----------------------------------------------------------------------------# fresh-rollout ground truth (Powderworld) — Protocol B, image obs + discrete action# ----------------------------------------------------------------------------def gc_fresh_truth_powderworld(anchors, gamma, kind, sigma, eps, M=8, H=120, seed=0, verbose=True, num_elems=2): """Fresh-rollout Q^pi(s, a, g) truth for Powderworld anchors (Protocol B).
Powderworld's obs is a (32,32,6) image and its data-collection behaviour policy is OPEN-LOOP scripted drawing (Fill / Line / Square + 50% random semantic actions), matching ``data_gen_scripts/generate_powderworld.py``. ``anchors`` is the dict from ``powderworld_fresh_reset_anchors`` carrying, per anchor, the saved pw ``world`` array (to restore the start), the recorded behaviour action ``a`` (a single discrete int), the matching ``action_step`` phase, and the goal world-summary ``g`` (phi in R^2).
For each anchor, M times: 1. restore the saved world + action phase (the env start). 2. apply the recorded discrete action ``a`` first (conditioning Q on (s,a)). 3. roll the scripted behaviour policy (Fill/Line/Square + 50% random) for H *agent decisions* (each = 3 env steps), exactly as the generator does, recording the world summary phi after every completed 3-step draw. Accumulate the renormalized discounted reward toward g over the phi sequence; average over M. The behaviour is state-independent, so each rollout is a fresh draw of the SAME action distribution the dataset was collected with — a low-variance unbiased estimate of Q^pi(s,a,g) under the data policy. """ import gymnasium import numpy as np from ogbench.powderworld.behaviors import FillBehavior, LineBehavior, SquareBehavior import sys import os # phi extractor (lives in the env experiment dir to keep gc_core env-agnostic) here = os.path.dirname(os.path.abspath(__file__)) pwdir = os.path.join(here, "experiments", "powderworld_easy_play_v0") if pwdir not in sys.path: sys.path.insert(0, pwdir) import pw_core
env_name = "powderworld-easy-v0" if num_elems == 2 else ( "powderworld-medium-v0" if num_elems == 5 else "powderworld-v0") env = gymnasium.make(env_name, mode="data_collection", max_episode_steps=10_000_000) u = env.unwrapped env.reset(seed=seed) elems = u._elems agents = [FillBehavior(env=env), LineBehavior(env=env), SquareBehavior(env=env)] probs = np.array([1, 3, 3], dtype=np.float64) probs = probs / probs.sum() rng = np.random.default_rng(seed) disc = (1 - gamma) * gamma ** np.arange(H + 1)
def reward_to_goal(phi, g): d = float(np.linalg.norm(np.asarray(phi, np.float64) - np.asarray(g, np.float64))) return float(reward_of_dist(np.array([d]), kind, sigma, eps)[0])
state = {"agent": None}
def pick_semantic(ob, info): """50% random semantic action (matching the 0.5 generator), else scripted; re-keys the agent before selecting if its sequence is exhausted.""" if rng.random() < 0.5: return u.sample_semantic_action() ag = state["agent"] if ag.done: ag = agents[rng.choice(len(agents), p=probs)] ag.reset(ob, info) state["agent"] = ag return ag.select_action(ob, info)
A = len(anchors["world"]) truth = np.zeros(A) for ai in range(A): world0 = anchors["world"][ai] astep0 = int(anchors["action_step"][ai]) a_i = int(anchors["a"][ai]) g_i = np.asarray(anchors["g"][ai], np.float64) ret = 0.0 for _ in range(M): # restore env to the anchor start (world + action phase) u._world = np.array(world0).copy() u._action_step = astep0 u._action_elem_id = None u._action_x = None u._action_y = None # set global np.random seed so Fill/Line/Square draws are reproducible per repeat ob = u._get_ob() info = {} phis = [pw_core.pw_phi_from_world(u._world[0, 0], elems)] # step 0: the recorded behaviour action a_i (advances the 3-phase action cycle) ob, _, term, trunc, info = env.step(a_i) if u._action_step == 0: phis.append(pw_core.pw_phi_from_world(u._world[0, 0], elems)) # roll the scripted behaviour policy for the remaining horizon state["agent"] = agents[rng.choice(len(agents), p=probs)] state["agent"].reset(ob, info) decisions = 0 # seed a semantic action for any mid-cycle phases left by applying a_i; use a # random one so we do NOT consume an agent.select_action mid-sequence. sa = u.sample_semantic_action() while decisions < H: if u._action_step == 0: sa = pick_semantic(ob, info) action = u.semantic_action_to_action(*sa) ob, _, term, trunc, info = env.step(action) if u._action_step == 0: phis.append(pw_core.pw_phi_from_world(u._world[0, 0], elems)) decisions += 1 if term or trunc: break phis = np.asarray(phis) n = len(phis) rr = np.array([reward_to_goal(phis[k], g_i) for k in range(n)]) ret += float((disc[:n] * rr).sum() / disc[:n].sum()) truth[ai] = ret / M if verbose and (ai + 1) % 25 == 0: print(f" [gc-fresh-truth-pw] anchor {ai+1}/{A}", flush=True) env.close() return truth
def powderworld_fresh_reset_anchors(n_anchors, seed, num_elems=2, warmup_lo=10, warmup_hi=120): """Protocol B fresh-reset anchors for Powderworld.
Each anchor is its own ``env.reset`` start, advanced by a random number of scripted behaviour-policy decisions (so the anchor world is in-distribution, not blank), then: world : saved pw world array (to restore the exact start for the truth) action_step : the env action-phase at the anchor (0/1/2) obs : the (32,32,6) image observation (conditioning state) a : the next behaviour-policy action (discrete int) — the Q(s,a) action g : a hindsight future world-summary phi in R^2 (the goal), obtained by rolling the behaviour policy forward a random downstream amount. phi0 : world summary at the anchor (reference). The SAME anchors feed both Q(s,a,g) and the fresh-rollout truth. """ import gymnasium import numpy as np from ogbench.powderworld.behaviors import FillBehavior, LineBehavior, SquareBehavior import sys import os here = os.path.dirname(os.path.abspath(__file__)) pwdir = os.path.join(here, "experiments", "powderworld_easy_play_v0") if pwdir not in sys.path: sys.path.insert(0, pwdir) import pw_core
env_name = "powderworld-easy-v0" if num_elems == 2 else ( "powderworld-medium-v0" if num_elems == 5 else "powderworld-v0") env = gymnasium.make(env_name, mode="data_collection", max_episode_steps=10_000_000) u = env.unwrapped agents = [FillBehavior(env=env), LineBehavior(env=env), SquareBehavior(env=env)] probs = np.array([1, 3, 3], dtype=np.float64); probs = probs / probs.sum() rng = np.random.default_rng(seed)
# holder so the closure can swap the live agent on `done` state = {"agent": None}
def pick_semantic(ob, info): """Return a semantic action: 50% random (matching the 0.5 generator), else from the scripted agent. Re-keys the agent first if it has exhausted its sequence, so ``select_action`` is never called past the end (mirrors generate_powderworld.py).""" if rng.random() < 0.5: return u.sample_semantic_action() ag = state["agent"] if ag.done: ag = agents[rng.choice(len(agents), p=probs)] ag.reset(ob, info) state["agent"] = ag return ag.select_action(ob, info)
WORLD, ASTEP, OBS, ACT, G, PHI0 = [], [], [], [], [], [] for i in range(n_anchors): ob, info = env.reset(seed=seed * 100003 + i) state["agent"] = agents[rng.choice(len(agents), p=probs)] state["agent"].reset(ob, info) warmup = int(rng.integers(warmup_lo, warmup_hi)) # agent decisions before anchor sa = u.sample_semantic_action() d = 0 while d < warmup: if u._action_step == 0: sa = pick_semantic(ob, info) ob, _, term, trunc, info = env.step(u.semantic_action_to_action(*sa)) if u._action_step == 0: d += 1 if term or trunc: ob, info = env.reset(seed=seed * 100003 + i + 7777) state["agent"] = agents[rng.choice(len(agents), p=probs)] state["agent"].reset(ob, info) # at an action-phase==0 boundary: record the anchor world0 = np.array(u._world).copy() astep0 = int(u._action_step) obs0 = np.asarray(ob, np.uint8).copy() phi0 = pw_core.pw_phi_from_world(u._world[0, 0], elems=u._elems) # the next behaviour action a (a single discrete int) at this state sa = pick_semantic(ob, info) a0 = int(u.semantic_action_to_action(*sa)) # hindsight goal: roll forward a random downstream amount, take its phi ghoriz = int(rng.integers(20, 100)) sa2 = sa d2 = 0 gob, ginfo = ob, info while d2 < ghoriz: if u._action_step == 0: sa2 = pick_semantic(gob, ginfo) gob, _, gterm, gtrunc, ginfo = env.step(u.semantic_action_to_action(*sa2)) if u._action_step == 0: d2 += 1 if gterm or gtrunc: break g0 = pw_core.pw_phi_from_world(u._world[0, 0], elems=u._elems) WORLD.append(world0); ASTEP.append(astep0); OBS.append(obs0) ACT.append(a0); G.append(g0.astype(np.float32)); PHI0.append(phi0.astype(np.float32)) env.close() return dict(world=WORLD, action_step=np.array(ASTEP, np.int64), obs=np.stack(OBS), a=np.array(ACT, np.int64), g=np.stack(G), phi0=np.stack(PHI0), num_elems=num_elems)
# ----------------------------------------------------------------------------# which envs have a re-runnable fresh-rollout behaviour policy# ----------------------------------------------------------------------------SUPPORTS_FRESH_ROLLOUT = ("pointmaze", "antmaze", "humanoidmaze", "antsoccer", "cube", "scene", "puzzle", "powderworld")
def supports_fresh_rollout(env_id): return any(k in env_id for k in SUPPORTS_FRESH_ROLLOUT)
# ----------------------------------------------------------------------------# maze layout for figures (walls in xy coordinates)# ----------------------------------------------------------------------------def maze_wall_rects(env): """Return (rects, extent) for drawing the maze layout under xy scatter plots.
rects: list of (x0, y0, w, h) rectangles for wall cells (maze_map == 1), in the same xy coordinates as observations. extent: (xmin, xmax, ymin, ymax). Returns (None, None) if the env exposes no maze geometry. """ import numpy as np u = env.unwrapped if not (hasattr(u, "maze_map") and hasattr(u, "ij_to_xy")): return None, None mm = np.asarray(u.maze_map) I, J = mm.shape # cell size from adjacent centers c00 = np.asarray(u.ij_to_xy((0, 0)), dtype=float) c01 = np.asarray(u.ij_to_xy((0, 1)), dtype=float) c10 = np.asarray(u.ij_to_xy((1, 0)), dtype=float) dx = abs(c01[0] - c00[0]) or 1.0 dy = abs(c10[1] - c00[1]) or 1.0 rects = [] xs, ys = [], [] for i in range(I): for j in range(J): cx, cy = u.ij_to_xy((i, j)) xs += [cx - dx / 2, cx + dx / 2] ys += [cy - dy / 2, cy + dy / 2] if mm[i, j] == 1: rects.append((cx - dx / 2, cy - dy / 2, dx, dy)) extent = (min(xs), max(xs), min(ys), max(ys)) return rects, extent
def draw_maze(ax, env, facecolor="0.6", edgecolor="0.4"): """Draw maze walls as filled rectangles behind a scatter, set equal aspect/extent. Returns True if a layout was drawn, False if no geometry (caller should flag).""" from matplotlib.patches import Rectangle rects, extent = maze_wall_rects(env) if rects is None: return False for (x0, y0, w, h) in rects: ax.add_patch(Rectangle((x0, y0), w, h, facecolor=facecolor, edgecolor=edgecolor, lw=0.5, zorder=0)) ax.set_xlim(extent[0], extent[1]); ax.set_ylim(extent[2], extent[3]) ax.set_aspect("equal") return True123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115"""Gen-Q: TD-free goal-conditioned policy evaluation via a learned occupancy model.
Math----Gen-Q learns the discounted future-state occupancy of the (goal-conditioned)behaviour policy as a conditional generative model
p_theta(x_{t+k} | s_t, a_t, g), k ~ Geom(1 - gamma),
so samples from p_theta are distributed as d^pi_gamma(. | s, a, g). The normalizedgoal-conditioned value is then a plain expectation, estimated by sampling:
Q^pi(s, a, g) = E_{x ~ p_theta(. | s, a, g)} [ r(x; g) ] ~= (1/N) sum_{i=1}^N r(x_i; g), x_i ~ p_theta(. | s, a, g).
Occupancy model: a **conditional denoising diffusion model** (DDPM cosinealpha-bar schedule; DDIM deterministic sampling). Diffusion is chosen over aGaussian mixture density network because the discounted occupancy is stronglymulti-modal (futures branch around walls / object configurations) and diffusioncaptures that without a fixed mode count. **Flow-matching** is an equally validchoice and is available via ``--occ_model flow`` (``models.ConditionalFlowMatching``);both share the interface ``.training_loss(c, y)`` / ``.sample(c, n) -> [B,n,D]``.
Training objective (epsilon-prediction MSE): L = E_{(s,a,g), k~Geom, eps, t} || eps - eps_theta(sqrt(abar_t)x0 + sqrt(1-abar_t)eps, t, (s,a,g)) ||^2, x0 = xy(s_{t+k}), g = hindsight goal downstream of t+k.
Pseudocode---------- train: minibatch (s, a, g, x=xy(s_{t+k})) ; minimize eps-prediction MSE eval : for each anchor (s, a, g): draw N samples x_i ~ p_theta(.|s,a,g) Q(s,a,g) <- mean_i r(x_i; g)"""import time
import numpy as np
from _common import get_device, set_seed, q_metrics, init_wandbimport gc_corefrom evaluate_policy import ground_truth_q, FreshRolloutUnsupported
def run(env_id, seed, cfg): device = get_device() set_seed(seed) gamma = cfg["gamma"] kind, sigma, eps = cfg["reward"], cfg["sigma"], cfg["epsilon"] occ_model = cfg.get("occ_model", "diffusion")
# state_slice="full" gives raw N-D state occupancy (AntMaze 29-D); occupancy target # stays xy (first pos dims). For manipspace the occupancy target is the privileged # object position and pos_dim comes from the dataset loader. state_slice = cfg.get("state_slice", "auto") train_ds, val_ds, _, _ = gc_core.load_ogbench_gc(env_id, gamma, state_slice=state_slice) pos = train_ds.get("pos_dim", cfg.get("pos_dim", 2)) cfg["pos_dim"] = pos
pack = gc_core.prepare_eval_anchors(env_id, val_ds, cfg, seed) sigma, eps = cfg["sigma"], cfg["epsilon"] # prepare may set manipspace reward scale s_a, a_a, g_a = pack["s"], pack["a"], pack["g"] anchors = pack["anchor_idx"] anchor_full = pack["anchor_full"]
run_obj, wlog, wfinish = init_wandb( cfg.get("wandb_project", "genq-policy-eval"), f"genq-{occ_model}-{env_id}-s{seed}", {**cfg, "env": env_id, "seed": seed, "method": "genq"}, mode=cfg.get("wandb_mode")) wandb_url = getattr(run_obj, "url", None)
cond_dim = train_ds["s_dim"] + train_ds["a_dim"] + pos occ = gc_core.build_occupancy(occ_model, cond_dim, pos, cfg, device)
t0 = time.time() losses = gc_core.train_gc_occupancy(occ, train_ds, gamma, cfg, device, seed, wandb_log=wlog) train_wall = time.time() - t0
truth, truth_kind = ground_truth_q(env_id, val_ds, anchors, g_a, gamma, kind=kind, sigma=sigma, eps=eps, M=cfg.get("truth_M", 8), H=cfg.get("truth_H", 350), seed=seed, anchor_full=anchor_full, anchors_pack=pack["anchors_pack"])
# Sample-count sweep: Gen-Q's estimate (1/N) sum r(x_i) should improve with N. gen_counts = cfg.get("gen_sample_counts", [1, 2, 4, 8, 16, 32, 64, 128, 256]) family = train_ds.get("family") mse_by_n, corr_by_n, mse_curve = {}, {}, [] for N in gen_counts: est_n = gc_core.occ_q(occ, s_a, a_a, g_a, N, sigma, device, kind, eps, family=family) mn = q_metrics(est_n, truth) mse_by_n[str(N)] = mn["mse"]; corr_by_n[str(N)] = mn["pearson"] mse_curve.append(mn["mse"]) N_final = gen_counts[-1] est = gc_core.occ_q(occ, s_a, a_a, g_a, N_final, sigma, device, kind, eps, family=family) m = q_metrics(est, truth)
result = { "method": "genq", "env": env_id, "seed": seed, "wandb_url": wandb_url, "occ_model": occ_model, "reward": kind, "truth_kind": truth_kind, "anchor_protocol": pack["anchor_protocol"], "gen_sample_counts": gen_counts, "train/loss": losses, "train/q_mse": [m["mse"]], "eval/q_mse": m["mse"], "eval/q_mae": m["mae"], "eval/q_corr": m["pearson"], "eval/q_spearman": m["spearman"], "eval/q_mse_by_n": mse_by_n, "eval/q_corr_by_n": corr_by_n, "eval/q_mse_vs_N": mse_curve, "eval/N_final": N_final, "eval/truth_std": float(np.std(truth)), "wall_clock_s": train_wall, "n_anchors": int(len(s_a)), } wlog({"eval/q_mse": m["mse"], "eval/q_corr": m["pearson"]}) wfinish() return result
if __name__ == "__main__": pass123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202"""Gen-Q with a reward-predictive latent, for image / high-dim observations.
Why a latent?-------------When the state is an image (or otherwise high-dimensional), learning the occupancyp_theta(x_{t+k} | s, a, g) directly over raw pixels is intractable: most pixelvariation is reward-irrelevant. The issue mandates that for image observations,occupancy learning be performed in a **reward-predictive latent space** and used(instead of raw pixels) for both occupancy estimation and Q^pi.
How the latent is learned--------------------------Train an encoder E_psi over the (future) state and a goal-conditioned rewarddecoder R_psi so the latent keeps exactly the reward-relevant information:
z = E_psi(x), r_hat = R_psi(z, g), L_latent(psi) = E_{x,g} [ ( R_psi(E_psi(x), g) - r(x; g) )^2 ] + lambda ||z||^2.
Then **freeze** E_psi, R_psi (so the occupancy target distribution does not drift).
Occupancy in latent space------------------------- z_{t+k} = stopgrad( E_psi(x_{t+k}) ), p_theta(z_{t+k} | s_t, a_t, g), k ~ Geom(1-gamma).
Q from latent occupancy----------------------- Q^pi(s, a, g) = E_{z ~ p_theta(.|s,a,g)} [ R_psi(z, g) ] ~= (1/N) sum_i R_psi(z_i, g).
For the low-dim Tier-1 envs this is run as an *ablation* of raw-state Gen-Q (thelatent encodes the position dims); for true image envs E_psi would be a CNN(``models.ImageEncoder``). The recipe is identical."""import time
import numpy as npimport torchimport torch.nn as nnimport torch.nn.functional as F
from _common import get_device, set_seed, q_metrics, init_wandbimport gc_coreimport modelsfrom evaluate_policy import ground_truth_q
class GCRewardDecoder(nn.Module): """R(z, g) -> scalar goal-reaching reward.""" def __init__(self, z_dim, g_dim, hidden=256, layers=2): super().__init__() self.net = models.mlp(z_dim + g_dim, 1, hidden, layers)
def forward(self, z, g): return self.net(torch.cat([z, g], -1)).squeeze(-1)
def train_reward_latent(ds, gamma, z_dim, cfg, device, seed, wlog): """Reward-aware encoder over (future) state + goal-conditioned reward decoder.""" pos = cfg.get("pos_dim", 2) s_dim = ds["s_dim"] enc = models.Encoder(s_dim, z_dim, cfg["hidden_dim"], cfg["num_layers"]).to(device) dec = GCRewardDecoder(z_dim, pos, cfg["hidden_dim"], 2).to(device) opt = torch.optim.Adam(list(enc.parameters()) + list(dec.parameters()), lr=cfg["lr"]) rng = np.random.default_rng(seed + 3) obs, end = ds["obs"], ds["end"] lam = cfg.get("latent_l2", 1e-4) kind, sigma, eps = cfg["reward"], cfg["sigma"], cfg["epsilon"] steps = cfg.get("latent_steps", 20000) final = 0.0 for step in range(1, steps + 1): x_idx = rng.integers(0, ds["N"], cfg["batch_size"]) g = obs[gc_core.sample_goal_after(x_idx, end, rng)][:, :pos] d = np.linalg.norm(obs[x_idx][:, :pos] - g, axis=1) r = gc_core.reward_of_dist(d, kind, sigma, eps).astype(np.float32) x = torch.as_tensor(obs[x_idx], device=device) gt = torch.as_tensor(g, dtype=torch.float32, device=device) rt = torch.as_tensor(r, device=device) z = enc(x) loss = F.mse_loss(dec(z, gt), rt) + lam * (z ** 2).mean() opt.zero_grad(); loss.backward(); opt.step() if step % max(1, steps // 20) == 0 or step == 1: final = float(loss.item()) wlog({"latent/loss": final}, step=step) enc.eval(); dec.eval() for p in enc.parameters(): p.requires_grad_(False) for p in dec.parameters(): p.requires_grad_(False) return enc, dec, final
def _encode_all(enc, obs, device, batch=8192): out = [] with torch.no_grad(): for i in range(0, len(obs), batch): out.append(enc(torch.as_tensor(obs[i:i+batch], dtype=torch.float32, device=device)).cpu().numpy()) return np.concatenate(out, 0)
def train_latent_occupancy(occ, ds, enc, gamma, cfg, device, seed, wlog): pos = cfg.get("pos_dim", 2) z_all = _encode_all(enc, ds["obs"], device) obs, act, end = ds["obs"], ds["act"], ds["end"] rng = np.random.default_rng(seed + 7) t0 = rng.integers(0, ds["N"], 20000); j0 = gc_core.future_idx(t0, end, gamma, rng) g0 = obs[gc_core.sample_goal_after(j0, end, rng)][:, :pos] c0 = np.concatenate([obs[t0], act[t0], g0], 1) occ.set_normalization(c0.mean(0), c0.std(0) + 1e-6, z_all.mean(0), z_all.std(0) + 1e-6) z_t = torch.from_numpy(z_all.astype(np.float32)) opt = torch.optim.Adam(occ.parameters(), lr=cfg["lr"]) losses = [] log_every = max(1, cfg["steps"] // 50) for step in range(1, cfg["steps"] + 1): t = rng.integers(0, ds["N"], cfg["batch_size"]) j = gc_core.future_idx(t, end, gamma, rng) g = obs[gc_core.sample_goal_after(j, end, rng)][:, :pos] c = np.concatenate([obs[t], act[t], g], 1) loss = occ.training_loss(torch.as_tensor(c, dtype=torch.float32, device=device), z_t[j].to(device)) opt.zero_grad(); loss.backward() gn = torch.nn.utils.clip_grad_norm_(occ.parameters(), 10.0); opt.step() if step % log_every == 0 or step == 1: losses.append(float(loss.item())) wlog({"train/loss": float(loss.item()), "train/grad_norm": float(gn)}, step=step) occ.eval() return losses
@torch.no_grad()def latent_occ_q(occ, dec, s, a, g, N, device, batch=256): out = np.zeros(len(s)) for i in range(0, len(s), batch): c = np.concatenate([s[i:i+batch], a[i:i+batch], g[i:i+batch]], 1) ct = torch.as_tensor(c, dtype=torch.float32, device=device) z = occ.sample(ct, N) # [b, N, z] b, n, zd = z.shape gt = torch.as_tensor(g[i:i+batch], dtype=torch.float32, device=device) gt = gt.unsqueeze(1).expand(-1, n, -1).reshape(b * n, -1) r = dec(z.reshape(b * n, zd), gt).reshape(b, n) out[i:i+batch] = r.mean(1).cpu().numpy() return out
def run(env_id, seed, cfg): device = get_device() set_seed(seed) gamma = cfg["gamma"] kind = cfg["reward"] pos = cfg.get("pos_dim", 2); cfg["pos_dim"] = pos occ_model = cfg.get("occ_model", "diffusion") z_dim = cfg.get("z_dim", 8)
state_slice = cfg.get("state_slice", "auto") train_ds, val_ds, _, _ = gc_core.load_ogbench_gc(env_id, gamma, state_slice=state_slice) rng = np.random.default_rng(seed) anchors = gc_core.anchors_with_min_horizon(val_ds, cfg["n_anchors"], cfg["min_horizon"], rng) s_a = val_ds["obs"][anchors]; a_a = val_ds["act"][anchors] g_a = val_ds["obs"][gc_core.sample_goal_idx(anchors, val_ds["end"], rng)][:, :pos] anchor_full = s_a if (state_slice == "full" and "antmaze" in env_id) else None
run_obj, wlog, wfinish = init_wandb( cfg.get("wandb_project", "genq-policy-eval"), f"genqlatent-{occ_model}-z{z_dim}-{env_id}-s{seed}", {**cfg, "env": env_id, "seed": seed, "method": "genq_reward_latent"}, mode=cfg.get("wandb_mode")) wandb_url = getattr(run_obj, "url", None)
t0 = time.time() enc, dec, latent_mse = train_reward_latent(train_ds, gamma, z_dim, cfg, device, seed, wlog) cond_dim = train_ds["s_dim"] + train_ds["a_dim"] + pos occ = gc_core.build_occupancy(occ_model, cond_dim, z_dim, cfg, device) losses = train_latent_occupancy(occ, train_ds, enc, gamma, cfg, device, seed, wlog) train_wall = time.time() - t0
truth, truth_kind = ground_truth_q(env_id, val_ds, anchors, g_a, gamma, kind=kind, sigma=cfg["sigma"], eps=cfg["epsilon"], M=cfg.get("truth_M", 8), H=cfg.get("truth_H", 350), seed=seed, anchor_full=anchor_full) gen_counts = cfg.get("gen_sample_counts", [1, 2, 4, 8, 16, 32, 64, 128, 256]) mse_by_n, corr_by_n, mse_curve = {}, {}, [] for N in gen_counts: mn = q_metrics(latent_occ_q(occ, dec, s_a, a_a, g_a, N, device), truth) mse_by_n[str(N)] = mn["mse"]; corr_by_n[str(N)] = mn["pearson"]; mse_curve.append(mn["mse"]) N_final = gen_counts[-1] est = latent_occ_q(occ, dec, s_a, a_a, g_a, N_final, device) m = q_metrics(est, truth)
result = { "method": "genq_reward_latent", "env": env_id, "seed": seed, "wandb_url": wandb_url, "occ_model": occ_model, "z_dim": z_dim, "reward": kind, "truth_kind": truth_kind, "gen_sample_counts": gen_counts, "train/loss": losses, "train/q_mse": [m["mse"]], "latent/reward_mse": latent_mse, "eval/q_mse": m["mse"], "eval/q_mae": m["mae"], "eval/q_corr": m["pearson"], "eval/q_spearman": m["spearman"], "eval/q_mse_by_n": mse_by_n, "eval/q_corr_by_n": corr_by_n, "eval/q_mse_vs_N": mse_curve, "eval/N_final": N_final, "eval/truth_std": float(np.std(truth)), "wall_clock_s": train_wall, "n_anchors": int(len(anchors)), } wlog({"eval/q_mse": m["mse"], "eval/q_corr": m["pearson"]}) wfinish() return result
if __name__ == "__main__": pass123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450"""Gen-Q policy evaluation for IMAGE observations (visual-antmaze-medium-navigate-v0).
Why this file exists--------------------For image states the occupancy p_theta(x_{t+k} | s, a, g) must be learned in aREWARD-PREDICTIVE LATENT, never over raw pixels (CLAUDE.md "Image observations =>reward-predictive latent occupancy"). The state ``genq_reward_latent.py`` uses an MLPencoder over a flat state vector and slices the xy goal/reward out of ``obs[:, :2]``;neither works for a 64x64x3 image. This driver swaps in ``models.ImageEncoder`` (CNN)and reads the xy reward/goal signal from the dataset's auxiliary ``qpos`` array.
Recipe (reward-predictive latent, frozen, then diffusion occupancy)-------------------------------------------------------------------1. Encoder z = E_psi(image) (models.ImageEncoder, CNN, [B,3,64,64] in [0,1]) Decoder r_hat = R_psi(z, g) (goal-conditioned, g = xy) Loss E[(R_psi(E_psi(image), g) - r(xy; g))^2] + lambda||z||^2 ; FREEZE E,R. The reward is goal-reaching on the ant xy = qpos[:, :2].2. Conditioning representation: we condition the occupancy on (z_now, a, g) where z_now = E_psi(image_now). (Documented choice: the CNN latent of the current image is the conditioning state; the action a (8-D ant torque) and goal g (xy) complete the (s,a,g) input.)3. Occupancy p_theta(z' | z_now, a, g), z' = stopgrad(E_psi(image_{t+k})), k ~ Geom(1-gamma). Conditional diffusion (NEVER a Gaussian MDN).4. Q^pi(s,a,g) = E_{z ~ p_theta}[ R_psi(z, g) ] ~= (1/N) sum_i R_psi(z_i, g).
Ground truth = FRESH ROLLOUTS only. The image obs cannot reset the sim, so we pass thedataset's 29-D qpos+qvel full state as ``anchor_full`` to``evaluate_policy.ground_truth_q``; the shared lib rolls the SAC expert + oracle-subgoalbehaviour policy on ant dynamics from that exact state (the image-ness only changes theOCCUPANCY model input, not the rollout).
mc / td baselines: run on the 29-D qpos+qvel STATE (the non-latent reference), since atrained-MC / IQL-TD critic over the raw 64x64x3 image is a separate CNN-critic study;the honest, comparable reference here is the same MC/TD recipe on the full ant state.This is documented in each result JSON via ``"representation"``."""import osimport time
import numpy as npimport torchimport torch.nn as nnimport torch.nn.functional as F
from _common import get_device, set_seed, q_metrics, init_wandbimport gc_coreimport modelsfrom evaluate_policy import ground_truth_qfrom genq_reward_latent import GCRewardDecoder
_HERE = os.path.dirname(os.path.abspath(__file__))# data_ogbench/ physically lives at the SHARED proj root and is symlinked into the# worktree as <repo_root>/data_ogbench. The symlink is untracked+gitignored and can# be removed by `git clean -fdx` during worktree ops, so we resolve the symlink to# its real absolute target and use that stable shared path directly. Override with# GENQ_DATA_DIR if needed.def _resolve_data_dir(): env = os.environ.get("GENQ_DATA_DIR") if env: return os.path.abspath(env) cand = os.path.join(_HERE, "..", "data_ogbench") # repo-root data_ogbench (symlink) # realpath follows the symlink to the shared /proj/.../gen_q/data_ogbench target, # so reads keep working even if the worktree symlink is later cleaned. return os.path.realpath(cand)_DATA_DIR = _resolve_data_dir()
# ----------------------------------------------------------------------------# visual dataset (images + qpos/qvel)# ----------------------------------------------------------------------------def load_visual_gc(env_id, split, n_traj=None): """Load the visual-antmaze npz for `split` in {"train","val"}.
Returns a dataset dict with: img : uint8 [N, 64, 64, 3] (observation; encoded by the CNN, never modeled raw) xy : float32 [N, 2] (ant xy = qpos[:, :2]; reward/goal signal) full : float32 [N, 29] (qpos[15] + qvel[14]; resets the sim for fresh truth) act : float32 [N, 8] end : int64 [N] (trajectory end index per step) N, a_dim """ fname = env_id if split == "train" else f"{env_id}-val" path = os.path.join(_DATA_DIR, f"{fname}.npz") if not os.path.exists(path): raise FileNotFoundError( f"visual dataset not found: {path} (expected data_ogbench/ symlink at repo root)") d = np.load(path, mmap_mode="r") term = np.asarray(d["terminals"], dtype=np.float32) if n_traj is not None: ends = np.where(term > 0.5)[0] + 1 N = int(ends[min(n_traj, len(ends)) - 1]) if len(ends) else len(term) else: N = len(term) qpos = np.asarray(d["qpos"][:N], dtype=np.float32) qvel = np.asarray(d["qvel"][:N], dtype=np.float32) full = np.concatenate([qpos, qvel], axis=1) # [N, 29] return dict( img=d["observations"][:N], # keep as mmap'd uint8; index lazily xy=qpos[:, :2].copy(), full=full, # `obs` alias = 29-D full state so evaluate_policy.ground_truth_q can index # val_ds["obs"]/["act"] generically; for visual-antmaze the antmaze truth uses # `anchor_full` for the sim reset and only needs `act` from here. obs=full, act=np.asarray(d["actions"][:N], dtype=np.float32), end=gc_core.trajectory_bounds(term[:N]), N=N, a_dim=int(d["actions"].shape[1]), )
def _imgs_to_tensor(img_u8, device): """uint8 [B,64,64,3] -> float [B,3,64,64] in [0,1].""" x = torch.as_tensor(np.asarray(img_u8), dtype=torch.float32, device=device) / 255.0 return x.permute(0, 3, 1, 2).contiguous()
# ----------------------------------------------------------------------------# reward-predictive CNN latent (encoder + goal-conditioned reward decoder)# ----------------------------------------------------------------------------def train_reward_latent_image(ds, z_dim, cfg, device, seed, wlog): enc = models.ImageEncoder(z_dim, hidden_dim=cfg["hidden_dim"]).to(device) dec = GCRewardDecoder(z_dim, 2, cfg["hidden_dim"], 2).to(device) opt = torch.optim.Adam(list(enc.parameters()) + list(dec.parameters()), lr=cfg["lr"]) rng = np.random.default_rng(seed + 3) xy, end = ds["xy"], ds["end"] lam = cfg.get("latent_l2", 1e-4) kind, sigma, eps = cfg["reward"], cfg["sigma"], cfg["epsilon"] steps = cfg.get("latent_steps", 20000) bs = cfg["batch_size"] final = 0.0 for step in range(1, steps + 1): x_idx = rng.integers(0, ds["N"], bs) g = xy[gc_core.sample_goal_after(x_idx, end, rng)] d = np.linalg.norm(xy[x_idx] - g, axis=1) r = gc_core.reward_of_dist(d, kind, sigma, eps).astype(np.float32) img = _imgs_to_tensor(ds["img"][x_idx], device) gt = torch.as_tensor(g, dtype=torch.float32, device=device) rt = torch.as_tensor(r, device=device) z = enc(img) loss = F.mse_loss(dec(z, gt), rt) + lam * (z ** 2).mean() opt.zero_grad(); loss.backward(); opt.step() if step % max(1, steps // 20) == 0 or step == 1: final = float(loss.item()) wlog({"latent/loss": final}, step=step) enc.eval(); dec.eval() for p in enc.parameters(): p.requires_grad_(False) for p in dec.parameters(): p.requires_grad_(False) return enc, dec, final
@torch.no_grad()def encode_images(enc, img_u8, device, batch=2048): out = [] for i in range(0, len(img_u8), batch): out.append(enc(_imgs_to_tensor(img_u8[i:i+batch], device)).cpu().numpy()) return np.concatenate(out, 0).astype(np.float32)
# ----------------------------------------------------------------------------# latent occupancy p_theta(z' | z_now, a, g)# ----------------------------------------------------------------------------def train_latent_occupancy_image(occ, ds, z_all, gamma, cfg, device, seed, wlog): """z_all: precomputed E_psi(image) for every step (conditioning AND target source).""" act, end = ds["act"], ds["end"] xy = ds["xy"] rng = np.random.default_rng(seed + 7) # normalization from a sample of (z_now, a, g) cond and z' target t0 = rng.integers(0, ds["N"], 20000) j0 = gc_core.future_idx(t0, end, gamma, rng) g0 = xy[gc_core.sample_goal_after(j0, end, rng)] c0 = np.concatenate([z_all[t0], act[t0], g0], 1) occ.set_normalization(c0.mean(0), c0.std(0) + 1e-6, z_all[j0].mean(0), z_all[j0].std(0) + 1e-6) z_t = torch.from_numpy(z_all) opt = torch.optim.Adam(occ.parameters(), lr=cfg["lr"]) losses = [] log_every = max(1, cfg["steps"] // 50) bs = cfg["batch_size"] for step in range(1, cfg["steps"] + 1): t = rng.integers(0, ds["N"], bs) j = gc_core.future_idx(t, end, gamma, rng) g = xy[gc_core.sample_goal_after(j, end, rng)] c = np.concatenate([z_all[t], act[t], g], 1) loss = occ.training_loss(torch.as_tensor(c, dtype=torch.float32, device=device), z_t[j].to(device)) opt.zero_grad(); loss.backward() gn = torch.nn.utils.clip_grad_norm_(occ.parameters(), 10.0); opt.step() if step % log_every == 0 or step == 1: losses.append(float(loss.item())) wlog({"train/loss": float(loss.item()), "train/grad_norm": float(gn)}, step=step) occ.eval() return losses
@torch.no_grad()def latent_occ_q(occ, dec, z_now, a, g, N, device, batch=256): out = np.zeros(len(z_now)) for i in range(0, len(z_now), batch): c = np.concatenate([z_now[i:i+batch], a[i:i+batch], g[i:i+batch]], 1) ct = torch.as_tensor(c, dtype=torch.float32, device=device) z = occ.sample(ct, N) # [b, N, z] b, n, zd = z.shape gt = torch.as_tensor(g[i:i+batch], dtype=torch.float32, device=device) gt = gt.unsqueeze(1).expand(-1, n, -1).reshape(b * n, -1) r = dec(z.reshape(b * n, zd), gt).reshape(b, n) out[i:i+batch] = r.mean(1).cpu().numpy() return out
# ----------------------------------------------------------------------------# anchors + goals shared across methods (so mc/td/genq score the SAME (s,a,g))# ----------------------------------------------------------------------------def _make_anchors(val_ds, cfg, seed): rng = np.random.default_rng(seed) n = cfg["n_anchors"]; min_h = cfg["min_horizon"] rem = val_ds["end"] - np.arange(val_ds["N"]) valid = np.where(rem >= min_h)[0] if len(valid) == 0: valid = np.arange(val_ds["N"]) anchors = valid[rng.integers(0, len(valid), size=n)] g_idx = gc_core.sample_goal_idx(anchors, val_ds["end"], rng) g_a = val_ds["xy"][g_idx] return anchors, g_a
# ----------------------------------------------------------------------------# genq (image reward-predictive latent occupancy)# ----------------------------------------------------------------------------def run(env_id, seed, cfg): device = get_device() set_seed(seed) gamma = cfg["gamma"] kind = cfg["reward"] occ_model = cfg.get("occ_model", "diffusion") z_dim = cfg.get("z_dim", 8) n_traj_tr = cfg.get("vis_train_traj", None) n_traj_val = cfg.get("vis_val_traj", None)
train_ds = load_visual_gc(env_id, "train", n_traj_tr) val_ds = load_visual_gc(env_id, "val", n_traj_val) anchors, g_a = _make_anchors(val_ds, cfg, seed) s_img_a = val_ds["img"][anchors] a_a = val_ds["act"][anchors] anchor_full = val_ds["full"][anchors] # 29-D qpos+qvel for fresh rollout
run_obj, wlog, wfinish = init_wandb( cfg.get("wandb_project", "genq-policy-eval"), f"genqvisual-{occ_model}-z{z_dim}-{env_id}-s{seed}", {**cfg, "env": env_id, "seed": seed, "method": "genq_reward_latent"}, mode=cfg.get("wandb_mode")) wandb_url = getattr(run_obj, "url", None)
t0 = time.time() enc, dec, latent_mse = train_reward_latent_image(train_ds, z_dim, cfg, device, seed, wlog) z_train = encode_images(enc, train_ds["img"], device) cond_dim = z_dim + train_ds["a_dim"] + 2 # (z_now, a, g_xy) occ = gc_core.build_occupancy(occ_model, cond_dim, z_dim, cfg, device) losses = train_latent_occupancy_image(occ, train_ds, z_train, gamma, cfg, device, seed, wlog) train_wall = time.time() - t0
truth, truth_kind = ground_truth_q(env_id, val_ds, anchors, g_a, gamma, kind=kind, sigma=cfg["sigma"], eps=cfg["epsilon"], M=cfg.get("truth_M", 8), H=cfg.get("truth_H", 350), seed=seed, anchor_full=anchor_full) # encode anchor images to z_now for conditioning z_now_a = encode_images(enc, s_img_a, device)
gen_counts = cfg.get("gen_sample_counts", [1, 2, 4, 8, 16, 32, 64, 128, 256]) mse_by_n, corr_by_n, mse_curve = {}, {}, [] for N in gen_counts: mn = q_metrics(latent_occ_q(occ, dec, z_now_a, a_a, g_a, N, device), truth) mse_by_n[str(N)] = mn["mse"]; corr_by_n[str(N)] = mn["pearson"]; mse_curve.append(mn["mse"]) N_final = gen_counts[-1] est = latent_occ_q(occ, dec, z_now_a, a_a, g_a, N_final, device) m = q_metrics(est, truth)
result = { "method": "genq_reward_latent", "env": env_id, "seed": seed, "wandb_url": wandb_url, "representation": "image_reward_predictive_latent", "occ_model": occ_model, "z_dim": z_dim, "reward": kind, "truth_kind": truth_kind, "gen_sample_counts": gen_counts, "train/loss": losses, "train/q_mse": [m["mse"]], "latent/reward_mse": latent_mse, "eval/q_mse": m["mse"], "eval/q_mae": m["mae"], "eval/q_corr": m["pearson"], "eval/q_spearman": m["spearman"], "eval/q_mse_by_n": mse_by_n, "eval/q_corr_by_n": corr_by_n, "eval/q_mse_vs_N": mse_curve, "eval/N_final": N_final, "eval/truth_std": float(np.std(truth)), "wall_clock_s": train_wall, "n_anchors": int(len(anchors)), } wlog({"eval/q_mse": m["mse"], "eval/q_corr": m["pearson"]}) wfinish() return result
# ----------------------------------------------------------------------------# mc / td baselines on the 29-D ant STATE (non-latent reference, documented)# ----------------------------------------------------------------------------def _shared_state_setup(env_id, seed, cfg): """Build (train_ds, val_ds, anchors, g_a, anchor_full) on the 29-D ant state.""" n_traj_tr = cfg.get("vis_train_traj", None) n_traj_val = cfg.get("vis_val_traj", None) train_v = load_visual_gc(env_id, "train", n_traj_tr) val_v = load_visual_gc(env_id, "val", n_traj_val) # state datasets: obs = full MuJoCo state (qpos+qvel); xy reward signal stays # qpos[:, :2] (== full[:, :2]). s_dim is derived from the data so this works for # both AntMaze (29-D) and the rendered visual-PointMaze (4-D qpos[2]+qvel[2]). s_dim = int(train_v["full"].shape[1]) tr = dict(obs=train_v["full"], act=train_v["act"], end=train_v["end"], N=train_v["N"], s_dim=s_dim, a_dim=train_v["a_dim"]) va = dict(obs=val_v["full"], act=val_v["act"], end=val_v["end"], N=val_v["N"], s_dim=s_dim, a_dim=val_v["a_dim"]) anchors, g_a = _make_anchors(val_v, cfg, seed) anchor_full = val_v["full"][anchors] return tr, va, val_v, anchors, g_a, anchor_full
def run_mc(env_id, seed, cfg): """Trained-MC critic Q_MC(s,a,g) on the 29-D ant state (non-latent reference).""" import mc as mc_mod device = get_device(); set_seed(seed) gamma = cfg["gamma"]; kind, sigma, eps = cfg["reward"], cfg["sigma"], cfg["epsilon"] pos = 2 tr, va, val_v, anchors, g_a, anchor_full = _shared_state_setup(env_id, seed, cfg) s_a = va["obs"][anchors]; a_a = va["act"][anchors]
run_obj, wlog, wfinish = init_wandb( cfg.get("wandb_project", "genq-policy-eval"), f"mc-state29-{env_id}-s{seed}", {**cfg, "env": env_id, "seed": seed, "method": "mc"}, mode=cfg.get("wandb_mode")) wandb_url = getattr(run_obj, "url", None)
rng = np.random.default_rng(seed) cand = np.where((tr["end"] - np.arange(tr["N"])) >= 2)[0] n_fit = min(cfg.get("mc_fit_anchors", 80000), len(cand)) fit_idx = cand[rng.integers(0, len(cand), size=n_fit)] fit_g = tr["obs"][gc_core.sample_goal_idx(fit_idx, tr["end"], rng)][:, :pos] fit_ret = mc_mod.gc_return(tr["obs"][:, :pos], tr["end"], fit_g, fit_idx, gamma, sigma, kind, eps)
net = mc_mod.QNet(tr["s_dim"], pos, tr["a_dim"], cfg["hidden_dim"], cfg["num_layers"]).to(device) opt = torch.optim.Adam(net.parameters(), lr=cfg["lr"]) St = torch.as_tensor(tr["obs"][fit_idx], dtype=torch.float32) Gt = torch.as_tensor(fit_g, dtype=torch.float32) At = torch.as_tensor(tr["act"][fit_idx], dtype=torch.float32) Rt = torch.as_tensor(fit_ret, dtype=torch.float32) losses, qmse = [], [] log_every = max(1, cfg["steps"] // 50); t0 = time.time() for step in range(1, cfg["steps"] + 1): b = rng.integers(0, len(fit_idx), cfg["batch_size"]) loss = ((net(St[b].to(device), Gt[b].to(device), At[b].to(device)) - Rt[b].to(device)) ** 2).mean() opt.zero_grad(); loss.backward(); opt.step() if step % log_every == 0 or step == 1: losses.append(float(loss.item())); qmse.append(float(loss.item())) wlog({"train/loss": float(loss.item()), "train/q_mse": float(loss.item())}, step=step) net.eval(); train_wall = time.time() - t0
truth, truth_kind = ground_truth_q(env_id, va, anchors, g_a, gamma, kind=kind, sigma=sigma, eps=eps, M=cfg.get("truth_M", 8), H=cfg.get("truth_H", 350), seed=seed, anchor_full=anchor_full) with torch.no_grad(): est = net(torch.as_tensor(s_a, dtype=torch.float32, device=device), torch.as_tensor(g_a, dtype=torch.float32, device=device), torch.as_tensor(a_a, dtype=torch.float32, device=device)).cpu().numpy() m = q_metrics(est, truth) result = {"method": "mc", "env": env_id, "seed": seed, "wandb_url": wandb_url, "representation": "ant_state_29d", "reward": kind, "truth_kind": truth_kind, "train/loss": losses, "train/q_mse": qmse, "eval/q_mse": m["mse"], "eval/q_mae": m["mae"], "eval/q_corr": m["pearson"], "eval/q_spearman": m["spearman"], "eval/truth_std": float(np.std(truth)), "wall_clock_s": train_wall, "n_anchors": int(len(anchors))} wlog({"eval/q_mse": m["mse"], "eval/q_corr": m["pearson"]}); wfinish() return result
def run_td(env_id, seed, cfg): """IQL-style TD critic Q(s,a,g) on the 29-D ant state (non-latent reference).""" import mc as mc_mod import td as td_mod device = get_device(); set_seed(seed) gamma = cfg["gamma"]; kind, sigma, eps = cfg["reward"], cfg["sigma"], cfg["epsilon"] pos = 2 tr, va, val_v, anchors, g_a, anchor_full = _shared_state_setup(env_id, seed, cfg) s_a = va["obs"][anchors]; a_a = va["act"][anchors]
run_obj, wlog, wfinish = init_wandb( cfg.get("wandb_project", "genq-policy-eval"), f"td-state29-{env_id}-s{seed}", {**cfg, "env": env_id, "seed": seed, "method": "td"}, mode=cfg.get("wandb_mode")) wandb_url = getattr(run_obj, "url", None)
obs = tr["obs"]; act = tr["act"]; end = tr["end"]; N = tr["N"] nxt = np.where((end - np.arange(N)) > 1)[0] sd, ad = tr["s_dim"], tr["a_dim"]; Hd, L = cfg["hidden_dim"], cfg["num_layers"] q = mc_mod.QNet(sd, pos, ad, Hd, L).to(device) qt = mc_mod.QNet(sd, pos, ad, Hd, L).to(device); qt.load_state_dict(q.state_dict()) v = td_mod.VNet(sd, pos, Hd, L).to(device) optq = torch.optim.Adam(q.parameters(), lr=cfg["lr"]) optv = torch.optim.Adam(v.parameters(), lr=cfg["lr"]) tau = cfg.get("iql_expectile", 0.5); polyak = cfg.get("polyak", 0.005) rng = np.random.default_rng(seed) losses, qmse = [], []; log_every = max(1, cfg["steps"] // 50); t0 = time.time() for step in range(1, cfg["steps"] + 1): idx = nxt[rng.integers(0, len(nxt), size=cfg["batch_size"])] g = obs[gc_core.sample_goal_idx(idx, end, rng)][:, :pos] d = np.linalg.norm(obs[idx][:, :pos] - g, axis=1) r = gc_core.reward_of_dist(d, kind, sigma, eps).astype(np.float32) s = torch.as_tensor(obs[idx], device=device) a = torch.as_tensor(act[idx], device=device) s2 = torch.as_tensor(obs[idx + 1], device=device) gt = torch.as_tensor(g, dtype=torch.float32, device=device) rt = torch.as_tensor(r, device=device) with torch.no_grad(): qsa = qt(s, gt, a) diff = qsa - v(s, gt) w = torch.abs(tau - (diff < 0).float()) loss_v = (w * diff ** 2).mean() optv.zero_grad(); loss_v.backward(); optv.step() with torch.no_grad(): y = (1 - gamma) * rt + gamma * v(s2, gt) loss_q = ((q(s, gt, a) - y) ** 2).mean() optq.zero_grad(); loss_q.backward(); optq.step() with torch.no_grad(): for p, ptg in zip(q.parameters(), qt.parameters()): ptg.mul_(1 - polyak).add_(polyak * p) if step % log_every == 0 or step == 1: losses.append(float(loss_q.item())); qmse.append(float(loss_q.item())) wlog({"train/loss": float(loss_q.item()), "train/q_mse": float(loss_q.item()), "train/v_loss": float(loss_v.item())}, step=step) q.eval(); train_wall = time.time() - t0
truth, truth_kind = ground_truth_q(env_id, va, anchors, g_a, gamma, kind=kind, sigma=sigma, eps=eps, M=cfg.get("truth_M", 8), H=cfg.get("truth_H", 350), seed=seed, anchor_full=anchor_full) with torch.no_grad(): est = q(torch.as_tensor(s_a, dtype=torch.float32, device=device), torch.as_tensor(g_a, dtype=torch.float32, device=device), torch.as_tensor(a_a, dtype=torch.float32, device=device)).cpu().numpy() m = q_metrics(est, truth) result = {"method": "td", "env": env_id, "seed": seed, "wandb_url": wandb_url, "representation": "ant_state_29d", "reward": kind, "truth_kind": truth_kind, "train/loss": losses, "train/q_mse": qmse, "eval/q_mse": m["mse"], "eval/q_mae": m["mae"], "eval/q_corr": m["pearson"], "eval/q_spearman": m["spearman"], "eval/truth_std": float(np.std(truth)), "wall_clock_s": train_wall, "n_anchors": int(len(anchors))} wlog({"eval/q_mse": m["mse"], "eval/q_corr": m["pearson"]}); wfinish() return result
if __name__ == "__main__": pass123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409"""Gen-Q policy evaluation for IMAGE observations on a MANIPSPACE env(visual-cube-single-play-v0).
This file combines two already-proven pieces (issue #35):
(a) image obs -> frozen REWARD-PREDICTIVE LATENT occupancy (proven on visual-antmaze-medium-navigate-v0 via ``genq_visual.py``), and (b) the FRESH-RESET manipspace ground truth (proven on the STATE cube-single-play-v0, genq corr ~0.88, via ``gc_core.fresh_reset_anchors`` + ``gc_core.gc_fresh_truth_manipspace``).
Why a dedicated driver (vs reusing ``genq_visual.py``)------------------------------------------------------``genq_visual.py`` was written for visual-ANTmaze, where (i) the reward/goal signal isthe 2-D ant xy = ``qpos[:, :2]`` and (ii) the ground truth uses the DATASET-anchorprotocol (the 29-D qpos+qvel slice resets the sim). visual-cube differs on BOTH axes:
* The reward/goal is the 3-D OBJECT (block) position, not an agent xy. For cube-single the block_0 position lives at ``qpos[:, 14:17]`` (resolved LIVE from the state cube env so nothing is hardcoded across env versions). * The cube observation is a lossy projection -> the truth MUST use the FRESH-RESET protocol (FRESH_RESET_SPEC.md Protocol B): each anchor is its own ``env.reset()`` start, the live CubeMarkovOracle is rolled from ``set_state`` for the truth, and the SAME anchors are queried by the learned models.
The underlying sim for ``visual-cube-single-play-v0`` is the SAME cube env as the stateversion; only the observation rendering differs. So ``fresh_reset_anchors`` /``gc_fresh_truth_manipspace`` work UNCHANGED when handed the visual env id — the onlydifference is that the recorded anchor ``s`` is now a 64x64x3 IMAGE (used solely tocondition the CNN-latent occupancy), while the truth uses qpos/qvel/target/g from theprivileged ``info`` exactly as in the state cube.
Recipe (reward-predictive latent, frozen, then diffusion occupancy)-------------------------------------------------------------------1. Encoder z = E_psi(image) (models.ImageEncoder, CNN, [B,3,64,64] in [0,1]) Decoder r_hat = R_psi(z, g) (goal-conditioned, g = 3-D block-goal position) Loss E[(R_psi(E_psi(image), g) - r(block_pos; g))^2] + lambda||z||^2 ; FREEZE E,R. The reward is OBJECT goal-reaching: r(x;g)=exp(-||x-g||^2/2 sigma^2), x=block_pos.2. Conditioning representation (s,a,g) = (z_now=E_psi(image_now), a (5-D), g (3-D)).3. Occupancy p_theta(z' | z_now, a, g), z' = stopgrad(E_psi(image_{t+k})), k ~ Geom(1-gamma). Conditional diffusion (NEVER a Gaussian MDN).4. Q^pi(s,a,g) = E_{z ~ p_theta}[ R_psi(z, g) ] ~= (1/N) sum_i R_psi(z_i, g).
Ground truth = FRESH ROLLOUTS only (Protocol B, fresh_reset). NO in-dataset return-to-go,NO synthetic fallback. ``anchor_protocol="fresh_reset"`` in every result JSON.
mc / td baselines run on the cube STATE (28-D obs) as the non-latent reference, againstthe SAME fresh-reset anchors/truth — the honest comparable reference (a trained CNNcritic over raw pixels is a separate study). Documented via ``"representation"`` in eachresult JSON."""import osimport time
import numpy as npimport torchimport torch.nn.functional as F
from _common import get_device, set_seed, q_metrics, init_wandbimport gc_coreimport modelsfrom genq_reward_latent import GCRewardDecoder
_HERE = os.path.dirname(os.path.abspath(__file__))
def _resolve_data_dir(): """Resolve the OGBench data dir robustly across login/compute nodes.
On the login node $HOME=/proj/inf-scaling/zwhong, but on a Blue Vela compute node $HOME=/u/zwhong (a separate .ogbench without the prefetched data). Prefer an explicit OGBENCH_DATA_DIR, then any candidate that actually contains the dataset, else the expanduser default.""" cands = [] if os.environ.get("OGBENCH_DATA_DIR"): cands.append(os.path.expanduser(os.environ["OGBENCH_DATA_DIR"])) cands += [ os.path.expanduser("~/.ogbench/data"), "/proj/inf-scaling/zwhong/.ogbench/data", "/u/zwhong/.ogbench/data", ] for c in cands: if os.path.isdir(c) and any(f.endswith(".npz") for f in os.listdir(c)): return c return os.path.expanduser("~/.ogbench/data")
_DATA_DIR = _resolve_data_dir()
# cube-single block_0 position qpos slice (resolved live below; this is the fallback /# documented default verified on 2026-06-28: qpos[14:17])._CUBE_BLOCK_SLICE = (14, 17)
# ----------------------------------------------------------------------------# block qpos slice (resolved live so we never hardcode across env versions)# ----------------------------------------------------------------------------def _resolve_cube_block_slice(env_id): """Resolve the (lo, hi) qpos slice giving the cube block_0 3-D position, by inspecting the STATE cube env (same sim, has privileged block keys). Falls back to the verified default if the live probe fails.""" state_env_id = env_id.replace("visual-", "") try: import ogbench env = ogbench.make_env_and_datasets( state_env_id, env_only=True, terminate_at_goal=False, mode="data_collection", max_episode_steps=1001, dataset_dir=_DATA_DIR) sl = gc_core._manipspace_block_qpos_slices(env, "cube") env.close() # cube-single -> single (lo, hi) return sl[0] except Exception as e: # pragma: no cover - defensive print(f"[visualcube] block-slice probe failed ({e}); using default {_CUBE_BLOCK_SLICE}", flush=True) return _CUBE_BLOCK_SLICE
# ----------------------------------------------------------------------------# visual cube dataset (images + qpos -> block position reward signal)# ----------------------------------------------------------------------------def load_visual_cube(env_id, split, block_slice, n_traj=None): """Load the visual-cube npz for `split` in {"train","val"}.
Returns a dataset dict with: img : uint8 [N, 64, 64, 3] (observation; encoded by the CNN, never modeled raw) obj : float32 [N, 3] (block_0 position = qpos[:, lo:hi]; reward/goal signal) full : float32 [N, 41] (qpos[21] + qvel[20]; reference only) act : float32 [N, 5] end : int64 [N] (trajectory end index per step) N, a_dim """ fname = env_id if split == "train" else f"{env_id}-val" path = os.path.join(_DATA_DIR, f"{fname}.npz") if not os.path.exists(path): raise FileNotFoundError(f"visual-cube dataset not found: {path}") d = np.load(path, mmap_mode="r") term = np.asarray(d["terminals"], dtype=np.float32) if n_traj is not None: ends = np.where(term > 0.5)[0] + 1 N = int(ends[min(n_traj, len(ends)) - 1]) if len(ends) else len(term) else: N = len(term) qpos = np.asarray(d["qpos"][:N], dtype=np.float32) qvel = np.asarray(d["qvel"][:N], dtype=np.float32) lo, hi = block_slice return dict( img=d["observations"][:N], # mmap'd uint8; index lazily obj=qpos[:, lo:hi].copy().astype(np.float32), # [N, 3] block position full=np.concatenate([qpos, qvel], axis=1), # reference only act=np.asarray(d["actions"][:N], dtype=np.float32), end=gc_core.trajectory_bounds(term[:N]), N=N, a_dim=int(d["actions"].shape[1]), )
def _imgs_to_tensor(img_u8, device): """uint8 [B,64,64,3] -> float [B,3,64,64] in [0,1].""" x = torch.as_tensor(np.asarray(img_u8), dtype=torch.float32, device=device) / 255.0 return x.permute(0, 3, 1, 2).contiguous()
# ----------------------------------------------------------------------------# reward-predictive CNN latent (encoder + goal-conditioned reward decoder)# ----------------------------------------------------------------------------def train_reward_latent_image(ds, z_dim, g_dim, cfg, device, seed, wlog): """E_psi(image), R_psi(z, g) trained so z retains reward-relevant info; then frozen. The reward is OBJECT goal-reaching on the 3-D block position (ds['obj']).""" enc = models.ImageEncoder(z_dim, hidden_dim=cfg["hidden_dim"]).to(device) dec = GCRewardDecoder(z_dim, g_dim, cfg["hidden_dim"], 2).to(device) opt = torch.optim.Adam(list(enc.parameters()) + list(dec.parameters()), lr=cfg["lr"]) rng = np.random.default_rng(seed + 3) obj, end = ds["obj"], ds["end"] lam = cfg.get("latent_l2", 1e-4) kind, sigma, eps = cfg["reward"], cfg["sigma"], cfg["epsilon"] steps = cfg.get("latent_steps", 20000) bs = cfg["batch_size"] final = 0.0 for step in range(1, steps + 1): x_idx = rng.integers(0, ds["N"], bs) g = obj[gc_core.sample_goal_after(x_idx, end, rng)] # hindsight block goal d = np.linalg.norm(obj[x_idx] - g, axis=1) r = gc_core.reward_of_dist(d, kind, sigma, eps).astype(np.float32) img = _imgs_to_tensor(ds["img"][x_idx], device) gt = torch.as_tensor(g, dtype=torch.float32, device=device) rt = torch.as_tensor(r, device=device) z = enc(img) loss = F.mse_loss(dec(z, gt), rt) + lam * (z ** 2).mean() opt.zero_grad(); loss.backward(); opt.step() if step % max(1, steps // 20) == 0 or step == 1: final = float(loss.item()) wlog({"latent/loss": final}, step=step) enc.eval(); dec.eval() for p in enc.parameters(): p.requires_grad_(False) for p in dec.parameters(): p.requires_grad_(False) return enc, dec, final
@torch.no_grad()def encode_images(enc, img_u8, device, batch=2048): out = [] for i in range(0, len(img_u8), batch): out.append(enc(_imgs_to_tensor(img_u8[i:i + batch], device)).cpu().numpy()) return np.concatenate(out, 0).astype(np.float32)
# ----------------------------------------------------------------------------# latent occupancy p_theta(z' | z_now, a, g)# ----------------------------------------------------------------------------def train_latent_occupancy_image(occ, ds, z_all, gamma, cfg, device, seed, wlog): """z_all: precomputed E_psi(image) for every step (conditioning AND target source). Goal g = hindsight block-position goal (ds['obj'] downstream of the target).""" act, end, obj = ds["act"], ds["end"], ds["obj"] rng = np.random.default_rng(seed + 7) t0 = rng.integers(0, ds["N"], 20000) j0 = gc_core.future_idx(t0, end, gamma, rng) g0 = obj[gc_core.sample_goal_after(j0, end, rng)] c0 = np.concatenate([z_all[t0], act[t0], g0], 1) occ.set_normalization(c0.mean(0), c0.std(0) + 1e-6, z_all[j0].mean(0), z_all[j0].std(0) + 1e-6) z_t = torch.from_numpy(z_all) opt = torch.optim.Adam(occ.parameters(), lr=cfg["lr"]) losses = [] log_every = max(1, cfg["steps"] // 50) bs = cfg["batch_size"] for step in range(1, cfg["steps"] + 1): t = rng.integers(0, ds["N"], bs) j = gc_core.future_idx(t, end, gamma, rng) g = obj[gc_core.sample_goal_after(j, end, rng)] c = np.concatenate([z_all[t], act[t], g], 1) loss = occ.training_loss(torch.as_tensor(c, dtype=torch.float32, device=device), z_t[j].to(device)) opt.zero_grad(); loss.backward() gn = torch.nn.utils.clip_grad_norm_(occ.parameters(), 10.0); opt.step() if step % log_every == 0 or step == 1: losses.append(float(loss.item())) wlog({"train/loss": float(loss.item()), "train/grad_norm": float(gn)}, step=step) occ.eval() return losses
@torch.no_grad()def latent_occ_q(occ, dec, z_now, a, g, N, device, batch=256): out = np.zeros(len(z_now)) for i in range(0, len(z_now), batch): c = np.concatenate([z_now[i:i + batch], a[i:i + batch], g[i:i + batch]], 1) ct = torch.as_tensor(c, dtype=torch.float32, device=device) z = occ.sample(ct, N) # [b, N, z] b, n, zd = z.shape gt = torch.as_tensor(g[i:i + batch], dtype=torch.float32, device=device) gt = gt.unsqueeze(1).expand(-1, n, -1).reshape(b * n, -1) r = dec(z.reshape(b * n, zd), gt).reshape(b, n) out[i:i + batch] = r.mean(1).cpu().numpy() return out
# ----------------------------------------------------------------------------# fresh-reset anchors with IMAGE conditioning state# ----------------------------------------------------------------------------def _fresh_reset_image_anchors(env_id, n_anchors, seed): """Protocol-B fresh-reset anchors for visual-cube. Identical to ``gc_core.fresh_reset_anchors`` except the recorded conditioning state ``s`` is the 64x64x3 IMAGE observation (the visual env reset returns an image obs while the oracle/truth read everything from the privileged ``info``). Returns the same pack dict (so ``gc_core.gc_fresh_truth_manipspace`` consumes it unchanged) with ``s_img`` = [A,64,64,3] uint8 added.""" fam = gc_core.manipspace_family(env_id) assert fam == "cube", f"expected cube family, got {fam} for {env_id}" env = gc_core._make_manipspace_env(env_id, _DATA_DIR) u = env.unwrapped oracles = gc_core._make_manipspace_oracles(env, fam) S_img, A, G, QP, QV, OBJ, TGT = [], [], [], [], [], [], [] for i in range(n_anchors): np.random.seed(seed * 100003 + i) ob, info = env.reset(seed=seed * 100003 + i) oracle = oracles[info["privileged/target_task"]] oracle.reset(ob, info) a0 = np.clip(np.asarray(oracle.select_action(ob, info), dtype=np.float64), -1, 1) S_img.append(np.asarray(ob, dtype=np.uint8)) # IMAGE obs A.append(a0.astype(np.float32)) G.append(gc_core._manipspace_goal(info, fam).astype(np.float32)) # 3-D block goal QP.append(np.asarray(info["qpos"], dtype=np.float64)) QV.append(np.asarray(info["qvel"], dtype=np.float64)) OBJ.append(gc_core._manipspace_object(info, fam).astype(np.float32)) TGT.append(gc_core._capture_manipspace_target(u, fam, info)) env.close() return dict(family=fam, s_img=np.stack(S_img), a=np.stack(A), g=np.stack(G), qpos=np.stack(QP), qvel=np.stack(QV), obj0=np.stack(OBJ), target=TGT, # `s` placeholder so gc_fresh_truth_manipspace's len(anchors["s"]) works s=np.stack(A))
# ----------------------------------------------------------------------------# genq (image reward-predictive latent occupancy) + fresh-reset truth# ----------------------------------------------------------------------------def run(env_id, seed, cfg): device = get_device() set_seed(seed) gamma = cfg["gamma"] occ_model = cfg.get("occ_model", "diffusion") z_dim = cfg.get("z_dim", 8) n_traj_tr = cfg.get("vis_train_traj", None) n_traj_val = cfg.get("vis_val_traj", None)
# manipulation reward scale (NOT maze sigma=5). Match state cube (0.05 / 0.04). if abs(cfg.get("sigma", 5.0) - 5.0) < 1e-9: cfg["sigma"] = 0.05 if abs(cfg.get("epsilon", 0.5) - 0.5) < 1e-9: cfg["epsilon"] = 0.04 kind, sigma, eps = cfg["reward"], cfg["sigma"], cfg["epsilon"]
block_slice = _resolve_cube_block_slice(env_id) g_dim = block_slice[1] - block_slice[0] # 3 for cube-single
train_ds = load_visual_cube(env_id, "train", block_slice, n_traj_tr) # fresh-reset anchors (image s + privileged qpos/qvel/target for truth) pack = _fresh_reset_image_anchors(env_id, cfg["n_anchors"], seed) s_img_a = pack["s_img"] a_a = pack["a"] g_a = pack["g"] # [A, 3] block goal
run_obj, wlog, wfinish = init_wandb( cfg.get("wandb_project", "genq-policy-eval"), f"genqvisualcube-{occ_model}-z{z_dim}-{env_id}-s{seed}", {**cfg, "env": env_id, "seed": seed, "method": "genq_reward_latent"}, mode=cfg.get("wandb_mode")) wandb_url = getattr(run_obj, "url", None)
t0 = time.time() enc, dec, latent_mse = train_reward_latent_image(train_ds, z_dim, g_dim, cfg, device, seed, wlog) z_train = encode_images(enc, train_ds["img"], device) cond_dim = z_dim + train_ds["a_dim"] + g_dim # (z_now, a, g) occ = gc_core.build_occupancy(occ_model, cond_dim, z_dim, cfg, device) losses = train_latent_occupancy_image(occ, train_ds, z_train, gamma, cfg, device, seed, wlog) train_wall = time.time() - t0
# FRESH-ROLLOUT truth (Protocol B) — CubeMarkovOracle rolled M x H from set_state. truth = gc_core.gc_fresh_truth_manipspace( env_id, pack, gamma, kind, sigma, eps, M=cfg.get("truth_M", 8), H=cfg.get("truth_H", 350), seed=seed, verbose=True, dataset_dir=_DATA_DIR) truth_kind = "fresh_rollout"
z_now_a = encode_images(enc, s_img_a, device) # encode anchor images gen_counts = cfg.get("gen_sample_counts", [1, 2, 4, 8, 16, 32, 64, 128, 256]) mse_by_n, corr_by_n, mse_curve = {}, {}, [] for N in gen_counts: mn = q_metrics(latent_occ_q(occ, dec, z_now_a, a_a, g_a, N, device), truth) mse_by_n[str(N)] = mn["mse"]; corr_by_n[str(N)] = mn["pearson"]; mse_curve.append(mn["mse"]) N_final = gen_counts[-1] est = latent_occ_q(occ, dec, z_now_a, a_a, g_a, N_final, device) m = q_metrics(est, truth)
result = { "method": "genq", "env": env_id, "seed": seed, "wandb_url": wandb_url, "representation": "image_reward_predictive_latent", "anchor_protocol": "fresh_reset", "occ_model": occ_model, "z_dim": z_dim, "reward": kind, "truth_kind": truth_kind, "gen_sample_counts": gen_counts, "train/loss": losses, "train/q_mse": [m["mse"]], "latent/reward_mse": latent_mse, "eval/q_mse": m["mse"], "eval/q_mae": m["mae"], "eval/q_corr": m["pearson"], "eval/q_spearman": m["spearman"], "eval/q_mse_by_n": mse_by_n, "eval/q_corr_by_n": corr_by_n, "eval/q_mse_vs_N": mse_curve, "eval/N_final": N_final, "eval/truth_std": float(np.std(truth)), "wall_clock_s": train_wall, "n_anchors": int(len(s_img_a)), "block_slice": list(block_slice), "sigma": sigma, "epsilon": eps, } wlog({"eval/q_mse": m["mse"], "eval/q_corr": m["pearson"]}) wfinish() return result
# ----------------------------------------------------------------------------# mc / td baselines on the cube STATE (28-D obs) — non-latent reference# ----------------------------------------------------------------------------# A trained-MC / IQL-TD critic over RAW 64x64x3 pixels is a separate CNN-critic study.# The honest, comparable reference here is the SAME mc/td recipe on the cube STATE, run# against the IDENTICAL fresh-reset truth. The underlying sim for visual-cube IS the# state cube (only the observation rendering differs), and ``mc.run`` / ``td.run`` already# use ``gc_core.fresh_reset_anchors`` + ``gc_core.gc_fresh_truth_manipspace`` on the cube# family with the SAME (seed, n_anchors, M, H, sigma, eps). So delegating to the proven# state-cube mc/td and only relabeling ``env`` gives results scored against the same# fresh-rollout truth as genq, with zero reimplementation risk. ``representation`` and# ``state_env`` document the deviation in the JSON.def _run_state_baseline(method, env_id, seed, cfg): import mc as mc_mod import td as td_mod state_env_id = env_id.replace("visual-", "") fn = mc_mod.run if method == "mc" else td_mod.run result = fn(state_env_id, seed, cfg) result["env"] = env_id result["state_env"] = state_env_id result["representation"] = "cube_state_28d_nonlatent_reference" return result
def run_mc(env_id, seed, cfg): """Trained-MC critic on the cube STATE (non-latent reference; same fresh-reset truth).""" return _run_state_baseline("mc", env_id, seed, cfg)
def run_td(env_id, seed, cfg): """IQL-TD critic on the cube STATE (non-latent reference; same fresh-reset truth).""" return _run_state_baseline("td", env_id, seed, cfg)
if __name__ == "__main__": pass123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439"""Gen-Q policy evaluation for the IMAGE puzzle env (visual-puzzle-3x3-play-v0).
Why this file exists--------------------This is the IMAGE + COMBINATORIAL cell (issue #35). It marries two existing recipes:
* the image reward-predictive-latent occupancy of ``genq_visual.py`` (CNN encoder over 64x64x3 frames, NEVER raw-pixel occupancy), and * the puzzle button-state machinery of ``gc_core.py`` (the match-fraction reward and the manipspace fresh-RESET fresh-rollout truth used by the STATE puzzle cell).
The puzzle reward / goal / occupancy TARGET are BINARY button-state vectors (9 bits for3x3), NOT object positions. The principled reward is the match-fraction(``gc_core.puzzle_reward``, see issue #35) used IDENTICALLY by genq, mc, td and thefresh-rollout truth.
Recipe (reward-predictive image latent, frozen, then latent occupancy)----------------------------------------------------------------------1. Encoder z = E_psi(image) (models.ImageEncoder, CNN, [B,3,64,64] in [0,1]) Decoder r_hat = R_psi(z, g) (g = 9-D goal button pattern) Loss E[(R_psi(E_psi(image), g) - puzzle_reward(button_states; g))^2] + lam||z||^2 ; FREEZE E,R.2. Conditioning: occupancy on (z_now, a, g), z_now = E_psi(image_now).3. Occupancy p_theta(z' | z_now, a, g), z' = stopgrad(E_psi(image_{t+k})), k ~ Geom(1-gamma). Conditional diffusion (NEVER a Gaussian MDN).4. Q^pi(s,a,g) = E_{z ~ p_theta}[ R_psi(z, g) ] ~= (1/N) sum_i R_psi(z_i, g).
Ground truth = FRESH ROLLOUTS only (fresh-RESET Protocol B, identical to the STATEpuzzle). The live PuzzleEnv sim has all privileged info, so ``set_state(qpos,qvel,button_states)`` + ButtonMarkovOracle rollouts produce the truth REGARDLESS of whetherthe model's observation is an image or a state vector. The anchor pack is built ONCEfrom a live env reset and SHARED by genq/mc/td so the three score the SAME (s,a,g).
mc / td baselines: trained-MC / IQL-TD critics over the 46-D [qpos|qvel] STATE (thenon-latent reference, documented via ``representation``), exactly mirroring thegenq_visual antmaze precedent where mc/td run on the 29-D ant state. The occupancyTARGET / reward signal for mc/td is the button-state vector (match-fraction reward),the same target genq's latent decoder predicts.
EXPECTED RESULT (honest negative, inherited from the STATE puzzle): the discretecombinatorial button task yields near-degenerate fresh-rollout truth (the targetbutton is either pressed or not within the horizon; truth std ~ 0.01), so Q isessentially unrankable and ALL THREE methods (mc/td/genq) land at ~0 correlation.This driver runs the pipeline honestly and reports whatever it finds; it does NOT tunetoward a spurious positive. The image latent is one more transformation on top of thesame degenerate truth, so the image case is expected to CONFIRM the state negative."""import osimport time
import numpy as npimport torchimport torch.nn.functional as F
from _common import get_device, set_seed, q_metrics, init_wandbimport gc_coreimport modelsfrom genq_reward_latent import GCRewardDecoder
_HERE = os.path.dirname(os.path.abspath(__file__))_DATA_DIR = os.path.expanduser(os.environ.get("OGBENCH_DATA_DIR", "~/.ogbench/data"))
# ----------------------------------------------------------------------------# visual-puzzle dataset (images + button_states + qpos/qvel)# ----------------------------------------------------------------------------def load_visual_puzzle(env_id, split, n_traj=None): """Load the visual-puzzle npz for `split` in {"train","val"}.
Returns a dataset dict with: img : uint8 [N, 64, 64, 3] (observation; encoded by the CNN, never raw) button : float32 [N, 9] (button-state vector; reward/goal/occ TARGET) full : float32 [N, 46] (qpos[23]+qvel[23]; the mc/td STATE reference) act : float32 [N, 5] end : int64 [N] (trajectory end index per step) N, a_dim
`n_traj` (optional) caps the number of trajectories loaded — used only for fast CPU smoke tests; the real GPU runs use the full set. """ fname = env_id if split == "train" else f"{env_id}-val" path = os.path.join(_DATA_DIR, f"{fname}.npz") if not os.path.exists(path): raise FileNotFoundError(f"visual-puzzle dataset not found: {path}") d = np.load(path, mmap_mode="r") term = np.asarray(d["terminals"], dtype=np.float32) if n_traj is not None: ends = np.where(term > 0.5)[0] + 1 N = int(ends[min(n_traj, len(ends)) - 1]) if len(ends) else len(term) else: N = len(term) qpos = np.asarray(d["qpos"][:N], dtype=np.float32) qvel = np.asarray(d["qvel"][:N], dtype=np.float32) full = np.concatenate([qpos, qvel], axis=1) # [N, 46] button = np.asarray(d["button_states"][:N], dtype=np.float32) return dict( img=d["observations"][:N], # mmap'd uint8; index lazily button=button, full=full, act=np.asarray(d["actions"][:N], dtype=np.float32), end=gc_core.trajectory_bounds(term[:N]), N=N, a_dim=int(d["actions"].shape[1]), pos_dim=int(button.shape[1]), )
def _imgs_to_tensor(img_u8, device): x = torch.as_tensor(np.asarray(img_u8), dtype=torch.float32, device=device) / 255.0 return x.permute(0, 3, 1, 2).contiguous()
# ----------------------------------------------------------------------------# shared fresh-reset anchor pack (built ONCE; genq/mc/td all query the same (s,a,g))# ----------------------------------------------------------------------------def build_shared_anchors(env_id, cfg, seed): """Fresh-RESET anchors for visual-puzzle. The live (image-obs) PuzzleEnv reset gives the IMAGE obs (genq conditioning), the privileged button goal g, the behaviour oracle action a, and qpos/qvel/button_states (for set_state + the mc/td state reference). Identical protocol to the STATE puzzle, just with an image `s`.""" pack = gc_core.fresh_reset_anchors(env_id, cfg["n_anchors"], seed, dataset_dir=_DATA_DIR) # pack["s"] is the image obs (the visual env returns 64x64x3). Add the 46-D state. pack["state"] = np.concatenate([pack["qpos"], pack["qvel"]], axis=1).astype(np.float32) return pack
# ----------------------------------------------------------------------------# reward-predictive CNN latent (encoder + button-goal-conditioned reward decoder)# ----------------------------------------------------------------------------def train_reward_latent_image(ds, z_dim, cfg, device, seed, wlog): """z = E_psi(image); r_hat = R_psi(z, g); fit to puzzle_reward(button; g), then freeze.""" pos = ds["pos_dim"] enc = models.ImageEncoder(z_dim, hidden_dim=cfg["hidden_dim"]).to(device) dec = GCRewardDecoder(z_dim, pos, cfg["hidden_dim"], 2).to(device) opt = torch.optim.Adam(list(enc.parameters()) + list(dec.parameters()), lr=cfg["lr"]) rng = np.random.default_rng(seed + 3) button, end = ds["button"], ds["end"] lam = cfg.get("latent_l2", 1e-4) kind = cfg["reward"] steps = cfg.get("latent_steps", 20000) bs = cfg["batch_size"] final = 0.0 for step in range(1, steps + 1): x_idx = rng.integers(0, ds["N"], bs) g = button[gc_core.sample_goal_after(x_idx, end, rng)] # downstream button pattern r = gc_core.puzzle_reward(button[x_idx], g, kind).astype(np.float32) img = _imgs_to_tensor(ds["img"][x_idx], device) gt = torch.as_tensor(g, dtype=torch.float32, device=device) rt = torch.as_tensor(r, device=device) z = enc(img) loss = F.mse_loss(dec(z, gt), rt) + lam * (z ** 2).mean() opt.zero_grad(); loss.backward(); opt.step() if step % max(1, steps // 20) == 0 or step == 1: final = float(loss.item()) wlog({"latent/loss": final}, step=step) enc.eval(); dec.eval() for p in enc.parameters(): p.requires_grad_(False) for p in dec.parameters(): p.requires_grad_(False) return enc, dec, final
@torch.no_grad()def encode_images(enc, img_u8, device, batch=2048): out = [] for i in range(0, len(img_u8), batch): out.append(enc(_imgs_to_tensor(img_u8[i:i+batch], device)).cpu().numpy()) return np.concatenate(out, 0).astype(np.float32)
# ----------------------------------------------------------------------------# latent occupancy p_theta(z' | z_now, a, g)# ----------------------------------------------------------------------------def train_latent_occupancy_image(occ, ds, z_all, gamma, cfg, device, seed, wlog): act, end = ds["act"], ds["end"] button = ds["button"] rng = np.random.default_rng(seed + 7) t0 = rng.integers(0, ds["N"], 20000) j0 = gc_core.future_idx(t0, end, gamma, rng) g0 = button[gc_core.sample_goal_after(j0, end, rng)] c0 = np.concatenate([z_all[t0], act[t0], g0], 1) occ.set_normalization(c0.mean(0), c0.std(0) + 1e-6, z_all[j0].mean(0), z_all[j0].std(0) + 1e-6) z_t = torch.from_numpy(z_all) opt = torch.optim.Adam(occ.parameters(), lr=cfg["lr"]) losses = [] log_every = max(1, cfg["steps"] // 50) bs = cfg["batch_size"] for step in range(1, cfg["steps"] + 1): t = rng.integers(0, ds["N"], bs) j = gc_core.future_idx(t, end, gamma, rng) g = button[gc_core.sample_goal_after(j, end, rng)] c = np.concatenate([z_all[t], act[t], g], 1) loss = occ.training_loss(torch.as_tensor(c, dtype=torch.float32, device=device), z_t[j].to(device)) opt.zero_grad(); loss.backward() gn = torch.nn.utils.clip_grad_norm_(occ.parameters(), 10.0); opt.step() if step % log_every == 0 or step == 1: losses.append(float(loss.item())) wlog({"train/loss": float(loss.item()), "train/grad_norm": float(gn)}, step=step) occ.eval() return losses
@torch.no_grad()def latent_occ_q(occ, dec, z_now, a, g, N, device, batch=256): out = np.zeros(len(z_now)) for i in range(0, len(z_now), batch): c = np.concatenate([z_now[i:i+batch], a[i:i+batch], g[i:i+batch]], 1) ct = torch.as_tensor(c, dtype=torch.float32, device=device) z = occ.sample(ct, N) # [b, N, z] b, n, zd = z.shape gt = torch.as_tensor(g[i:i+batch], dtype=torch.float32, device=device) gt = gt.unsqueeze(1).expand(-1, n, -1).reshape(b * n, -1) r = dec(z.reshape(b * n, zd), gt).reshape(b, n) out[i:i+batch] = r.mean(1).cpu().numpy() return out
def _truth_for_pack(env_id, pack, cfg, seed): """Fresh-rollout truth at the shared pack (identical to the STATE puzzle path).""" return gc_core.gc_fresh_truth_manipspace( env_id, pack, cfg["gamma"], cfg["reward"], cfg["sigma"], cfg["epsilon"], M=cfg.get("truth_M", 8), H=cfg.get("truth_H", 200), seed=seed, verbose=True, dataset_dir=_DATA_DIR)
# ----------------------------------------------------------------------------# genq (image reward-predictive latent occupancy)# ----------------------------------------------------------------------------def run(env_id, seed, cfg, pack=None, truth=None): device = get_device() set_seed(seed) gamma = cfg["gamma"]; kind = cfg["reward"] occ_model = cfg.get("occ_model", "diffusion") z_dim = cfg.get("z_dim", 8)
train_ds = load_visual_puzzle(env_id, "train", cfg.get("vis_train_traj")) pos = train_ds["pos_dim"]
run_obj, wlog, wfinish = init_wandb( cfg.get("wandb_project", "genq-policy-eval"), f"genqvispuzzle-{occ_model}-z{z_dim}-{env_id}-s{seed}", {**cfg, "env": env_id, "seed": seed, "method": "genq_reward_latent"}, mode=cfg.get("wandb_mode")) wandb_url = getattr(run_obj, "url", None)
if pack is None: pack = build_shared_anchors(env_id, cfg, seed) a_a = pack["a"].astype(np.float32) g_a = pack["g"].astype(np.float32) # 9-D goal button pattern s_img_a = pack["s"] # image obs at each anchor
t0 = time.time() enc, dec, latent_mse = train_reward_latent_image(train_ds, z_dim, cfg, device, seed, wlog) z_train = encode_images(enc, train_ds["img"], device) cond_dim = z_dim + train_ds["a_dim"] + pos # (z_now, a, g_button) occ = gc_core.build_occupancy(occ_model, cond_dim, z_dim, cfg, device) losses = train_latent_occupancy_image(occ, train_ds, z_train, gamma, cfg, device, seed, wlog) train_wall = time.time() - t0
if truth is None: truth = _truth_for_pack(env_id, pack, cfg, seed) z_now_a = encode_images(enc, s_img_a, device)
gen_counts = cfg.get("gen_sample_counts", [1, 2, 4, 8, 16, 32, 64, 128, 256]) mse_by_n, corr_by_n, mse_curve = {}, {}, [] for N in gen_counts: mn = q_metrics(latent_occ_q(occ, dec, z_now_a, a_a, g_a, N, device), truth) mse_by_n[str(N)] = mn["mse"]; corr_by_n[str(N)] = mn["pearson"]; mse_curve.append(mn["mse"]) N_final = gen_counts[-1] est = latent_occ_q(occ, dec, z_now_a, a_a, g_a, N_final, device) m = q_metrics(est, truth)
result = { "method": "genq_reward_latent", "env": env_id, "seed": seed, "wandb_url": wandb_url, "representation": "image_reward_predictive_latent", "occ_model": occ_model, "z_dim": z_dim, "reward": kind, "truth_kind": "fresh_rollout", "anchor_protocol": "fresh_reset", "gen_sample_counts": gen_counts, "train/loss": losses, "train/q_mse": [m["mse"]], "latent/reward_mse": latent_mse, "eval/q_mse": m["mse"], "eval/q_mae": m["mae"], "eval/q_corr": m["pearson"], "eval/q_spearman": m["spearman"], "eval/q_mse_by_n": mse_by_n, "eval/q_corr_by_n": corr_by_n, "eval/q_mse_vs_N": mse_curve, "eval/N_final": N_final, "eval/truth_std": float(np.std(truth)), "wall_clock_s": train_wall, "n_anchors": int(len(a_a)), } wlog({"eval/q_mse": m["mse"], "eval/q_corr": m["pearson"]}); wfinish() return result, pack, truth
# ----------------------------------------------------------------------------# mc / td baselines on the 46-D [qpos|qvel] STATE (non-latent reference, documented)# ----------------------------------------------------------------------------def _state_setup(env_id, cfg): """Train/val state datasets: obs = 46-D [qpos|qvel]; occupancy TARGET = button vec.""" tr_v = load_visual_puzzle(env_id, "train", cfg.get("vis_train_traj")) tr = dict(obs=tr_v["full"], act=tr_v["act"], end=tr_v["end"], N=tr_v["N"], s_dim=tr_v["full"].shape[1], a_dim=tr_v["a_dim"], pos_dim=tr_v["pos_dim"], obj=tr_v["button"], manipspace=True, family="puzzle") return tr
def run_mc(env_id, seed, cfg, pack=None, truth=None): import mc as mc_mod device = get_device(); set_seed(seed) gamma = cfg["gamma"]; kind, sigma, eps = cfg["reward"], cfg["sigma"], cfg["epsilon"] tr = _state_setup(env_id, cfg) pos = tr["pos_dim"]
run_obj, wlog, wfinish = init_wandb( cfg.get("wandb_project", "genq-policy-eval"), f"mc-state46-{env_id}-s{seed}", {**cfg, "env": env_id, "seed": seed, "method": "mc"}, mode=cfg.get("wandb_mode")) wandb_url = getattr(run_obj, "url", None)
if pack is None: pack = build_shared_anchors(env_id, cfg, seed) s_a = pack["state"]; a_a = pack["a"].astype(np.float32); g_a = pack["g"].astype(np.float32)
rng = np.random.default_rng(seed) tgt = tr["obj"] # button states (occ target / reward signal) cand = np.where((tr["end"] - np.arange(tr["N"])) >= 2)[0] n_fit = min(cfg.get("mc_fit_anchors", 80000), len(cand)) fit_idx = cand[rng.integers(0, len(cand), size=n_fit)] fit_g = tgt[gc_core.sample_goal_idx(fit_idx, tr["end"], rng)] fit_ret = mc_mod.gc_return(tgt, tr["end"], fit_g, fit_idx, gamma, sigma, kind, eps, family="puzzle")
net = mc_mod.QNet(tr["s_dim"], pos, tr["a_dim"], cfg["hidden_dim"], cfg["num_layers"]).to(device) opt = torch.optim.Adam(net.parameters(), lr=cfg["lr"]) St = torch.as_tensor(tr["obs"][fit_idx], dtype=torch.float32) Gt = torch.as_tensor(fit_g, dtype=torch.float32) At = torch.as_tensor(tr["act"][fit_idx], dtype=torch.float32) Rt = torch.as_tensor(fit_ret, dtype=torch.float32) losses, qmse = [], []; log_every = max(1, cfg["steps"] // 50); t0 = time.time() for step in range(1, cfg["steps"] + 1): b = rng.integers(0, len(fit_idx), cfg["batch_size"]) loss = ((net(St[b].to(device), Gt[b].to(device), At[b].to(device)) - Rt[b].to(device)) ** 2).mean() opt.zero_grad(); loss.backward(); opt.step() if step % log_every == 0 or step == 1: losses.append(float(loss.item())); qmse.append(float(loss.item())) wlog({"train/loss": float(loss.item()), "train/q_mse": float(loss.item())}, step=step) net.eval(); train_wall = time.time() - t0
if truth is None: truth = _truth_for_pack(env_id, pack, cfg, seed) with torch.no_grad(): est = net(torch.as_tensor(s_a, dtype=torch.float32, device=device), torch.as_tensor(g_a, dtype=torch.float32, device=device), torch.as_tensor(a_a, dtype=torch.float32, device=device)).cpu().numpy() m = q_metrics(est, truth) result = {"method": "mc", "env": env_id, "seed": seed, "wandb_url": wandb_url, "representation": "puzzle_state_46d", "reward": kind, "truth_kind": "fresh_rollout", "anchor_protocol": "fresh_reset", "train/loss": losses, "train/q_mse": qmse, "eval/q_mse": m["mse"], "eval/q_mae": m["mae"], "eval/q_corr": m["pearson"], "eval/q_spearman": m["spearman"], "eval/truth_std": float(np.std(truth)), "wall_clock_s": train_wall, "n_anchors": int(len(a_a))} wlog({"eval/q_mse": m["mse"], "eval/q_corr": m["pearson"]}); wfinish() return result, pack, truth
def run_td(env_id, seed, cfg, pack=None, truth=None): import mc as mc_mod import td as td_mod device = get_device(); set_seed(seed) gamma = cfg["gamma"]; kind, sigma, eps = cfg["reward"], cfg["sigma"], cfg["epsilon"] tr = _state_setup(env_id, cfg) pos = tr["pos_dim"]
run_obj, wlog, wfinish = init_wandb( cfg.get("wandb_project", "genq-policy-eval"), f"td-state46-{env_id}-s{seed}", {**cfg, "env": env_id, "seed": seed, "method": "td"}, mode=cfg.get("wandb_mode")) wandb_url = getattr(run_obj, "url", None)
if pack is None: pack = build_shared_anchors(env_id, cfg, seed) s_a = pack["state"]; a_a = pack["a"].astype(np.float32); g_a = pack["g"].astype(np.float32)
obs = tr["obs"]; act = tr["act"]; end = tr["end"]; N = tr["N"]; tgt = tr["obj"] nxt = np.where((end - np.arange(N)) > 1)[0] sd, ad = tr["s_dim"], tr["a_dim"]; Hd, L = cfg["hidden_dim"], cfg["num_layers"] q = mc_mod.QNet(sd, pos, ad, Hd, L).to(device) qt = mc_mod.QNet(sd, pos, ad, Hd, L).to(device); qt.load_state_dict(q.state_dict()) v = td_mod.VNet(sd, pos, Hd, L).to(device) optq = torch.optim.Adam(q.parameters(), lr=cfg["lr"]) optv = torch.optim.Adam(v.parameters(), lr=cfg["lr"]) tau = cfg.get("iql_expectile", 0.5); polyak = cfg.get("polyak", 0.005) rng = np.random.default_rng(seed) losses, qmse = [], []; log_every = max(1, cfg["steps"] // 50); t0 = time.time() for step in range(1, cfg["steps"] + 1): idx = nxt[rng.integers(0, len(nxt), size=cfg["batch_size"])] g = tgt[gc_core.sample_goal_idx(idx, end, rng)] # button-pattern goal r = gc_core.puzzle_reward(tgt[idx], g, kind).astype(np.float32) # match-fraction reward s = torch.as_tensor(obs[idx], device=device) a = torch.as_tensor(act[idx], device=device) s2 = torch.as_tensor(obs[idx + 1], device=device) gt = torch.as_tensor(g, dtype=torch.float32, device=device) rt = torch.as_tensor(r, device=device) with torch.no_grad(): qsa = qt(s, gt, a) diff = qsa - v(s, gt) w = torch.abs(tau - (diff < 0).float()) loss_v = (w * diff ** 2).mean() optv.zero_grad(); loss_v.backward(); optv.step() with torch.no_grad(): y = (1 - gamma) * rt + gamma * v(s2, gt) loss_q = ((q(s, gt, a) - y) ** 2).mean() optq.zero_grad(); loss_q.backward(); optq.step() with torch.no_grad(): for p, ptg in zip(q.parameters(), qt.parameters()): ptg.mul_(1 - polyak).add_(polyak * p) if step % log_every == 0 or step == 1: losses.append(float(loss_q.item())); qmse.append(float(loss_q.item())) wlog({"train/loss": float(loss_q.item()), "train/q_mse": float(loss_q.item()), "train/v_loss": float(loss_v.item())}, step=step) q.eval(); train_wall = time.time() - t0
if truth is None: truth = _truth_for_pack(env_id, pack, cfg, seed) with torch.no_grad(): est = q(torch.as_tensor(s_a, dtype=torch.float32, device=device), torch.as_tensor(g_a, dtype=torch.float32, device=device), torch.as_tensor(a_a, dtype=torch.float32, device=device)).cpu().numpy() m = q_metrics(est, truth) result = {"method": "td", "env": env_id, "seed": seed, "wandb_url": wandb_url, "representation": "puzzle_state_46d", "reward": kind, "truth_kind": "fresh_rollout", "anchor_protocol": "fresh_reset", "train/loss": losses, "train/q_mse": qmse, "eval/q_mse": m["mse"], "eval/q_mae": m["mae"], "eval/q_corr": m["pearson"], "eval/q_spearman": m["spearman"], "eval/truth_std": float(np.std(truth)), "wall_clock_s": train_wall, "n_anchors": int(len(a_a))} wlog({"eval/q_mse": m["mse"], "eval/q_corr": m["pearson"]}); wfinish() return result, pack, truth
if __name__ == "__main__": pass123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112"""Animate how Gen-Q estimates the goal-conditioned Q^pi from the learned occupancy.
Trains a goal-conditioned diffusion occupancy on PointMaze, then renders a GIFshowing, for a query (s, a, g): * left panel: the occupancy cloud forming over DDIM denoising steps, coloured by goal-reaching reward, over the maze + reward field; * right panel: the running estimate Q^pi(s,a,g) = mean_i r(x_i; g) converging as the denoising sharpens."""import argparseimport os
import numpy as npimport torchimport matplotlibmatplotlib.use("Agg")import matplotlib.pyplot as pltfrom matplotlib import animation
from _common import get_device, set_seedimport gc_corefrom config import make_cfg
_HERE = os.path.dirname(os.path.abspath(__file__))
def env_safe(env_id): return env_id.replace("-", "_")
def make_gif(env_id="pointmaze-medium-navigate-v0", seed=0, steps=20000, n=400, out=None): device = get_device() set_seed(seed) cfg = make_cfg(steps=steps, wandb_mode="disabled") gamma = cfg["gamma"]; sigma = cfg["sigma"]; pos = 2; cfg["pos_dim"] = pos kind, eps = "dense", cfg["epsilon"] train_ds, val_ds, env, _ = gc_core.load_ogbench_gc(env_id, gamma) env.reset() # maze layout rectangles (drawn under the scatter so occupancy mass visibly # respects the walls). If geometry can't be recovered, flag it. wall_rects, wall_extent = gc_core.maze_wall_rects(env) if wall_rects is None: print(f"[illustration] WARNING: no maze geometry for {env_id}; background " f"will be blank — FLAG this rather than trusting the layout.", flush=True)
cond_dim = train_ds["s_dim"] + train_ds["a_dim"] + pos occ = gc_core.build_occupancy("diffusion", cond_dim, pos, cfg, device) gc_core.train_gc_occupancy(occ, train_ds, gamma, cfg, device, seed)
rng = np.random.default_rng(seed) idx = gc_core.anchors_with_min_horizon(val_ds, 1, cfg["min_horizon"], rng)[0] s = val_ds["obs"][idx:idx + 1]; a = val_ds["act"][idx:idx + 1] g = val_ds["obs"][gc_core.sample_goal_idx(np.array([idx]), val_ds["end"], rng)][:, :pos] c = torch.as_tensor(np.concatenate([s, a, g], 1), dtype=torch.float32, device=device) _, traj = occ.sample_trajectory(c, n_samples=n)
def rew(pts): d = np.linalg.norm(pts - g[0][None], axis=1) return gc_core.reward_of_dist(d, kind, sigma, eps)
from matplotlib.patches import Rectangle running_q = [float(rew(cloud[0]).mean()) for cloud in traj] fig, (axL, axR) = plt.subplots(1, 2, figsize=(11, 5))
def frame(i): axL.clear(); axR.clear() # real maze layout underneath: wall cells as filled gray rectangles in xy if wall_rects is not None: for (x0, y0, w, h) in wall_rects: axL.add_patch(Rectangle((x0, y0), w, h, facecolor="0.6", edgecolor="0.4", lw=0.5, zorder=0)) axL.set_xlim(wall_extent[0], wall_extent[1]) axL.set_ylim(wall_extent[2], wall_extent[3]) axL.set_aspect("equal") pts = traj[i][0] axL.scatter(pts[:, 0], pts[:, 1], c=rew(pts), cmap="viridis", s=10, alpha=0.8, zorder=2) axL.scatter([s[0, 0]], [s[0, 1]], c="black", s=120, marker="*", label="query s", zorder=3) axL.scatter([g[0, 0]], [g[0, 1]], c="red", s=120, marker="X", label="goal g", zorder=3) axL.set_title(f"occupancy p_theta(.|s,a,g) over the maze — denoising step {i+1}/{len(traj)}") axL.legend(loc="upper left", fontsize=8) axR.plot(range(1, i + 2), running_q[:i + 1], "-o", color="tab:green") axR.axhline(running_q[-1], ls="--", color="gray", alpha=0.6, label=f"final Q={running_q[-1]:.3f}") axR.set_xlim(1, len(traj)); axR.set_ylim(0, max(running_q) * 1.2 + 1e-6) axR.set_xlabel("denoising step"); axR.set_ylabel("Q(s,a,g) = mean r(x;g)") axR.set_title("Gen-Q estimate converging"); axR.legend(fontsize=8); axR.grid(alpha=0.3)
anim = animation.FuncAnimation(fig, frame, frames=len(traj), interval=200) out = out or os.path.join(_HERE, "experiments", env_safe(env_id), "figures", "illustration.gif") os.makedirs(os.path.dirname(out), exist_ok=True) anim.save(out, writer=animation.PillowWriter(fps=5)) plt.close(fig) print(f"[illustration] wrote {out} final Q={running_q[-1]:.4f}", flush=True) return out
def main(): ap = argparse.ArgumentParser() ap.add_argument("--env", default="pointmaze-medium-navigate-v0") ap.add_argument("--seed", type=int, default=0) ap.add_argument("--steps", type=int, default=20000) ap.add_argument("--n", type=int, default=400) ap.add_argument("--out", default=None, help="explicit output path. visual-pointmaze has no live env, but the " "occupancy->Q mechanism is identical on the underlying maze, so we " "render the state-maze illustration into the visual env figures dir.") args = ap.parse_args() make_gif(args.env, args.seed, args.steps, args.n, out=args.out)
if __name__ == "__main__": main()123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150"""Monte-Carlo goal-conditioned policy evaluation of Q^pi(s, a, g).
Math----The goal-conditioned behaviour value is the discounted occupancy expectation ofthe goal-reaching reward:
Q^pi(s, a, g) = (1-gamma) E[ sum_{k>=0} gamma^k r(s_{t+k}; g) | s,a,g ].
MC estimates this from logged trajectories: the renormalized discountedreturn-to-go toward a hindsight goal g,
G_t(g) = ( sum_{j>=t} (1-gamma)gamma^{j-t} r(s_j; g) ) / ( sum_{j>=t} (1-gamma)gamma^{j-t} ),
is an unbiased (high-variance) sample of Q^pi(s_t, a_t, g). We fit a regressorQ_MC(s, a, g) on these targets so the estimate generalizes and averages outsingle-rollout variance (the strong "trained MC" baseline).
NOTE the in-trajectory return-to-go is the TRAINING TARGET for the MC regressoronly; the regressor's predictions are scored against FRESH on-policy rollouts(``evaluate_policy.ground_truth_q``), exactly like Gen-Q and TD.
Pseudocode---------- for sampled transitions t with hindsight goal g_t: G_t(g_t) <- renorm return-to-go train Q_MC(s, a, g) by regression onto {(s_t, a_t, g_t) -> G_t} eval : Q_MC(s_anchor, a_anchor, g_anchor) ; score vs fresh-rollout truth"""import time
import numpy as npimport torchimport torch.nn as nn
from _common import get_device, set_seed, q_metrics, init_wandbimport gc_coreimport modelsfrom evaluate_policy import ground_truth_q
class QNet(nn.Module): """Q(s, g, a).""" def __init__(self, s_dim, g_dim, a_dim, hidden=256, layers=3): super().__init__() self.net = models.mlp(s_dim + g_dim + a_dim, 1, hidden, layers)
def forward(self, s, g, a): return self.net(torch.cat([s, g, a], -1)).squeeze(-1)
def gc_return(obs_xy, end, goal_xy, anchors, gamma, sigma, kind, eps, family=None): """Renormalized discounted goal-reaching return along each anchor's trajectory.
For puzzle (family=="puzzle") obs_xy / goal_xy are binary button-state vectors and the per-step reward is the match-fraction (``puzzle_reward``); else position-distance.""" out = np.zeros(len(anchors)) for i, t in enumerate(anchors): e = end[t]; g = goal_xy[i] idx = np.arange(t, e) if family == "puzzle": r = gc_core.puzzle_reward(obs_xy[idx], g[None, :], kind) else: d = np.linalg.norm(obs_xy[idx] - g, axis=1) r = gc_core.reward_of_dist(d, kind, sigma, eps) w = (1 - gamma) * gamma ** (idx - t) out[i] = (w * r).sum() / max(w.sum(), 1e-12) return out
def run(env_id, seed, cfg): device = get_device() set_seed(seed) gamma = cfg["gamma"] kind, sigma, eps = cfg["reward"], cfg["sigma"], cfg["epsilon"] state_slice = cfg.get("state_slice", "auto") train_ds, val_ds, _, _ = gc_core.load_ogbench_gc(env_id, gamma, state_slice=state_slice) pos = train_ds.get("pos_dim", cfg.get("pos_dim", 2)) cfg["pos_dim"] = pos rng = np.random.default_rng(seed) pack = gc_core.prepare_eval_anchors(env_id, val_ds, cfg, seed) sigma, eps = cfg["sigma"], cfg["epsilon"] # prepare may set manipspace reward scale s_a, a_a, g_a = pack["s"], pack["a"], pack["g"] anchors = pack["anchor_idx"] anchor_full = pack["anchor_full"]
run_obj, wlog, wfinish = init_wandb( cfg.get("wandb_project", "genq-policy-eval"), f"mc-{env_id}-s{seed}", {**cfg, "env": env_id, "seed": seed, "method": "mc"}, mode=cfg.get("wandb_mode")) wandb_url = getattr(run_obj, "url", None)
# training targets: hindsight-goal-conditioned return-to-go on the train set. # The reward/goal POSITION is the privileged object pos for manipspace, else xy. tr = train_ds tgt_pos = gc_core._target_array(tr, cfg) # [N, pos] cand = np.where((tr["end"] - np.arange(tr["N"])) >= 2)[0] n_fit = min(cfg.get("mc_fit_anchors", 80000), len(cand)) fit_idx = cand[rng.integers(0, len(cand), size=n_fit)] fit_g = tgt_pos[gc_core.sample_goal_idx(fit_idx, tr["end"], rng)] family = tr.get("family") fit_ret = gc_return(tgt_pos, tr["end"], fit_g, fit_idx, gamma, sigma, kind, eps, family=family)
net = QNet(tr["s_dim"], pos, tr["a_dim"], cfg["hidden_dim"], cfg["num_layers"]).to(device) opt = torch.optim.Adam(net.parameters(), lr=cfg["lr"]) St = torch.as_tensor(tr["obs"][fit_idx], dtype=torch.float32) Gt = torch.as_tensor(fit_g, dtype=torch.float32) At = torch.as_tensor(tr["act"][fit_idx], dtype=torch.float32) Rt = torch.as_tensor(fit_ret, dtype=torch.float32)
losses, qmse = [], [] log_every = max(1, cfg["steps"] // 50) t0 = time.time() for step in range(1, cfg["steps"] + 1): b = rng.integers(0, len(fit_idx), cfg["batch_size"]) loss = ((net(St[b].to(device), Gt[b].to(device), At[b].to(device)) - Rt[b].to(device)) ** 2).mean() opt.zero_grad(); loss.backward(); opt.step() if step % log_every == 0 or step == 1: losses.append(float(loss.item())); qmse.append(float(loss.item())) wlog({"train/loss": float(loss.item()), "train/q_mse": float(loss.item())}, step=step) net.eval() train_wall = time.time() - t0
truth, truth_kind = ground_truth_q(env_id, val_ds, anchors, g_a, gamma, kind=kind, sigma=sigma, eps=eps, M=cfg.get("truth_M", 8), H=cfg.get("truth_H", 350), seed=seed, anchor_full=anchor_full, anchors_pack=pack["anchors_pack"]) with torch.no_grad(): est = net(torch.as_tensor(s_a, dtype=torch.float32, device=device), torch.as_tensor(g_a, dtype=torch.float32, device=device), torch.as_tensor(a_a, dtype=torch.float32, device=device)).cpu().numpy() m = q_metrics(est, truth)
result = { "method": "mc", "env": env_id, "seed": seed, "wandb_url": wandb_url, "reward": kind, "truth_kind": truth_kind, "anchor_protocol": pack["anchor_protocol"], "train/loss": losses, "train/q_mse": qmse, "eval/q_mse": m["mse"], "eval/q_mae": m["mae"], "eval/q_corr": m["pearson"], "eval/q_spearman": m["spearman"], "eval/truth_std": float(np.std(truth)), "wall_clock_s": train_wall, "n_anchors": int(len(s_a)), } wlog({"eval/q_mse": m["mse"], "eval/q_corr": m["pearson"]}) wfinish() return result
if __name__ == "__main__": pass123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487"""Models: conditional Gaussian mixture density network, encoder/reward decoder,one-step dynamics model, and proposal network. All in PyTorch."""import mathimport numpy as npimport torchimport torch.nn as nnimport torch.nn.functional as F
LOG_2PI = math.log(2 * math.pi)
def mlp(in_dim, out_dim, hidden_dim, num_layers, act=nn.ReLU): layers = [] d = in_dim for _ in range(num_layers): layers += [nn.Linear(d, hidden_dim), act()] d = hidden_dim layers += [nn.Linear(d, out_dim)] return nn.Sequential(*layers)
class ConditionalGMM(nn.Module): """p(y | c) as a diagonal-covariance Gaussian mixture, c = conditioning input.
Outputs mixture logits [M], means [M, D], log_stds [M, D]. """
def __init__(self, cond_dim, y_dim, num_components=8, hidden_dim=256, num_layers=3, log_std_min=-7.0, log_std_max=2.0): super().__init__() self.y_dim = y_dim self.M = num_components self.log_std_min = log_std_min self.log_std_max = log_std_max self.backbone = mlp(cond_dim, hidden_dim, hidden_dim, num_layers) self.head_logits = nn.Linear(hidden_dim, num_components) self.head_means = nn.Linear(hidden_dim, num_components * y_dim) self.head_logstd = nn.Linear(hidden_dim, num_components * y_dim)
def forward(self, c): h = F.relu(self.backbone(c)) B = c.shape[0] logits = self.head_logits(h) # [B, M] means = self.head_means(h).view(B, self.M, self.y_dim) # [B, M, D] log_stds = self.head_logstd(h).view(B, self.M, self.y_dim) log_stds = torch.clamp(log_stds, self.log_std_min, self.log_std_max) return logits, means, log_stds
def training_loss(self, c, y): return -self.log_prob(c, y).mean()
@torch.no_grad() def eval_loss(self, c, y): return float((-self.log_prob(c, y)).mean().item())
def log_prob(self, c, y): """log p(y|c). y: [B, D]. Returns [B].""" logits, means, log_stds = self.forward(c) log_w = F.log_softmax(logits, dim=-1) # [B, M] y = y.unsqueeze(1) # [B, 1, D] var = torch.exp(2 * log_stds) comp_logp = -0.5 * (((y - means) ** 2) / var + 2 * log_stds + LOG_2PI) comp_logp = comp_logp.sum(-1) # [B, M] return torch.logsumexp(log_w + comp_logp, dim=-1) # [B]
def log_prob_from_params(self, params, y): logits, means, log_stds = params log_w = F.log_softmax(logits, dim=-1) y = y.unsqueeze(1) var = torch.exp(2 * log_stds) comp_logp = -0.5 * (((y - means) ** 2) / var + 2 * log_stds + LOG_2PI) comp_logp = comp_logp.sum(-1) return torch.logsumexp(log_w + comp_logp, dim=-1)
@torch.no_grad() def sample(self, c, n_samples=1): """Sample y ~ p(.|c). Returns [B, n_samples, D].""" logits, means, log_stds = self.forward(c) B = c.shape[0] probs = F.softmax(logits, dim=-1) # [B, M] comp = torch.multinomial(probs, n_samples, replacement=True) # [B, n_samples] idx = comp.unsqueeze(-1).expand(-1, -1, self.y_dim) # [B, n, D] mu = torch.gather(means, 1, idx) ls = torch.gather(log_stds, 1, idx) eps = torch.randn_like(mu) return mu + eps * torch.exp(ls)
@torch.no_grad() def sample_with_logprob(self, c, n_samples=1): y = self.sample(c, n_samples) # [B, n, D] B, n, D = y.shape params = self.forward(c) # broadcast log_prob over n samples logits, means, log_stds = params log_w = F.log_softmax(logits, dim=-1).unsqueeze(1) # [B,1,M] var = torch.exp(2 * log_stds).unsqueeze(1) # [B,1,M,D] mu = means.unsqueeze(1) # [B,1,M,D] ls = log_stds.unsqueeze(1) yy = y.unsqueeze(2) # [B,n,1,D] comp_logp = -0.5 * (((yy - mu) ** 2) / var + 2 * ls + LOG_2PI).sum(-1) # [B,n,M] logp = torch.logsumexp(log_w + comp_logp, dim=-1) # [B,n] return y, logp
class SinusoidalEmbedding(nn.Module): def __init__(self, dim): super().__init__() self.dim = dim
def forward(self, t): # t: [B] float in [0,1] device = t.device half = self.dim // 2 freqs = torch.exp(-math.log(10000) * torch.arange(half, device=device) / max(half - 1, 1)) ang = t[:, None] * freqs[None] * 1000.0 return torch.cat([torch.sin(ang), torch.cos(ang)], dim=-1)
def _cosine_abar(T, s=0.008): steps = torch.arange(T + 1, dtype=torch.float64) f = torch.cos(((steps / T) + s) / (1 + s) * math.pi / 2) ** 2 abar = f / f[0] return abar[1:].clamp(1e-6, 0.9999).float() # alpha_bar[t], t=1..T
class ConditionalDiffusion(nn.Module): """Conditional DDPM for p(y | c). Predicts noise eps; samples via DDIM.
Same external interface as ConditionalGMM where possible: `.sample(c, n)` -> [B,n,D]. Densities (for importance weighting) come from the probability-flow ODE: `.log_prob`. """
def __init__(self, cond_dim, y_dim, hidden_dim=256, num_layers=4, T=100, time_dim=64, sample_steps=30): super().__init__() self.y_dim = y_dim self.cond_dim = cond_dim self.T = T self.sample_steps = sample_steps self.time_emb = nn.Sequential(SinusoidalEmbedding(time_dim), nn.Linear(time_dim, time_dim), nn.SiLU(), nn.Linear(time_dim, time_dim)) self.cond_emb = nn.Sequential(nn.Linear(cond_dim, hidden_dim), nn.SiLU()) self.x_emb = nn.Linear(y_dim, hidden_dim) layers = [] d = hidden_dim + hidden_dim + time_dim for _ in range(num_layers): layers += [nn.Linear(d, hidden_dim), nn.SiLU()] d = hidden_dim self.trunk = nn.Sequential(*layers) self.out = nn.Linear(hidden_dim, y_dim) abar = _cosine_abar(T) self.register_buffer("abar", abar) # [T], index t-1 self.register_buffer("abar_prev", torch.cat([torch.ones(1), abar[:-1]])) # normalization buffers (identity until set_normalization called) self.register_buffer("cond_mean", torch.zeros(cond_dim)) self.register_buffer("cond_std", torch.ones(cond_dim)) self.register_buffer("y_mean", torch.zeros(y_dim)) self.register_buffer("y_std", torch.ones(y_dim))
def set_normalization(self, cond_mean, cond_std, y_mean, y_std): self.cond_mean.copy_(torch.as_tensor(cond_mean, dtype=torch.float32)) self.cond_std.copy_(torch.as_tensor(cond_std, dtype=torch.float32)) self.y_mean.copy_(torch.as_tensor(y_mean, dtype=torch.float32)) self.y_std.copy_(torch.as_tensor(y_std, dtype=torch.float32))
def _nc(self, c): return (c - self.cond_mean) / self.cond_std
def _ny(self, y): return (y - self.y_mean) / self.y_std
def _uny(self, yn): return yn * self.y_std + self.y_mean
def eps_pred(self, x, t_frac, c): """x:[B,D] normalized, t_frac:[B] in (0,1], c:[B,cond] normalized.""" te = self.time_emb(t_frac) h = torch.cat([self.x_emb(x), self.cond_emb(c), te], dim=-1) return self.out(self.trunk(h))
def training_loss(self, c, x0): c = self._nc(c); x0 = self._ny(x0) B = x0.shape[0] t = torch.randint(1, self.T + 1, (B,), device=x0.device) abar = self.abar[t - 1].unsqueeze(-1) noise = torch.randn_like(x0) xt = abar.sqrt() * x0 + (1 - abar).sqrt() * noise pred = self.eps_pred(xt, t.float() / self.T, c) return F.mse_loss(pred, noise)
@torch.no_grad() def eval_loss(self, c, x0, n_t=8): """Deterministic denoising-loss proxy averaged over a fixed t grid.""" c = self._nc(c); x0 = self._ny(x0) B = x0.shape[0] ts = torch.linspace(1, self.T, n_t, device=x0.device).long().clamp(1, self.T) gen = torch.Generator(device=x0.device).manual_seed(0) tot = 0.0 for t in ts: abar = self.abar[t - 1] noise = torch.randn(x0.shape, generator=gen, device=x0.device) xt = abar.sqrt() * x0 + (1 - abar).sqrt() * noise tf = torch.full((B,), float(t) / self.T, device=x0.device) pred = self.eps_pred(xt, tf, c) tot += F.mse_loss(pred, noise).item() return tot / len(ts)
@torch.no_grad() def sample(self, c, n_samples=1, steps=None, eta=0.0): """DDIM sampling. Returns [B, n_samples, D] in raw (unnormalized) coordinates.""" steps = steps or self.sample_steps c = self._nc(c) B = c.shape[0] cc = c.unsqueeze(1).expand(-1, n_samples, -1).reshape(B * n_samples, -1) x = torch.randn(B * n_samples, self.y_dim, device=c.device) ts = torch.linspace(self.T, 1, steps, device=c.device).long().clamp(1, self.T) for i in range(steps): t = ts[i] abar_t = self.abar[t - 1] tf = torch.full((B * n_samples,), float(t) / self.T, device=c.device) eps = self.eps_pred(x, tf, cc) x0 = (x - (1 - abar_t).sqrt() * eps) / abar_t.sqrt() x0 = x0.clamp(-5.0, 5.0) # normalized data is ~unit std; clamp well outside support if i < steps - 1: t_next = ts[i + 1] abar_n = self.abar[t_next - 1] sigma = eta * ((1 - abar_n) / (1 - abar_t)).sqrt() * (1 - abar_t / abar_n).sqrt() noise = torch.randn_like(x) if eta > 0 else 0.0 x = abar_n.sqrt() * x0 + (1 - abar_n - sigma ** 2).clamp(min=0).sqrt() * eps + sigma * noise else: x = x0 x = self._uny(x) return x.view(B, n_samples, self.y_dim)
@torch.no_grad() def sample_trajectory(self, c, n_samples=1, steps=None): """Like sample(), but returns (final, traj) where traj is a list of the clean-estimate x0 (raw coords) at each DDIM step -- for animating how the occupancy cloud forms.""" steps = steps or self.sample_steps c = self._nc(c); B = c.shape[0] cc = c.unsqueeze(1).expand(-1, n_samples, -1).reshape(B * n_samples, -1) x = torch.randn(B * n_samples, self.y_dim, device=c.device) ts = torch.linspace(self.T, 1, steps, device=c.device).long().clamp(1, self.T) traj = [] for i in range(steps): t = ts[i]; abar_t = self.abar[t - 1] tf = torch.full((B * n_samples,), float(t) / self.T, device=c.device) eps = self.eps_pred(x, tf, cc) x0 = ((x - (1 - abar_t).sqrt() * eps) / abar_t.sqrt()).clamp(-5.0, 5.0) traj.append(self._uny(x0).view(B, n_samples, self.y_dim).cpu().numpy()) if i < steps - 1: abar_n = self.abar[ts[i + 1] - 1] x = abar_n.sqrt() * x0 + (1 - abar_n).clamp(min=0).sqrt() * eps else: x = x0 return self._uny(x).view(B, n_samples, self.y_dim), traj
def score(self, x, t_frac, c): """score = grad_x log p_t(x) = -eps / sqrt(1-abar_t).""" t = (t_frac * self.T).round().long().clamp(1, self.T) abar = self.abar[t - 1].unsqueeze(-1) eps = self.eps_pred(x, t_frac, c) return -eps / (1 - abar).sqrt()
@torch.no_grad() def log_prob(self, c, y, steps=None, n_hutch=4): """Approximate log p(y|c) via the probability-flow ODE (continuous-time change of variables). Uses Hutchinson trace estimation. Returns [B].""" steps = steps or max(self.sample_steps, 40) device = y.device B = y.shape[0] c = self._nc(c) x = self._ny(y).clone() jac_norm = -torch.log(self.y_std).sum() # change of vars for normalization logdet = torch.zeros(B, device=device) # integrate from t=eps_t -> t=1 (data -> noise) in continuous time s in (0,1] s_grid = torch.linspace(1.0 / self.T, 1.0, steps, device=device) eps_vecs = [torch.randint(0, 2, y.shape, device=device).float() * 2 - 1 for _ in range(n_hutch)] for i in range(len(s_grid) - 1): s0 = s_grid[i]; s1 = s_grid[i + 1] ds = (s1 - s0) sf = torch.full((B,), float(s0), device=device) f = self._pf_drift(x, sf, c) # divergence via Hutchinson with torch.enable_grad(): xg = x.detach().requires_grad_(True) ff = self._pf_drift(xg, sf, c) div = torch.zeros(B, device=device) for ev in eps_vecs: g = torch.autograd.grad(ff, xg, grad_outputs=ev, create_graph=False, retain_graph=True)[0] div += (g * ev).sum(-1) div /= len(eps_vecs) x = x + ds * f logdet = logdet + ds * div # log p_1(x) standard normal log_pT = (-0.5 * (x ** 2).sum(-1) - 0.5 * self.y_dim * math.log(2 * math.pi)) return log_pT + logdet + jac_norm
def _pf_drift(self, x, s_frac, c): """Probability-flow ODE drift in the variance-preserving 's in (0,1]' time where we map continuous s to nearest discrete t. dx/ds = f(x,s). Uses a VP-SDE form.""" t = (s_frac * self.T).round().long().clamp(1, self.T) abar = self.abar[t - 1].unsqueeze(-1) abar_prev = self.abar_prev[t - 1].unsqueeze(-1) # discrete beta_t approx beta = (1 - abar / abar_prev).clamp(1e-6, 0.999) eps = self.eps_pred(x, s_frac, c) score = -eps / (1 - abar).sqrt() # PF-ODE drift (VP): -0.5 beta x - 0.5 beta score, per unit discrete step; scale by T for s-time return self.T * (-0.5 * beta * x - 0.5 * beta * score)
class ImageEncoder(nn.Module): """z = E(image). Small CNN for 64x64x3 -> z. Input expected as [B,3,64,64] float in [0,1]."""
def __init__(self, z_dim, ch=32, hidden_dim=256): super().__init__() self.conv = nn.Sequential( nn.Conv2d(3, ch, 4, 2, 1), nn.ReLU(), # 64 -> 32 nn.Conv2d(ch, ch * 2, 4, 2, 1), nn.ReLU(), # 32 -> 16 nn.Conv2d(ch * 2, ch * 2, 4, 2, 1), nn.ReLU(), # 16 -> 8 nn.Conv2d(ch * 2, ch * 2, 4, 2, 1), nn.ReLU(), # 8 -> 4 ) self.head = nn.Sequential(nn.Linear(ch * 2 * 4 * 4, hidden_dim), nn.ReLU(), nn.Linear(hidden_dim, z_dim))
def forward(self, x): h = self.conv(x).flatten(1) return self.head(h)
class ImageDecoder(nn.Module): """image_hat = D(z). Mirror of ImageEncoder, for the reward-agnostic autoencoder baseline."""
def __init__(self, z_dim, ch=32, hidden_dim=256): super().__init__() self.ch = ch self.fc = nn.Sequential(nn.Linear(z_dim, hidden_dim), nn.ReLU(), nn.Linear(hidden_dim, ch * 2 * 4 * 4), nn.ReLU()) self.deconv = nn.Sequential( nn.ConvTranspose2d(ch * 2, ch * 2, 4, 2, 1), nn.ReLU(), # 4 -> 8 nn.ConvTranspose2d(ch * 2, ch * 2, 4, 2, 1), nn.ReLU(), # 8 -> 16 nn.ConvTranspose2d(ch * 2, ch, 4, 2, 1), nn.ReLU(), # 16 -> 32 nn.ConvTranspose2d(ch, 3, 4, 2, 1), nn.Sigmoid(), # 32 -> 64 )
def forward(self, z): h = self.fc(z).view(-1, self.ch * 2, 4, 4) return self.deconv(h)
class Encoder(nn.Module): """z = E(s). Reward-aware or reward-agnostic latent encoder."""
def __init__(self, s_dim, z_dim, hidden_dim=256, num_layers=3): super().__init__() self.net = mlp(s_dim, z_dim, hidden_dim, num_layers)
def forward(self, s): return self.net(s)
class RewardDecoder(nn.Module): """r_hat = R(z)."""
def __init__(self, z_dim, hidden_dim=256, num_layers=2): super().__init__() self.net = mlp(z_dim, 1, hidden_dim, num_layers)
def forward(self, z): return self.net(z).squeeze(-1)
class StateDecoder(nn.Module): """s_hat = D(z), for reward-agnostic autoencoder baseline."""
def __init__(self, z_dim, s_dim, hidden_dim=256, num_layers=3): super().__init__() self.net = mlp(z_dim, s_dim, hidden_dim, num_layers)
def forward(self, z): return self.net(z)
class ConditionalFlowMatching(nn.Module): """Conditional Flow Matching for p(y | c). Learns a velocity field v_theta(y_t, t, c) that transports N(0,I) to the target distribution via linear interpolation paths.
Same external interface as ConditionalDiffusion: .sample(c, n) -> [B,n,D]. """
def __init__(self, cond_dim, y_dim, hidden_dim=256, num_layers=4, time_dim=64, sample_steps=30): super().__init__() self.y_dim = y_dim self.cond_dim = cond_dim self.sample_steps = sample_steps self.time_emb = nn.Sequential(SinusoidalEmbedding(time_dim), nn.Linear(time_dim, time_dim), nn.SiLU(), nn.Linear(time_dim, time_dim)) self.cond_emb = nn.Sequential(nn.Linear(cond_dim, hidden_dim), nn.SiLU()) self.y_emb = nn.Linear(y_dim, hidden_dim) layers = [] d = hidden_dim + hidden_dim + time_dim for _ in range(num_layers): layers += [nn.Linear(d, hidden_dim), nn.SiLU()] d = hidden_dim self.trunk = nn.Sequential(*layers) self.out = nn.Linear(hidden_dim, y_dim) # normalization buffers self.register_buffer("cond_mean", torch.zeros(cond_dim)) self.register_buffer("cond_std", torch.ones(cond_dim)) self.register_buffer("y_mean", torch.zeros(y_dim)) self.register_buffer("y_std", torch.ones(y_dim))
def set_normalization(self, cond_mean, cond_std, y_mean, y_std): self.cond_mean.copy_(torch.as_tensor(cond_mean, dtype=torch.float32)) self.cond_std.copy_(torch.as_tensor(cond_std, dtype=torch.float32)) self.y_mean.copy_(torch.as_tensor(y_mean, dtype=torch.float32)) self.y_std.copy_(torch.as_tensor(y_std, dtype=torch.float32))
def _nc(self, c): return (c - self.cond_mean) / self.cond_std def _ny(self, y): return (y - self.y_mean) / self.y_std def _uny(self, yn): return yn * self.y_std + self.y_mean
def velocity(self, yt, t_frac, c): """v_theta(y_t, t, c). y_t: [B,D] normalized; t_frac: [B] in [0,1]; c: [B,cond] normalized.""" te = self.time_emb(t_frac) h = torch.cat([self.y_emb(yt), self.cond_emb(c), te], dim=-1) return self.out(self.trunk(h))
def training_loss(self, c, y1): """CFM loss given pre-sampled target y1 (raw coords). Samples z0, t, forms path.""" c = self._nc(c); y1n = self._ny(y1) z0 = torch.randn_like(y1n) t = torch.rand(y1n.shape[0], device=y1n.device) yt = (1 - t.unsqueeze(-1)) * z0 + t.unsqueeze(-1) * y1n # linear path u_t = y1n - z0 # constant velocity v = self.velocity(yt, t, c) return F.mse_loss(v, u_t)
def training_loss_td(self, c, y1): """Alias for training_loss — y1 may come from the TD mixture (external).""" return self.training_loss(c, y1)
@torch.no_grad() def eval_loss(self, c, y1): c = self._nc(c); y1n = self._ny(y1) z0 = torch.zeros_like(y1n) # deterministic for eval t = torch.full((y1n.shape[0],), 0.5, device=y1n.device) yt = 0.5 * z0 + 0.5 * y1n u_t = y1n - z0 return F.mse_loss(self.velocity(yt, t, c), u_t).item()
@torch.no_grad() def sample(self, c, n_samples=1, steps=None): """Euler ODE integration from z0~N(0,I). Returns [B, n_samples, D] raw coords.""" steps = steps or self.sample_steps c = self._nc(c); B = c.shape[0] cc = c.unsqueeze(1).expand(-1, n_samples, -1).reshape(B * n_samples, -1) z = torch.randn(B * n_samples, self.y_dim, device=c.device) dt = 1.0 / steps for i in range(steps): t_frac = torch.full((B * n_samples,), i * dt, device=c.device) v = self.velocity(z, t_frac, cc) z = z + dt * v return self._uny(z).view(B, n_samples, self.y_dim)
class OneStepModel(nn.Module): """p(s_{t+1} | s_t, a_t) as a small conditional GMM over the *delta* s_{t+1}-s_t."""
def __init__(self, s_dim, a_dim, num_components=4, hidden_dim=256, num_layers=3): super().__init__() self.gmm = ConditionalGMM(s_dim + a_dim, s_dim, num_components, hidden_dim, num_layers) self.s_dim = s_dim
def log_prob(self, s, a, s_next): c = torch.cat([s, a], dim=-1) return self.gmm.log_prob(c, s_next - s)
@torch.no_grad() def step(self, s, a): c = torch.cat([s, a], dim=-1) delta = self.gmm.sample(c, 1).squeeze(1) return s + delta.gitattributes+174
gen_q_rsm/preliminary_analysis/experiments/visual_pointmaze_medium_navigate_v0/figures/mse.pngAdded

gen_q_rsm/preliminary_analysis/experiments/visual_pointmaze_medium_navigate_v0/results/0/genq.jsonAdded+122
gen_q_rsm/preliminary_analysis/experiments/visual_pointmaze_medium_navigate_v0/results/0/mc.jsonAdded+124
gen_q_rsm/preliminary_analysis/experiments/visual_pointmaze_medium_navigate_v0/results/0/td.jsonAdded+124
gen_q_rsm/preliminary_analysis/experiments/visual_pointmaze_medium_navigate_v0/results/1/genq.jsonAdded+122
gen_q_rsm/preliminary_analysis/experiments/visual_pointmaze_medium_navigate_v0/results/1/mc.jsonAdded+124
gen_q_rsm/preliminary_analysis/experiments/visual_pointmaze_medium_navigate_v0/results/1/td.jsonAdded+124
gen_q_rsm/preliminary_analysis/experiments/visual_pointmaze_medium_navigate_v0/results/2/genq.jsonAdded+122
gen_q_rsm/preliminary_analysis/experiments/visual_pointmaze_medium_navigate_v0/results/2/mc.jsonAdded+124
gen_q_rsm/preliminary_analysis/experiments/visual_pointmaze_medium_navigate_v0/results/2/td.jsonAdded+124
gen_q_rsm/preliminary_analysis/experiments/visual_pointmaze_medium_navigate_v0/results/3/genq.jsonAdded+122
gen_q_rsm/preliminary_analysis/experiments/visual_pointmaze_medium_navigate_v0/results/3/mc.jsonAdded+124
gen_q_rsm/preliminary_analysis/experiments/visual_pointmaze_medium_navigate_v0/results/3/td.jsonAdded+124
gen_q_rsm/preliminary_analysis/experiments/visual_pointmaze_medium_navigate_v0/results/4/genq.jsonAdded+122
gen_q_rsm/preliminary_analysis/experiments/visual_pointmaze_medium_navigate_v0/results/4/mc.jsonAdded+124
gen_q_rsm/preliminary_analysis/experiments/visual_pointmaze_medium_navigate_v0/results/4/td.jsonAdded+124
gen_q_rsm/preliminary_analysis/experiments/visual_pointmaze_medium_navigate_v0/run_genq.pyAdded+87
gen_q_rsm/preliminary_analysis/experiments/visual_pointmaze_medium_navigate_v0/run_seq.shAdded+68
gen_q_rsm/preliminary_analysis/experiments/visual_puzzle_3x3_play_v0/NOTES.mdAdded+52
gen_q_rsm/preliminary_analysis/experiments/visual_puzzle_3x3_play_v0/figures/.gitkeepAdded
gen_q_rsm/preliminary_analysis/experiments/visual_puzzle_3x3_play_v0/figures/corr.pngAdded

gen_q_rsm/preliminary_analysis/experiments/visual_puzzle_3x3_play_v0/figures/mse.pngAdded

gen_q_rsm/preliminary_analysis/experiments/visual_puzzle_3x3_play_v0/results/.gitkeepAdded
gen_q_rsm/preliminary_analysis/experiments/visual_puzzle_3x3_play_v0/results/0/genq.jsonAdded+121
gen_q_rsm/preliminary_analysis/experiments/visual_puzzle_3x3_play_v0/results/0/mc.jsonAdded+123
gen_q_rsm/preliminary_analysis/experiments/visual_puzzle_3x3_play_v0/results/0/td.jsonAdded+123
gen_q_rsm/preliminary_analysis/experiments/visual_puzzle_3x3_play_v0/results/1/genq.jsonAdded+121
gen_q_rsm/preliminary_analysis/experiments/visual_puzzle_3x3_play_v0/results/1/mc.jsonAdded+123
gen_q_rsm/preliminary_analysis/experiments/visual_puzzle_3x3_play_v0/results/1/td.jsonAdded+123
gen_q_rsm/preliminary_analysis/experiments/visual_puzzle_3x3_play_v0/results/2/genq.jsonAdded+121
gen_q_rsm/preliminary_analysis/experiments/visual_puzzle_3x3_play_v0/results/2/mc.jsonAdded+123
gen_q_rsm/preliminary_analysis/experiments/visual_puzzle_3x3_play_v0/results/2/td.jsonAdded+123
gen_q_rsm/preliminary_analysis/experiments/visual_puzzle_3x3_play_v0/results/3/genq.jsonAdded+121
gen_q_rsm/preliminary_analysis/experiments/visual_puzzle_3x3_play_v0/results/3/mc.jsonAdded+123
gen_q_rsm/preliminary_analysis/experiments/visual_puzzle_3x3_play_v0/results/3/td.jsonAdded+123
gen_q_rsm/preliminary_analysis/experiments/visual_puzzle_3x3_play_v0/results/4/genq.jsonAdded+121
gen_q_rsm/preliminary_analysis/experiments/visual_puzzle_3x3_play_v0/results/4/mc.jsonAdded+123
gen_q_rsm/preliminary_analysis/experiments/visual_puzzle_3x3_play_v0/results/4/td.jsonAdded+123
gen_q_rsm/preliminary_analysis/experiments/visual_puzzle_3x3_play_v0/run_seed.pyAdded+76
gen_q_rsm/preliminary_analysis/experiments/visual_puzzle_3x3_play_v0/run_seq.shAdded+66
gen_q_rsm/preliminary_analysis/gc_core.pyAdded+1612
gen_q_rsm/preliminary_analysis/genq.pyAdded+115
gen_q_rsm/preliminary_analysis/genq_reward_latent.pyAdded+202
gen_q_rsm/preliminary_analysis/genq_visual.pyAdded+450
gen_q_rsm/preliminary_analysis/genq_visual_cube.pyAdded+409
gen_q_rsm/preliminary_analysis/genq_visual_puzzle.pyAdded+439
gen_q_rsm/preliminary_analysis/illustration.pyAdded+112
gen_q_rsm/preliminary_analysis/mc.pyAdded+150
gen_q_rsm/preliminary_analysis/models.pyAdded+487