Add 70k versus 90k run code and logs
Browse filesFiles changed (16)
- experiments/multi_source_90k_comparison/logs/multi_source_90k_retrieval.logAdded+944
- experiments/multi_source_90k_comparison/logs/multi_source_90k_train.logAdded
- experiments/multi_source_90k_comparison/repro/analyze_multi_source_retrieval_phases.pyAdded+200
- experiments/multi_source_90k_comparison/repro/analyze_plus_coffee_d0_source.pyAdded+95
- experiments/multi_source_90k_comparison/repro/artifact_sha256.txtAdded+6
- experiments/multi_source_90k_comparison/repro/compare_multi_source_70k_90k.pyAdded+125
- experiments/multi_source_90k_comparison/repro/extract_coffee_d0_source_embeddings.pyAdded+77
- experiments/multi_source_90k_comparison/repro/extract_multi_source_embeddings.pyAdded+117
- experiments/multi_source_90k_comparison/repro/extract_multi_source_target_embeddings.pyAdded+52
- experiments/multi_source_90k_comparison/repro/multi_source_90k_continuation.mdAdded+33
- experiments/multi_source_90k_comparison/repro/plot_multi_source_retrieval_summary.pyAdded+104
- experiments/multi_source_90k_comparison/repro/plot_plus_coffee_d0_source.pyAdded+99
- experiments/multi_source_90k_comparison/repro/resume_multi_source_encoder_to_90k.shAdded+37
- experiments/multi_source_90k_comparison/repro/run_multi_source_90k_retrieval_when_ready.shAdded+57
- experiments/multi_source_90k_comparison/repro/score_multi_source_retrieval.pyAdded+290
- experiments/multi_source_90k_comparison/repro/upload_multi_source_90k_when_ready.shAdded+81
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439442026-10-30 08:54:38.543245: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:485] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered2026-10-30 08:54:38.560697: E external/local_xla/xla/stream_executor/cuda/cuda_dnn.cc:8454] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered2026-10-30 08:54:38.565910: E external/local_xla/xla/stream_executor/cuda/cuda_blas.cc:1452] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered2026-10-30 08:54:39.573237: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRTWARNING: All log messages before absl::InitializeLog() is called are written to STDERRI0000 00:00:1793350520.408533 18472 cuda_executor.cc:1015] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero. See more at https://github.com/torvalds/linux/blob/v6.0/Documentation/ABI/testing/sysfs-bus-pci#L344-L3552026-10-30 08:55:20.414708: W tensorflow/core/common_runtime/gpu/gpu_device.cc:2343] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform.Skipping registering GPU devices...Initializing tc
####################################################################################### Loading the following 1 datasets (incl. sampling weight): ## dataset: =================================================================1.000000 #######################################################################################
coffee_preparation_d0 67762
####################################################################################### Loading the following 1 datasets (incl. sampling weight): ## dataset: =================================================================1.000000 #######################################################################################
pick_place_d0 66711
####################################################################################### Loading the following 1 datasets (incl. sampling weight): ## dataset: =================================================================1.000000 #######################################################################################
kitchen_d0 60857MULTI_SOURCE_EMBEDDINGS_OK2026-10-30 08:58:41.083924: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:485] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered2026-10-30 08:58:41.101356: E external/local_xla/xla/stream_executor/cuda/cuda_dnn.cc:8454] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered2026-10-30 08:58:41.106611: E external/local_xla/xla/stream_executor/cuda/cuda_blas.cc:1452] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered2026-10-30 08:58:42.146544: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRTWARNING: All log messages before absl::InitializeLog() is called are written to STDERRI0000 00:00:1793350763.106873 19625 cuda_executor.cc:1015] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero. See more at https://github.com/torvalds/linux/blob/v6.0/Documentation/ABI/testing/sysfs-bus-pci#L344-L3552026-10-30 08:59:23.113300: W tensorflow/core/common_runtime/gpu/gpu_device.cc:2343] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform.Skipping registering GPU devices...Initializing tc
####################################################################################### Loading the following 1 datasets (incl. sampling weight): ## dataset: =================================================================1.000000 #######################################################################################
mug_cleanup_o1 8325
####################################################################################### Loading the following 1 datasets (incl. sampling weight): ## dataset: =================================================================1.000000 #######################################################################################
hammer_cleanup_d0 6841MULTI_SOURCE_TARGET_EMBEDDINGS_OKSOURCE_KDE 0 195330SOURCE_KDE 6400 195330SOURCE_KDE 12800 195330SOURCE_KDE 19200 195330SOURCE_KDE 25600 195330SOURCE_KDE 32000 195330SOURCE_KDE 38400 195330SOURCE_KDE 44800 195330SOURCE_KDE 51200 195330SOURCE_KDE 57600 195330SOURCE_KDE 64000 195330SOURCE_KDE 70400 195330SOURCE_KDE 76800 195330SOURCE_KDE 83200 195330SOURCE_KDE 89600 195330SOURCE_KDE 96000 195330SOURCE_KDE 102400 195330SOURCE_KDE 108800 195330SOURCE_KDE 115200 195330SOURCE_KDE 121600 195330SOURCE_KDE 128000 195330SOURCE_KDE 134400 195330SOURCE_KDE 140800 195330SOURCE_KDE 147200 195330SOURCE_KDE 153600 195330SOURCE_KDE 160000 195330SOURCE_KDE 166400 195330SOURCE_KDE 172800 195330SOURCE_KDE 179200 195330SOURCE_KDE 185600 195330SOURCE_KDE 192000 195330SCORING_BR mug_cleanup_o1BR 0 195330BR 25600 195330BR 51200 195330BR 76800 195330BR 102400 195330BR 128000 195330BR 153600 195330BR 179200 195330SCORING_IWR mug_cleanup_o1TARGET_KDE_mug_cleanup_o1 0 195330TARGET_KDE_mug_cleanup_o1 6400 195330TARGET_KDE_mug_cleanup_o1 12800 195330TARGET_KDE_mug_cleanup_o1 19200 195330TARGET_KDE_mug_cleanup_o1 25600 195330TARGET_KDE_mug_cleanup_o1 32000 195330TARGET_KDE_mug_cleanup_o1 38400 195330TARGET_KDE_mug_cleanup_o1 44800 195330TARGET_KDE_mug_cleanup_o1 51200 195330TARGET_KDE_mug_cleanup_o1 57600 195330TARGET_KDE_mug_cleanup_o1 64000 195330TARGET_KDE_mug_cleanup_o1 70400 195330TARGET_KDE_mug_cleanup_o1 76800 195330TARGET_KDE_mug_cleanup_o1 83200 195330TARGET_KDE_mug_cleanup_o1 89600 195330TARGET_KDE_mug_cleanup_o1 96000 195330TARGET_KDE_mug_cleanup_o1 102400 195330TARGET_KDE_mug_cleanup_o1 108800 195330TARGET_KDE_mug_cleanup_o1 115200 195330TARGET_KDE_mug_cleanup_o1 121600 195330TARGET_KDE_mug_cleanup_o1 128000 195330TARGET_KDE_mug_cleanup_o1 134400 195330TARGET_KDE_mug_cleanup_o1 140800 195330TARGET_KDE_mug_cleanup_o1 147200 195330TARGET_KDE_mug_cleanup_o1 153600 195330TARGET_KDE_mug_cleanup_o1 160000 195330TARGET_KDE_mug_cleanup_o1 166400 195330TARGET_KDE_mug_cleanup_o1 172800 195330TARGET_KDE_mug_cleanup_o1 179200 195330TARGET_KDE_mug_cleanup_o1 185600 195330TARGET_KDE_mug_cleanup_o1 192000 195330TARGET_SELECTIONS_DONE mug_cleanup_o1 855SCORING_BR hammer_cleanup_d0BR 0 195330BR 25600 195330BR 51200 195330BR 76800 195330BR 102400 195330BR 128000 195330BR 153600 195330BR 179200 195330SCORING_IWR hammer_cleanup_d0TARGET_KDE_hammer_cleanup_d0 0 195330TARGET_KDE_hammer_cleanup_d0 6400 195330TARGET_KDE_hammer_cleanup_d0 12800 195330TARGET_KDE_hammer_cleanup_d0 19200 195330TARGET_KDE_hammer_cleanup_d0 25600 195330TARGET_KDE_hammer_cleanup_d0 32000 195330TARGET_KDE_hammer_cleanup_d0 38400 195330TARGET_KDE_hammer_cleanup_d0 44800 195330TARGET_KDE_hammer_cleanup_d0 51200 195330TARGET_KDE_hammer_cleanup_d0 57600 195330TARGET_KDE_hammer_cleanup_d0 64000 195330TARGET_KDE_hammer_cleanup_d0 70400 195330TARGET_KDE_hammer_cleanup_d0 76800 195330TARGET_KDE_hammer_cleanup_d0 83200 195330TARGET_KDE_hammer_cleanup_d0 89600 195330TARGET_KDE_hammer_cleanup_d0 96000 195330TARGET_KDE_hammer_cleanup_d0 102400 195330TARGET_KDE_hammer_cleanup_d0 108800 195330TARGET_KDE_hammer_cleanup_d0 115200 195330TARGET_KDE_hammer_cleanup_d0 121600 195330TARGET_KDE_hammer_cleanup_d0 128000 195330TARGET_KDE_hammer_cleanup_d0 134400 195330TARGET_KDE_hammer_cleanup_d0 140800 195330TARGET_KDE_hammer_cleanup_d0 147200 195330TARGET_KDE_hammer_cleanup_d0 153600 195330TARGET_KDE_hammer_cleanup_d0 160000 195330TARGET_KDE_hammer_cleanup_d0 166400 195330TARGET_KDE_hammer_cleanup_d0 172800 195330TARGET_KDE_hammer_cleanup_d0 179200 195330TARGET_KDE_hammer_cleanup_d0 185600 195330TARGET_KDE_hammer_cleanup_d0 192000 195330TARGET_SELECTIONS_DONE hammer_cleanup_d0 707MULTI_SOURCE_RETRIEVAL_OK{ "source_candidate_count": { "coffee_preparation_d0": 67762, "kitchen_d0": 60857, "pick_place_d0": 66711 }, "source_gripper_cycle_count": { "coffee_preparation_d0": { "2": 100 }, "kitchen_d0": { "3": 100 }, "pick_place_d0": { "4": 68, "5": 32 } }, "targets": { "hammer_cleanup_d0": { "br_iwr_nonoverlap_shared_unique_timesteps": 769, "br_iwr_overlap_shared_unique_timesteps": 105, "br_nonoverlap": { "br_nearest_query_phase_counts": { "close_drawer_rough": 236, "object_approach": 183, "object_carry_place": 179, "open_drawer_rough": 109 }, "clip_count": 707, "source_closed_command_share": { "coffee_preparation_d0": 0.25, "kitchen_d0": 0.25768667642752563, "pick_place_d0": 0.0 }, "source_episode_counts": { "coffee_preparation_d0": 15, "kitchen_d0": 100, "pick_place_d0": 8 }, "source_phase_counts": { "coffee_preparation_d0": { "drawer_open_rough": 2, "lid_close_rough": 4, "mug_approach": 1, "pod_approach_rough": 5, "pod_carry_insert": 4 }, "kitchen_d0": { "bread_approach_rough": 156, "bread_to_pot": 100, "pot_approach_rough": 61, "pot_approach_second": 109, "pot_to_serving_area": 12, "pot_to_stove": 64, "push_serve_rough": 18, "stove_off_rough": 14, "stove_on_rough": 149 }, "pick_place_d0": { "approach_cycle_3": 3, "approach_cycle_4": 2, "approach_cycle_5": 3 } }, "source_task_counts": { "coffee_preparation_d0": 16, "kitchen_d0": 683, "pick_place_d0": 8 }, "unique_source_timesteps": 7070 }, "br_overlap": { "br_nearest_query_phase_counts": { "close_drawer_rough": 217, "object_approach": 256, "object_carry_place": 178, "open_drawer_rough": 56 }, "clip_count": 707, "source_closed_command_share": { "coffee_preparation_d0": 0.0, "kitchen_d0": 0.2556818181818182, "pick_place_d0": null }, "source_episode_counts": { "coffee_preparation_d0": 3, "kitchen_d0": 99, "pick_place_d0": 0 }, "source_phase_counts": { "coffee_preparation_d0": { "lid_close_rough": 2, "pod_approach_rough": 1 }, "kitchen_d0": { "bread_approach_rough": 252, "bread_to_pot": 117, "pot_approach_rough": 38, "pot_approach_second": 126, "pot_to_serving_area": 4, "pot_to_stove": 59, "push_serve_rough": 8, "stove_off_rough": 5, "stove_on_rough": 95 }, "pick_place_d0": {} }, "source_task_counts": { "coffee_preparation_d0": 3, "kitchen_d0": 704 }, "unique_source_timesteps": 3817 }, "iwr_nonoverlap": { "br_nearest_query_phase_counts": null, "clip_count": 707, "source_closed_command_share": { "coffee_preparation_d0": 0.0, "kitchen_d0": 0.18907563025210083, "pick_place_d0": 0.25 }, "source_episode_counts": { "coffee_preparation_d0": 98, "kitchen_d0": 100, "pick_place_d0": 25 }, "source_phase_counts": { "coffee_preparation_d0": { "drawer_open_rough": 92, "lid_close_rough": 8, "lid_open_rough": 38, "mug_approach": 47, "pod_approach_rough": 14 }, "kitchen_d0": { "bread_approach_rough": 31, "bread_to_pot": 75, "pot_approach_rough": 56, "pot_approach_second": 12, "pot_to_serving_area": 4, "pot_to_stove": 11, "push_serve_rough": 6, "stove_off_rough": 18, "stove_on_rough": 263 }, "pick_place_d0": { "after_last_release": 5, "approach_cycle_1": 1, "approach_cycle_2": 2, "approach_cycle_3": 7, "approach_cycle_4": 8, "approach_cycle_5": 1, "carry_place_cycle_1": 3, "carry_place_cycle_2": 1, "carry_place_cycle_3": 4 } }, "source_task_counts": { "coffee_preparation_d0": 199, "kitchen_d0": 476, "pick_place_d0": 32 }, "unique_source_timesteps": 7070 }, "iwr_overlap": { "br_nearest_query_phase_counts": null, "clip_count": 707, "source_closed_command_share": { "coffee_preparation_d0": 0.0, "kitchen_d0": 0.052123552123552123, "pick_place_d0": 0.34615384615384615 }, "source_episode_counts": { "coffee_preparation_d0": 64, "kitchen_d0": 86, "pick_place_d0": 8 }, "source_phase_counts": { "coffee_preparation_d0": { "drawer_open_rough": 52, "lid_close_rough": 2, "lid_open_rough": 6, "mug_approach": 90, "pod_approach_rough": 13 }, "kitchen_d0": { "bread_approach_rough": 1, "bread_to_pot": 26, "pot_approach_rough": 43, "pot_to_serving_area": 1, "stove_off_rough": 7, "stove_on_rough": 440 }, "pick_place_d0": { "after_last_release": 2, "approach_cycle_3": 5, "approach_cycle_4": 10, "carry_place_cycle_1": 5, "carry_place_cycle_3": 4 } }, "source_task_counts": { "coffee_preparation_d0": 163, "kitchen_d0": 518, "pick_place_d0": 26 }, "unique_source_timesteps": 3085 } }, "mug_cleanup_o1": { "br_iwr_nonoverlap_shared_unique_timesteps": 68, "br_iwr_overlap_shared_unique_timesteps": 0, "br_nonoverlap": { "br_nearest_query_phase_counts": { "close_drawer_rough": 332, "object_approach": 126, "object_carry_place": 193, "open_drawer_rough": 204 }, "clip_count": 855, "source_closed_command_share": { "coffee_preparation_d0": 0.25390625, "kitchen_d0": 0.20772058823529413, "pick_place_d0": 0.23636363636363636 }, "source_episode_counts": { "coffee_preparation_d0": 94, "kitchen_d0": 100, "pick_place_d0": 40 }, "source_phase_counts": { "coffee_preparation_d0": { "drawer_open_rough": 6, "lid_close_rough": 13, "mug_approach": 10, "mug_carry_place": 7, "pod_approach_rough": 162, "pod_carry_insert": 58 }, "kitchen_d0": { "bread_approach_rough": 73, "bread_to_pot": 31, "pot_approach_rough": 80, "pot_approach_second": 56, "pot_to_serving_area": 52, "pot_to_stove": 30, "push_serve_rough": 43, "stove_off_rough": 19, "stove_on_rough": 160 }, "pick_place_d0": { "after_last_release": 2, "approach_cycle_1": 3, "approach_cycle_2": 6, "approach_cycle_3": 13, "approach_cycle_4": 15, "approach_cycle_5": 3, "carry_place_cycle_1": 2, "carry_place_cycle_3": 6, "carry_place_cycle_4": 5 } }, "source_task_counts": { "coffee_preparation_d0": 256, "kitchen_d0": 544, "pick_place_d0": 55 }, "unique_source_timesteps": 8550 }, "br_overlap": { "br_nearest_query_phase_counts": { "close_drawer_rough": 372, "object_approach": 95, "object_carry_place": 189, "open_drawer_rough": 199 }, "clip_count": 855, "source_closed_command_share": { "coffee_preparation_d0": 0.2796352583586626, "kitchen_d0": 0.17586912065439672, "pick_place_d0": 0.10810810810810811 }, "source_episode_counts": { "coffee_preparation_d0": 81, "kitchen_d0": 92, "pick_place_d0": 26 }, "source_phase_counts": { "coffee_preparation_d0": { "lid_close_rough": 10, "mug_approach": 4, "mug_carry_place": 3, "pod_approach_rough": 223, "pod_carry_insert": 89 }, "kitchen_d0": { "bread_approach_rough": 57, "bread_to_pot": 25, "pot_approach_rough": 68, "pot_approach_second": 46, "pot_to_serving_area": 35, "pot_to_stove": 26, "push_serve_rough": 34, "stove_off_rough": 21, "stove_on_rough": 177 }, "pick_place_d0": { "after_last_release": 3, "approach_cycle_1": 2, "approach_cycle_2": 2, "approach_cycle_3": 15, "approach_cycle_4": 8, "approach_cycle_5": 3, "carry_place_cycle_3": 3, "carry_place_cycle_4": 1 } }, "source_task_counts": { "coffee_preparation_d0": 329, "kitchen_d0": 489, "pick_place_d0": 37 }, "unique_source_timesteps": 5100 }, "iwr_nonoverlap": { "br_nearest_query_phase_counts": null, "clip_count": 855, "source_closed_command_share": { "coffee_preparation_d0": 0.17120622568093385, "kitchen_d0": 0.12149532710280374, "pick_place_d0": 0.7230142566191446 }, "source_episode_counts": { "coffee_preparation_d0": 93, "kitchen_d0": 64, "pick_place_d0": 100 }, "source_phase_counts": { "coffee_preparation_d0": { "drawer_open_rough": 2, "lid_close_rough": 4, "lid_open_rough": 38, "mug_approach": 79, "mug_carry_place": 38, "pod_approach_rough": 90, "pod_carry_insert": 6 }, "kitchen_d0": { "bread_approach_rough": 1, "bread_to_pot": 6, "pot_approach_rough": 17, "pot_approach_second": 1, "pot_to_stove": 7, "push_serve_rough": 13, "stove_off_rough": 2, "stove_on_rough": 60 }, "pick_place_d0": { "after_last_release": 5, "approach_cycle_1": 8, "approach_cycle_2": 29, "approach_cycle_3": 43, "approach_cycle_4": 42, "approach_cycle_5": 9, "carry_place_cycle_1": 90, "carry_place_cycle_2": 53, "carry_place_cycle_3": 115, "carry_place_cycle_4": 71, "carry_place_cycle_5": 26 } }, "source_task_counts": { "coffee_preparation_d0": 257, "kitchen_d0": 107, "pick_place_d0": 491 }, "unique_source_timesteps": 8550 }, "iwr_overlap": { "br_nearest_query_phase_counts": null, "clip_count": 855, "source_closed_command_share": { "coffee_preparation_d0": 0.1, "kitchen_d0": null, "pick_place_d0": 0.9076923076923077 }, "source_episode_counts": { "coffee_preparation_d0": 6, "kitchen_d0": 0, "pick_place_d0": 67 }, "source_phase_counts": { "coffee_preparation_d0": { "mug_approach": 9, "mug_carry_place": 1 }, "kitchen_d0": {}, "pick_place_d0": { "approach_cycle_2": 12, "approach_cycle_3": 52, "approach_cycle_4": 11, "approach_cycle_5": 3, "carry_place_cycle_1": 303, "carry_place_cycle_2": 64, "carry_place_cycle_3": 274, "carry_place_cycle_4": 108, "carry_place_cycle_5": 18 } }, "source_task_counts": { "coffee_preparation_d0": 10, "pick_place_d0": 845 }, "unique_source_timesteps": 2186 } } }}MULTI_SOURCE_PHASE_ANALYSIS_OKMULTI_SOURCE_SUMMARY_PLOTS_OK2026-10-30 09:00:28.054097: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:485] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered2026-10-30 09:00:28.071742: E external/local_xla/xla/stream_executor/cuda/cuda_dnn.cc:8454] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered2026-10-30 09:00:28.077084: E external/local_xla/xla/stream_executor/cuda/cuda_blas.cc:1452] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered2026-10-30 09:00:29.044628: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRTWARNING: All log messages before absl::InitializeLog() is called are written to STDERRI0000 00:00:1793350870.088513 20795 cuda_executor.cc:1015] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero. See more at https://github.com/torvalds/linux/blob/v6.0/Documentation/ABI/testing/sysfs-bus-pci#L344-L3552026-10-30 09:01:10.094633: W tensorflow/core/common_runtime/gpu/gpu_device.cc:2343] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform.Skipping registering GPU devices...Initializing tc
####################################################################################### Loading the following 1 datasets (incl. sampling weight): ## dataset: =================================================================1.000000 #######################################################################################
{ "checkpoint": "/workspace/single_task_transfer/artifacts/encoders/multi_source_3task/multi-source-coffee-pick-kitchen-b128-90k-cont-from-70k-seed1", "checkpoint_step": 90000, "coffee_d0_manifest": "/workspace/single_task_transfer/data/manifests/multi_source_plus_coffee_d0/coffee_d0_source_episodes.json", "coffee_d0_windows": 21325, "encoder_retrained": false, "normalization": "frozen three-task source encoder statistics", "source_tasks": [ "coffee_preparation_d0", "pick_place_d0", "kitchen_d0", "coffee_d0" ], "target_embeddings_reused_from": "/workspace/single_task_transfer/artifacts/retrieval/multi_source_3task_90k/embeddings", "total_source_windows": 216655}COFFEE_D0_SOURCE_EMBEDDINGS_OKSOURCE_KDE 0 216655SOURCE_KDE 6400 216655SOURCE_KDE 12800 216655SOURCE_KDE 19200 216655SOURCE_KDE 25600 216655SOURCE_KDE 32000 216655SOURCE_KDE 38400 216655SOURCE_KDE 44800 216655SOURCE_KDE 51200 216655SOURCE_KDE 57600 216655SOURCE_KDE 64000 216655SOURCE_KDE 70400 216655SOURCE_KDE 76800 216655SOURCE_KDE 83200 216655SOURCE_KDE 89600 216655SOURCE_KDE 96000 216655SOURCE_KDE 102400 216655SOURCE_KDE 108800 216655SOURCE_KDE 115200 216655SOURCE_KDE 121600 216655SOURCE_KDE 128000 216655SOURCE_KDE 134400 216655SOURCE_KDE 140800 216655SOURCE_KDE 147200 216655SOURCE_KDE 153600 216655SOURCE_KDE 160000 216655SOURCE_KDE 166400 216655SOURCE_KDE 172800 216655SOURCE_KDE 179200 216655SOURCE_KDE 185600 216655SOURCE_KDE 192000 216655SOURCE_KDE 198400 216655SOURCE_KDE 204800 216655SOURCE_KDE 211200 216655SCORING_BR mug_cleanup_o1BR 0 216655BR 25600 216655BR 51200 216655BR 76800 216655BR 102400 216655BR 128000 216655BR 153600 216655BR 179200 216655BR 204800 216655SCORING_IWR mug_cleanup_o1TARGET_KDE_mug_cleanup_o1 0 216655TARGET_KDE_mug_cleanup_o1 6400 216655TARGET_KDE_mug_cleanup_o1 12800 216655TARGET_KDE_mug_cleanup_o1 19200 216655TARGET_KDE_mug_cleanup_o1 25600 216655TARGET_KDE_mug_cleanup_o1 32000 216655TARGET_KDE_mug_cleanup_o1 38400 216655TARGET_KDE_mug_cleanup_o1 44800 216655TARGET_KDE_mug_cleanup_o1 51200 216655TARGET_KDE_mug_cleanup_o1 57600 216655TARGET_KDE_mug_cleanup_o1 64000 216655TARGET_KDE_mug_cleanup_o1 70400 216655TARGET_KDE_mug_cleanup_o1 76800 216655TARGET_KDE_mug_cleanup_o1 83200 216655TARGET_KDE_mug_cleanup_o1 89600 216655TARGET_KDE_mug_cleanup_o1 96000 216655TARGET_KDE_mug_cleanup_o1 102400 216655TARGET_KDE_mug_cleanup_o1 108800 216655TARGET_KDE_mug_cleanup_o1 115200 216655TARGET_KDE_mug_cleanup_o1 121600 216655TARGET_KDE_mug_cleanup_o1 128000 216655TARGET_KDE_mug_cleanup_o1 134400 216655TARGET_KDE_mug_cleanup_o1 140800 216655TARGET_KDE_mug_cleanup_o1 147200 216655TARGET_KDE_mug_cleanup_o1 153600 216655TARGET_KDE_mug_cleanup_o1 160000 216655TARGET_KDE_mug_cleanup_o1 166400 216655TARGET_KDE_mug_cleanup_o1 172800 216655TARGET_KDE_mug_cleanup_o1 179200 216655TARGET_KDE_mug_cleanup_o1 185600 216655TARGET_KDE_mug_cleanup_o1 192000 216655TARGET_KDE_mug_cleanup_o1 198400 216655TARGET_KDE_mug_cleanup_o1 204800 216655TARGET_KDE_mug_cleanup_o1 211200 216655TARGET_SELECTIONS_DONE mug_cleanup_o1 855SCORING_BR hammer_cleanup_d0BR 0 216655BR 25600 216655BR 51200 216655BR 76800 216655BR 102400 216655BR 128000 216655BR 153600 216655BR 179200 216655BR 204800 216655SCORING_IWR hammer_cleanup_d0TARGET_KDE_hammer_cleanup_d0 0 216655TARGET_KDE_hammer_cleanup_d0 6400 216655TARGET_KDE_hammer_cleanup_d0 12800 216655TARGET_KDE_hammer_cleanup_d0 19200 216655TARGET_KDE_hammer_cleanup_d0 25600 216655TARGET_KDE_hammer_cleanup_d0 32000 216655TARGET_KDE_hammer_cleanup_d0 38400 216655TARGET_KDE_hammer_cleanup_d0 44800 216655TARGET_KDE_hammer_cleanup_d0 51200 216655TARGET_KDE_hammer_cleanup_d0 57600 216655TARGET_KDE_hammer_cleanup_d0 64000 216655TARGET_KDE_hammer_cleanup_d0 70400 216655TARGET_KDE_hammer_cleanup_d0 76800 216655TARGET_KDE_hammer_cleanup_d0 83200 216655TARGET_KDE_hammer_cleanup_d0 89600 216655TARGET_KDE_hammer_cleanup_d0 96000 216655TARGET_KDE_hammer_cleanup_d0 102400 216655TARGET_KDE_hammer_cleanup_d0 108800 216655TARGET_KDE_hammer_cleanup_d0 115200 216655TARGET_KDE_hammer_cleanup_d0 121600 216655TARGET_KDE_hammer_cleanup_d0 128000 216655TARGET_KDE_hammer_cleanup_d0 134400 216655TARGET_KDE_hammer_cleanup_d0 140800 216655TARGET_KDE_hammer_cleanup_d0 147200 216655TARGET_KDE_hammer_cleanup_d0 153600 216655TARGET_KDE_hammer_cleanup_d0 160000 216655TARGET_KDE_hammer_cleanup_d0 166400 216655TARGET_KDE_hammer_cleanup_d0 172800 216655TARGET_KDE_hammer_cleanup_d0 179200 216655TARGET_KDE_hammer_cleanup_d0 185600 216655TARGET_KDE_hammer_cleanup_d0 192000 216655TARGET_KDE_hammer_cleanup_d0 198400 216655TARGET_KDE_hammer_cleanup_d0 204800 216655TARGET_KDE_hammer_cleanup_d0 211200 216655TARGET_SELECTIONS_DONE hammer_cleanup_d0 707MULTI_SOURCE_RETRIEVAL_OK{ "coffee_d0_candidate_phase_counts": { "after_release": 5948, "before_grasp": 6664, "grasp_to_release": 8713 }, "coffee_d0_candidate_windows": 21325, "coffee_d0_episodes": 100, "coffee_d0_grasp_fraction_mean": 0.31752771234517596, "coffee_d0_release_fraction_mean": 0.7093969425474832, "encoder_retrained": false, "source_tasks": [ "coffee_preparation_d0", "pick_place_d0", "kitchen_d0", "coffee_d0" ], "targets": { "hammer_cleanup_d0": { "br_nonoverlap": { "coffee_d0_phase_counts": { "after_release": 8, "before_grasp": 5, "grasp_to_release": 27 }, "coffee_d0_selected_episodes": 34, "new_source_task_counts": { "coffee_d0": 40, "coffee_preparation_d0": 15, "kitchen_d0": 645, "pick_place_d0": 7 }, "new_unique_source_timesteps": 7070, "old_source_task_counts": { "coffee_preparation_d0": 16, "kitchen_d0": 683, "pick_place_d0": 8 }, "unchanged_selected_anchor_count": 667 }, "br_overlap": { "coffee_d0_phase_counts": { "after_release": 6, "before_grasp": 3, "grasp_to_release": 8 }, "coffee_d0_selected_episodes": 15, "new_source_task_counts": { "coffee_d0": 17, "coffee_preparation_d0": 3, "kitchen_d0": 687, "pick_place_d0": 0 }, "new_unique_source_timesteps": 3871, "old_source_task_counts": { "coffee_preparation_d0": 3, "kitchen_d0": 704, "pick_place_d0": 0 }, "unchanged_selected_anchor_count": 690 }, "iwr_nonoverlap": { "coffee_d0_phase_counts": { "after_release": 8, "before_grasp": 50, "grasp_to_release": 1 }, "coffee_d0_selected_episodes": 50, "new_source_task_counts": { "coffee_d0": 59, "coffee_preparation_d0": 215, "kitchen_d0": 400, "pick_place_d0": 33 }, "new_unique_source_timesteps": 7070, "old_source_task_counts": { "coffee_preparation_d0": 199, "kitchen_d0": 476, "pick_place_d0": 32 }, "unchanged_selected_anchor_count": 578 }, "iwr_overlap": { "coffee_d0_phase_counts": { "after_release": 4, "before_grasp": 66 }, "coffee_d0_selected_episodes": 29, "new_source_task_counts": { "coffee_d0": 70, "coffee_preparation_d0": 176, "kitchen_d0": 431, "pick_place_d0": 30 }, "new_unique_source_timesteps": 3033, "old_source_task_counts": { "coffee_preparation_d0": 163, "kitchen_d0": 518, "pick_place_d0": 26 }, "unchanged_selected_anchor_count": 601 } }, "mug_cleanup_o1": { "br_nonoverlap": { "coffee_d0_phase_counts": { "after_release": 34, "before_grasp": 168, "grasp_to_release": 75 }, "coffee_d0_selected_episodes": 97, "new_source_task_counts": { "coffee_d0": 277, "coffee_preparation_d0": 174, "kitchen_d0": 368, "pick_place_d0": 36 }, "new_unique_source_timesteps": 8550, "old_source_task_counts": { "coffee_preparation_d0": 256, "kitchen_d0": 544, "pick_place_d0": 55 }, "unchanged_selected_anchor_count": 578 }, "br_overlap": { "coffee_d0_phase_counts": { "after_release": 25, "before_grasp": 307, "grasp_to_release": 81 }, "coffee_d0_selected_episodes": 93, "new_source_task_counts": { "coffee_d0": 413, "coffee_preparation_d0": 201, "kitchen_d0": 231, "pick_place_d0": 10 }, "new_unique_source_timesteps": 4938, "old_source_task_counts": { "coffee_preparation_d0": 329, "kitchen_d0": 489, "pick_place_d0": 37 }, "unchanged_selected_anchor_count": 442 }, "iwr_nonoverlap": { "coffee_d0_phase_counts": { "after_release": 8, "before_grasp": 45, "grasp_to_release": 46 }, "coffee_d0_selected_episodes": 65, "new_source_task_counts": { "coffee_d0": 99, "coffee_preparation_d0": 204, "kitchen_d0": 66, "pick_place_d0": 486 }, "new_unique_source_timesteps": 8550, "old_source_task_counts": { "coffee_preparation_d0": 257, "kitchen_d0": 107, "pick_place_d0": 491 }, "unchanged_selected_anchor_count": 690 }, "iwr_overlap": { "coffee_d0_phase_counts": { "before_grasp": 1 }, "coffee_d0_selected_episodes": 1, "new_source_task_counts": { "coffee_d0": 1, "coffee_preparation_d0": 6, "kitchen_d0": 0, "pick_place_d0": 848 }, "new_unique_source_timesteps": 2171, "old_source_task_counts": { "coffee_preparation_d0": 10, "kitchen_d0": 0, "pick_place_d0": 845 }, "unchanged_selected_anchor_count": 820 } } }}PLUS_COFFEE_D0_SOURCE_ANALYSIS_OKPLUS_COFFEE_D0_SOURCE_PLOTS_OKMULTI_SOURCE_CHECKPOINT_COMPARISON_OKMULTI_SOURCE_90K_RETRIEVAL_COMPARISON_DONE123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200#!/usr/bin/env python3"""Audit selected source clips using gripper events and rough video phase notes."""
import argparseimport csvimport jsonfrom collections import Counter, defaultdictfrom pathlib import Path
import h5pyimport numpy as np
SOURCE = { "coffee_preparation_d0": ("core/coffee_preparation_d0.hdf5", "multi_source_3task/source_episodes.json"), "pick_place_d0": ("core/pick_place_d0.hdf5", "multi_source_3task/broad_pick_place_d0_episodes.json"), "kitchen_d0": ("core/kitchen_d0.hdf5", "multi_source_3task/multi_kitchen_d0_episodes.json"),}TARGET = { "mug_cleanup_o1": ("object/mug_cleanup_o1.hdf5", "multi_source_targets/target_episodes.json"), "hammer_cleanup_d0": ("core/hammer_cleanup_d0.hdf5", "multi_source_targets/multi_hammer_cleanup_d0_episodes.json"),}SOURCE_ORDER = tuple(SOURCE)METHODS = ("br_overlap", "br_nonoverlap", "iwr_overlap", "iwr_nonoverlap")
def load_episodes(root, specs): episodes = {} for task, (raw_name, manifest_name) in specs.items(): manifest = json.loads((root / "data/manifests" / manifest_name).read_text()) with h5py.File(root / "data/raw/mimicgen_corl_2023" / raw_name, "r") as handle: for row in manifest["episodes"]: episode = int(row["episode"].rsplit("_", 1)[-1]) action = handle["data"][row["episode"]]["actions"][:, -1] sign = np.sign(action) close = np.flatnonzero((sign[:-1] < 0) & (sign[1:] > 0)) + 1 release = np.flatnonzero((sign[:-1] > 0) & (sign[1:] < 0)) + 1 episodes[(task, episode)] = { "length": len(action), "sign": sign, "close": close.tolist(), "release": release.tolist(), } return episodes
def source_phase(task, episode, midpoint): n = episode["length"] fraction = midpoint / n close, release = episode["close"], episode["release"] if task == "coffee_preparation_d0": if len(close) != 2 or len(release) != 2: return "unusual_gripper_sequence" if midpoint < close[0]: return "mug_approach" if midpoint < release[0]: return "mug_carry_place" if fraction < 12 / 33.65: return "lid_open_rough" if fraction < 18 / 33.65: return "drawer_open_rough" if midpoint < close[1]: return "pod_approach_rough" if midpoint < release[1]: return "pod_carry_insert" return "lid_close_rough" if task == "kitchen_d0": if len(close) != 3 or len(release) != 3: return "unusual_gripper_sequence" if fraction < 4 / 29.65: return "stove_on_rough" if midpoint < close[0]: return "pot_approach_rough" if midpoint < release[0]: return "pot_to_stove" if midpoint < close[1]: return "bread_approach_rough" if midpoint < release[1]: return "bread_to_pot" if midpoint < close[2]: return "pot_approach_second" if midpoint < release[2]: return "pot_to_serving_area" if fraction < 26 / 29.65: return "push_serve_rough" return "stove_off_rough" if task == "pick_place_d0": for i, (grasp, drop) in enumerate(zip(close, release), 1): if midpoint < grasp: return f"approach_cycle_{i}" if midpoint < drop: return f"carry_place_cycle_{i}" return "after_last_release" raise ValueError(task)
def target_phase(task, episode, midpoint): fraction = midpoint / episode["length"] close, release = episode["close"], episode["release"] if len(close) != 1 or len(release) != 1: return "unusual_gripper_sequence" drawer_end = 5 / 18.1 if task == "mug_cleanup_o1" else 4 / 16.15 if fraction < drawer_end: return "open_drawer_rough" if midpoint < close[0]: return "object_approach" if midpoint < release[0]: return "object_carry_place" return "close_drawer_rough"
def clip_key(row): return row["source_task"], int(row["source_episode"]), int(row["source_timestep"])
def unique_points(clips): return {(task, episode, step) for row in clips for task, episode, start in [clip_key(row)] for step in range(start, start + 10)}
def main(): parser = argparse.ArgumentParser() parser.add_argument("--project-root", type=Path, default=Path("/workspace/single_task_transfer")) parser.add_argument("--retrieval-name", default="multi_source_3task") parser.add_argument("--output-dir", type=Path) args = parser.parse_args() root = args.project_root output = args.output_dir or root / "artifacts/retrieval" / args.retrieval_name / "analysis" output.mkdir(parents=True, exist_ok=True) sources = load_episodes(root, SOURCE) targets = load_episodes(root, TARGET) candidate_phases = defaultdict(Counter) candidate_closed = Counter() candidate_counts = Counter() gripper_cycles = defaultdict(Counter) for (task, episode_id), episode in sources.items(): gripper_cycles[task][len(episode["close"])] += 1 for start in range(episode["length"] - 9): midpoint = start + 4.5 phase = source_phase(task, episode, midpoint) candidate_phases[task][phase] += 1 candidate_counts[task] += 1 candidate_closed[task] += episode["sign"][int(midpoint)] > 0
selection_root = root / "artifacts/retrieval" / args.retrieval_name / "selections" result = {"method": "10-step midpoint; per-episode gripper-command switches plus normalized demo_0 rough boundaries", "source_candidate_count": dict(candidate_counts), "source_candidate_phase_count": {task: dict(counts) for task, counts in candidate_phases.items()}, "source_gripper_cycle_count": {task: dict(counts) for task, counts in gripper_cycles.items()}, "targets": {}} csv_rows = [] for target in TARGET: target_results = {} selections = {} for method in METHODS: payload = json.loads((selection_root / target / f"{method}.json").read_text()) clips = payload["clips"] selections[method] = clips phase_counts = defaultdict(Counter) task_counts = Counter() closed_counts = Counter() episode_sets = defaultdict(set) query_phases = Counter() for row in clips: task, episode_id, start = clip_key(row) episode = sources[(task, episode_id)] midpoint = start + 4.5 phase = source_phase(task, episode, midpoint) phase_counts[task][phase] += 1 task_counts[task] += 1 closed_counts[task] += episode["sign"][int(midpoint)] > 0 episode_sets[task].add(episode_id) if method.startswith("br_"): query = targets[(target, int(row["query_episode"]))] query_phases[target_phase(target, query, int(row["query_timestep"]) + 4.5)] += 1 for task in SOURCE_ORDER: for phase in candidate_phases[task]: selected = phase_counts[task][phase] base = candidate_phases[task][phase] share = selected / task_counts[task] if task_counts[task] else 0 base_share = base / candidate_counts[task] csv_rows.append({ "target": target, "method": method, "source_task": task, "phase": phase, "selected_clips": selected, "task_selected_clips": task_counts[task], "selected_share_within_task": share, "candidate_windows": base, "task_candidate_windows": candidate_counts[task], "candidate_share_within_task": base_share, "within_task_enrichment": share / base_share if base_share else 0, }) target_results[method] = { "clip_count": len(clips), "source_task_counts": dict(task_counts), "source_episode_counts": {task: len(episode_sets[task]) for task in SOURCE_ORDER}, "source_phase_counts": {task: dict(phase_counts[task]) for task in SOURCE_ORDER}, "source_closed_command_share": {task: closed_counts[task] / task_counts[task] if task_counts[task] else None for task in SOURCE_ORDER}, "unique_source_timesteps": len(unique_points(clips)), "br_nearest_query_phase_counts": dict(query_phases) if method.startswith("br_") else None, } for suffix in ("overlap", "nonoverlap"): a = unique_points(selections[f"br_{suffix}"]) b = unique_points(selections[f"iwr_{suffix}"]) target_results[f"br_iwr_{suffix}_shared_unique_timesteps"] = len(a & b) result["targets"][target] = target_results
result["source_candidate_closed_command_share"] = { task: candidate_closed[task] / candidate_counts[task] for task in SOURCE_ORDER } (output / "phase_analysis.json").write_text(json.dumps(result, indent=2, sort_keys=True) + "\n") with (output / "phase_enrichment.csv").open("w", newline="") as stream: writer = csv.DictWriter(stream, fieldnames=list(csv_rows[0])) writer.writeheader() writer.writerows(csv_rows) print(json.dumps({"source_candidate_count": result["source_candidate_count"], "source_gripper_cycle_count": result["source_gripper_cycle_count"], "targets": result["targets"]}, indent=2, sort_keys=True)) print("MULTI_SOURCE_PHASE_ANALYSIS_OK")
if __name__ == "__main__": main()1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495#!/usr/bin/env python3"""Compare retrieval source distributions before and after adding Coffee D0."""
import argparseimport jsonfrom collections import Counterfrom pathlib import Path
import h5pyimport numpy as np
TASKS = ("coffee_preparation_d0", "pick_place_d0", "kitchen_d0", "coffee_d0")TARGETS = ("mug_cleanup_o1", "hammer_cleanup_d0")METHODS = ("br_nonoverlap", "iwr_nonoverlap", "br_overlap", "iwr_overlap")PHASES = ("before_grasp", "grasp_to_release", "after_release")
def key(row): return row["source_task"], int(row["source_episode"]), int(row["source_timestep"])
def phase(episode, midpoint): grasp, release = episode["grasp"], episode["release"] if midpoint < grasp: return PHASES[0] if midpoint < release: return PHASES[1] return PHASES[2]
def main(): parser = argparse.ArgumentParser() parser.add_argument("--project-root", type=Path, default=Path("/workspace/single_task_transfer")) parser.add_argument("--old-name", default="multi_source_3task") parser.add_argument("--new-name", default="multi_source_plus_coffee_d0") args = parser.parse_args() project = args.project_root output = project / "artifacts/retrieval" / args.new_name / "analysis" output.mkdir(parents=True, exist_ok=True) old = project / "artifacts/retrieval" / args.old_name / "selections" new = project / "artifacts/retrieval" / args.new_name / "selections" manifest = json.loads((project / "data/manifests/multi_source_plus_coffee_d0/coffee_d0_source_episodes.json").read_text()) episodes = {} baseline = Counter() with h5py.File(project / "data/raw/mimicgen_corl_2023/core/coffee_d0.hdf5", "r") as handle: for row in manifest["episodes"]: episode_id = int(row["episode"].rsplit("_", 1)[-1]) action = handle["data"][row["episode"]]["actions"][:, -1] sign = np.sign(action) grasp = np.flatnonzero((sign[:-1] < 0) & (sign[1:] > 0)) + 1 release = np.flatnonzero((sign[:-1] > 0) & (sign[1:] < 0)) + 1 if len(grasp) != 1 or len(release) != 1: raise RuntimeError(f"unexpected Coffee D0 gripper cycle in {row['episode']}") item = {"length": len(action), "grasp": int(grasp[0]), "release": int(release[0])} episodes[episode_id] = item for start in range(len(action) - 9): baseline[phase(item, start + 4.5)] += 1
result = { "encoder_retrained": False, "source_tasks": TASKS, "coffee_d0_episodes": len(episodes), "coffee_d0_candidate_windows": sum(baseline.values()), "coffee_d0_candidate_phase_counts": dict(baseline), "coffee_d0_grasp_fraction_mean": float(np.mean([ep["grasp"] / ep["length"] for ep in episodes.values()])), "coffee_d0_release_fraction_mean": float(np.mean([ep["release"] / ep["length"] for ep in episodes.values()])), "targets": {}, } for target in TARGETS: rows = {} for method in METHODS: prior = json.loads((old / target / f"{method}.json").read_text()) expanded = json.loads((new / target / f"{method}.json").read_text()) coffee = [row for row in expanded["clips"] if row["source_task"] == "coffee_d0"] counts = Counter(phase(episodes[int(row["source_episode"])], int(row["source_timestep"]) + 4.5) for row in coffee) prior_keys = {key(row) for row in prior["clips"]} expanded_keys = {key(row) for row in expanded["clips"]} rows[method] = { "old_source_task_counts": prior["source_task_counts"], "new_source_task_counts": expanded["source_task_counts"], "coffee_d0_phase_counts": dict(counts), "coffee_d0_selected_episodes": len({int(row["source_episode"]) for row in coffee}), "new_unique_source_timesteps": expanded["unique_source_timesteps"], "unchanged_selected_anchor_count": len(prior_keys & expanded_keys), } result["targets"][target] = rows (output / "comparison.json").write_text(json.dumps(result, indent=2, sort_keys=True) + "\n") print(json.dumps(result, indent=2, sort_keys=True)) print("PLUS_COFFEE_D0_SOURCE_ANALYSIS_OK")
if __name__ == "__main__": main()123456b125e67c84a8707b28a946b3db3c51674c7f7ae2979282eafeb5816318a72059 /workspace/single_task_transfer/artifacts/encoders/multi_source_3task/multi-source-coffee-pick-kitchen-b128-90k-cont-from-70k-seed1/90000/_CHECKPOINT_METADATAfe9d21a4f23524e1a643c103c81fa35698c6866235729a121d8ed55f58726c8f /workspace/single_task_transfer/artifacts/retrieval/multi_source_3task_90k/embeddings/source_embeddings.npz5cb04d863bc7c68c7b80854898dd619a2d9faad6418c1cf2952aaa45bd8656b0 /workspace/single_task_transfer/artifacts/retrieval/multi_source_3task_90k/selections/mug_cleanup_o1/summary.json285fdf59b3b4d6e767a31e98c01392ff03d41b2ded29ba38d9804cc5b73dcf18 /workspace/single_task_transfer/artifacts/retrieval/multi_source_3task_90k/selections/hammer_cleanup_d0/summary.json82df7bad16bc3ebe6dfe62357da53086817ca407b2c19260a83359c176b8e7b0 /workspace/single_task_transfer/artifacts/retrieval/multi_source_plus_coffee_d0_90k/embeddings/source_embeddings.npz0a821b3b44fee541b638f5f5172f75984471c0eff19c26d8ba44015e45862e9f /workspace/single_task_transfer/artifacts/retrieval/multi_source_3task_90k/analysis/checkpoint_comparison.json123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125#!/usr/bin/env python3"""Compare retrieval selections from 70k and continued 90k SAILOR checkpoints."""
import argparseimport jsonfrom pathlib import Path
import matplotlib.pyplot as pltfrom matplotlib.patches import Patchimport numpy as np
POOLS = { "three_source": ("multi_source_3task", "multi_source_3task_90k"), "plus_coffee_d0": ("multi_source_plus_coffee_d0", "multi_source_plus_coffee_d0_90k"),}TARGETS = ("mug_cleanup_o1", "hammer_cleanup_d0")METHODS = ("br_nonoverlap", "iwr_nonoverlap", "br_overlap", "iwr_overlap")TASKS = ( ("coffee_preparation_d0", "Coffee Prep", "#8c564b"), ("pick_place_d0", "Pick Place", "#d62728"), ("kitchen_d0", "Kitchen", "#1f77b4"), ("coffee_d0", "Coffee D0", "#9467bd"),)
def keys(clips): return {(row["source_task"], int(row["source_episode"]), int(row["source_timestep"])) for row in clips}
def points(clips): return {(row["source_task"], int(row["source_episode"]), step) for row in clips for step in range(int(row["source_timestep"]), int(row["source_timestep"]) + 10)}
def main(): parser = argparse.ArgumentParser() parser.add_argument("--project-root", type=Path, default=Path("/workspace/single_task_transfer")) args = parser.parse_args() project = args.project_root retrieval = project / "artifacts/retrieval" output = retrieval / "multi_source_3task_90k/analysis" output.mkdir(parents=True, exist_ok=True) result = {"comparison": "same source/target episode manifests and clip budgets; encoder continued 70k to 90k", "pools": {}} for pool, (name70, name90) in POOLS.items(): pool_result = {} for target in TARGETS: target_result = {} for method in METHODS: old = json.loads((retrieval / name70 / "selections" / target / f"{method}.json").read_text()) new = json.loads((retrieval / name90 / "selections" / target / f"{method}.json").read_text()) if old["clip_count"] != new["clip_count"]: raise RuntimeError("clip budget changed") old_keys, new_keys = keys(old["clips"]), keys(new["clips"]) old_points, new_points = points(old["clips"]), points(new["clips"]) target_result[method] = { "clip_count": old["clip_count"], "task_counts_70k": old["source_task_counts"], "task_counts_90k": new["source_task_counts"], "shared_clip_anchors": len(old_keys & new_keys), "shared_unique_timesteps": len(old_points & new_points), "unique_timesteps_70k": len(old_points), "unique_timesteps_90k": len(new_points), } pool_result[target] = target_result result["pools"][pool] = pool_result
# The three-source phase analysis uses the same gripper/event labels at # both checkpoints, so changes here reflect only retrieval choices. phase70 = json.loads((retrieval / POOLS["three_source"][0] / "analysis/phase_analysis.json").read_text()) phase90 = json.loads((retrieval / POOLS["three_source"][1] / "analysis/phase_analysis.json").read_text()) phase_changes = {} for target in TARGETS: phase_changes[target] = {} for method in METHODS: phase_changes[target][method] = {} for task, _, _ in TASKS[:3]: a = phase70["targets"][target][method]["source_phase_counts"][task] b = phase90["targets"][target][method]["source_phase_counts"][task] phase_changes[target][method][task] = { phase: {"count_70k": a.get(phase, 0), "count_90k": b.get(phase, 0)} for phase in sorted(set(a) | set(b)) } result["three_source_phase_counts"] = phase_changes (output / "checkpoint_comparison.json").write_text(json.dumps(result, indent=2, sort_keys=True) + "\n")
fig, axes = plt.subplots(2, 2, figsize=(14, 9)) for row, target in enumerate(TARGETS): for col, (pool, _) in enumerate(POOLS.items()): ax = axes[row, col] labels = ("BR 70k", "BR 90k", "IWR 70k", "IWR 90k") values = [] for method in ("br_nonoverlap", "iwr_nonoverlap"): record = result["pools"][pool][target][method] values.extend((record["task_counts_70k"], record["task_counts_90k"])) for y, counts in enumerate(values): total = sum(counts.values()) left = 0 for task, _, color in TASKS: share = 100 * counts.get(task, 0) / total ax.barh(y, share, left=left, color=color, height=0.7) if share >= 9: ax.text(left + share / 2, y, f"{share:.0f}%", ha="center", va="center", color="white", fontweight="bold", fontsize=8) left += share ax.set_yticks(range(4), labels) ax.invert_yaxis() ax.set_xlim(0, 100) ax.set_xticks(range(0, 101, 25), [f"{x}%" for x in range(0, 101, 25)]) ax.set_title(f"{target.replace('_', ' ').title()} · {'3 sources' if col == 0 else '+ Coffee D0'}") ax.grid(axis="x", alpha=0.2) ax.set_axisbelow(True) fig.suptitle("How retrieval task mix changes from 70k to 90k (nonoverlap)", fontsize=16) fig.legend(handles=[Patch(color=color, label=label) for _, label, color in TASKS], loc="upper center", ncol=4, bbox_to_anchor=(0.5, 0.94), frameon=False) fig.subplots_adjust(left=0.11, right=0.98, bottom=0.07, top=0.84, hspace=0.42, wspace=0.25) fig.savefig(output / "task_mix_70k_vs_90k.png", dpi=180) plt.close(fig) print("MULTI_SOURCE_CHECKPOINT_COMPARISON_OK")
if __name__ == "__main__": main()1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677#!/usr/bin/env python3"""Embed Coffee D0 with the frozen three-task SAILOR checkpoint, then extend the source pool."""
import argparseimport jsonimport shutilimport sysfrom pathlib import Path
import numpy as np
from extract_multi_source_embeddings import embed, make_dataset, valid_keys
SOURCE_TASKS = ("coffee_preparation_d0", "pick_place_d0", "kitchen_d0", "coffee_d0")
def main(): parser = argparse.ArgumentParser() parser.add_argument("--project-root", type=Path, default=Path("/workspace/single_task_transfer")) parser.add_argument("--run-name", default="multi-source-coffee-pick-kitchen-b128-70k-seed1") parser.add_argument("--checkpoint-step", type=int, default=70000) parser.add_argument("--prior-retrieval-name", default="multi_source_3task") parser.add_argument("--output-retrieval-name", default="multi_source_plus_coffee_d0") args = parser.parse_args() project = args.project_root sys.path.insert(0, str(project / "third_party/importance-retrieval")) from openx.utils.evaluate import load_checkpoint
prior = project / "artifacts/retrieval" / args.prior_retrieval_name / "embeddings" output = project / "artifacts/retrieval" / args.output_retrieval_name / "embeddings" manifest = project / "data/manifests/multi_source_plus_coffee_d0/coffee_d0_source_episodes.json" rlds = project / "data/rlds/mimic_gen_transfer/coffee_d0/1.0.0" checkpoint = project / "artifacts/encoders/multi_source_3task" / args.run_name output.mkdir(parents=True, exist_ok=True)
alg, state, statistics, config = load_checkpoint(str(checkpoint), step=args.checkpoint_step) # Coffee D0 was not used to fit encoder normalization. All three training # tasks share one global statistic set; use its saved Coffee Prep entry. dataset = make_dataset(config, statistics, "coffee_preparation_d0", rlds) z, ids = embed(alg, state, dataset, valid_keys(manifest)) np.savez_compressed(output / "coffee_d0_embeddings.npz", embeddings=z, ids=ids)
previous = np.load(prior / "source_embeddings.npz") previous_z = previous["embeddings"].astype(np.float32) previous_ids = previous["ids"].astype(np.int32) previous_tasks = previous["task_ids"].astype(np.int16) if set(previous_tasks.tolist()) != {0, 1, 2}: raise RuntimeError("unexpected original source task IDs") np.savez_compressed( output / "source_embeddings.npz", embeddings=np.concatenate((previous_z, z)), ids=np.concatenate((previous_ids, ids)), task_ids=np.concatenate((previous_tasks, np.full(len(z), 3, dtype=np.int16))), ) for name in SOURCE_TASKS[:3]: shutil.copy2(prior / f"{name}_embeddings.npz", output / f"{name}_embeddings.npz") for target in ("mug_cleanup_o1", "hammer_cleanup_d0"): shutil.copy2(prior / f"{target}_target_embeddings.npz", output / f"{target}_target_embeddings.npz") metadata = { "source_tasks": SOURCE_TASKS, "checkpoint": str(checkpoint), "checkpoint_step": args.checkpoint_step, "encoder_retrained": False, "normalization": "frozen three-task source encoder statistics", "coffee_d0_manifest": str(manifest), "coffee_d0_windows": len(z), "total_source_windows": len(previous_z) + len(z), "target_embeddings_reused_from": str(prior), } (output / "metadata.json").write_text(json.dumps(metadata, indent=2, sort_keys=True) + "\n") print(json.dumps(metadata, indent=2, sort_keys=True)) print("COFFEE_D0_SOURCE_EMBEDDINGS_OK")
if __name__ == "__main__": main()123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117#!/usr/bin/env python3"""Encode every eligible window from the three-task retrieval source pool."""
import argparseimport jsonimport sysfrom pathlib import Path
import jaximport numpy as np
TASKS = ("coffee_preparation_d0", "pick_place_d0", "kitchen_d0")MANIFESTS = ( "source_episodes.json", "broad_pick_place_d0_episodes.json", "multi_kitchen_d0_episodes.json",)METADATA_KEYS = ("ep_idx", "step_idx", "quality_score", "task_id")
def valid_keys(path): manifest = json.loads(path.read_text()) window = int(manifest["sequence_length"]) return { (int(row["episode"].rsplit("_", 1)[-1]), step) for row in manifest["episodes"] for step in range(int(row["timesteps"]) - window + 1) }
def make_dataset(config, statistics, task, path): from openx.data.dataloader import make_dataloader
loader = config.dataloader.to_dict() loader.update( repeat=False, recompute_statistics=False, global_dataset_statistics=None, batch_size=256, drop_remainder=False, shuffle_size=0, cache=False, prefetch=0, ) task_config = loader["datasets"][task].copy() task_config.update( path=str(path), train_split="train", val_split=None, dataset_statistics=statistics[task] ) loader["datasets"] = {"dataset": task_config} structure = config.structure.to_dict() for key in METADATA_KEYS: structure[key] = None dataset, _, _, _ = make_dataloader(**loader, structure=structure, split_for_jax=False) return dataset
def embed(alg, state, dataset, keys): predict = jax.jit(alg.predict) rng = jax.random.key(0) embeddings, ids = [], [] for batch_index, batch in enumerate(dataset): values = jax.tree.map(lambda value: value.numpy(), batch) rng = jax.random.fold_in(rng, batch_index) z = np.asarray(predict(state, values, rng)) ep = np.asarray(values["ep_idx"]) step = np.asarray(values["step_idx"]) keep = np.array([(int(e), int(s)) in keys for e, s in zip(ep, step)], dtype=bool) embeddings.append(z[keep]) ids.append(np.stack((ep[keep], step[keep]), axis=-1).astype(np.int32)) z = np.concatenate(embeddings).astype(np.float32) ids = np.concatenate(ids) if z.shape != (len(keys), 16) or ids.shape != (len(keys), 2): raise RuntimeError(f"unexpected embedding shapes: {z.shape}, {ids.shape}, expected {len(keys)}") if not np.isfinite(z).all() or len({tuple(row) for row in ids.tolist()}) != len(keys): raise RuntimeError("nonfinite embeddings or duplicate IDs") return z, ids
def main(): parser = argparse.ArgumentParser() parser.add_argument("--project-root", type=Path, default=Path("/workspace/single_task_transfer")) parser.add_argument("--run-name", default="multi-source-coffee-pick-kitchen-b128-70k-seed1") parser.add_argument("--checkpoint-step", type=int, default=70000) parser.add_argument("--retrieval-name", default="multi_source_3task") args = parser.parse_args() project = args.project_root sys.path.insert(0, str(project / "third_party/importance-retrieval")) from openx.utils.evaluate import load_checkpoint
checkpoint = project / "artifacts/encoders/multi_source_3task" / args.run_name output = project / "artifacts/retrieval" / args.retrieval_name / "embeddings" output.mkdir(parents=True, exist_ok=True) alg, state, statistics, config = load_checkpoint(str(checkpoint), step=args.checkpoint_step) source_z, source_ids, source_task_ids = [], [], [] metadata = {"checkpoint": str(checkpoint), "checkpoint_step": args.checkpoint_step, "normalization": "frozen three-task encoder statistics", "tasks": {}} for task_id, (task, filename) in enumerate(zip(TASKS, MANIFESTS)): manifest = project / "data/manifests/multi_source_3task" / filename path = project / "data/rlds/mimic_gen_transfer" / task / "1.0.0" z, ids = embed(alg, state, make_dataset(config, statistics, task, path), valid_keys(manifest)) np.savez_compressed(output / f"{task}_embeddings.npz", embeddings=z, ids=ids) source_z.append(z) source_ids.append(ids) source_task_ids.append(np.full(len(z), task_id, dtype=np.int16)) metadata["tasks"][task] = {"task_id": task_id, "windows": len(z), "manifest": str(manifest), "rlds_path": str(path)} print(task, len(z), flush=True) np.savez_compressed(output / "source_embeddings.npz", embeddings=np.concatenate(source_z), ids=np.concatenate(source_ids), task_ids=np.concatenate(source_task_ids)) (output / "metadata.json").write_text(json.dumps(metadata, indent=2, sort_keys=True) + "\n") print("MULTI_SOURCE_EMBEDDINGS_OK", flush=True)
if __name__ == "__main__": main()12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152#!/usr/bin/env python3"""Embed Mug O1 and Hammer D0 queries with the frozen three-task encoder."""
import argparseimport jsonimport sysfrom pathlib import Path
import numpy as np
from extract_multi_source_embeddings import embed, make_dataset, valid_keys
TARGETS = { "mug_cleanup_o1": "target_episodes.json", "hammer_cleanup_d0": "multi_hammer_cleanup_d0_episodes.json",}
def main(): parser = argparse.ArgumentParser() parser.add_argument("--project-root", type=Path, default=Path("/workspace/single_task_transfer")) parser.add_argument("--run-name", default="multi-source-coffee-pick-kitchen-b128-70k-seed1") parser.add_argument("--checkpoint-step", type=int, default=70000) parser.add_argument("--retrieval-name", default="multi_source_3task") args = parser.parse_args() project = args.project_root sys.path.insert(0, str(project / "third_party/importance-retrieval")) from openx.utils.evaluate import load_checkpoint
checkpoint = project / "artifacts/encoders/multi_source_3task" / args.run_name output = project / "artifacts/retrieval" / args.retrieval_name / "embeddings" output.mkdir(parents=True, exist_ok=True) alg, state, statistics, config = load_checkpoint(str(checkpoint), step=args.checkpoint_step) metadata = {"checkpoint": str(checkpoint), "checkpoint_step": args.checkpoint_step, "normalization": "frozen three-task encoder statistics", "targets": {}} for task, filename in TARGETS.items(): manifest = project / "data/manifests/multi_source_targets" / filename path = project / "data/rlds/mimic_gen_transfer" / task / "1.0.0" # Target tasks have no normalization statistics of their own. All source # tasks share global encoder statistics, so use the saved Coffee entry. dataset = make_dataset(config, statistics, "coffee_preparation_d0", path) z, ids = embed(alg, state, dataset, valid_keys(manifest)) np.savez_compressed(output / f"{task}_target_embeddings.npz", embeddings=z, ids=ids) metadata["targets"][task] = {"windows": len(z), "manifest": str(manifest), "rlds_path": str(path)} print(task, len(z), flush=True) (output / "target_metadata.json").write_text(json.dumps(metadata, indent=2, sort_keys=True) + "\n") print("MULTI_SOURCE_TARGET_EMBEDDINGS_OK", flush=True)
if __name__ == "__main__": main()123456789101112131415161718192021222324252627282930313233# Continue the three-task SAILOR encoder from 70k to 90k
The completed 70,000-step SAILOR run is preserved. A separate run directorycopies its 70k model and optimizer state and resumes for 20,000 further updatesusing the same 100 Coffee Preparation D0, 100 Pick Place D0, and 100 KitchenD0 demonstrations, model, batch size 128, seed, and task-balanced sampling.The resumed loader's random stream is restarted at step 70k, so this is astateful continuation rather than a bit-for-bit extension of an uninterrupted90k run.
`scripts/resume_multi_source_encoder_to_90k.sh` starts the training. Thecheckpoint run is named`multi-source-coffee-pick-kitchen-b128-90k-cont-from-70k-seed1` under`artifacts/encoders/multi_source_3task/`. It retains a copy of the 70k stateand writes new 80k and 90k checkpoints.
`scripts/run_multi_source_90k_retrieval_when_ready.sh` waits for the 90kcheckpoint and then:
1. Re-embeds the same three source and two target manifests at 90k under `artifacts/retrieval/multi_source_3task_90k/`.2. Recomputes BR and exact global IWR for Mug Cleanup O1 and Hammer Cleanup D0 using the same clip budgets and KDE settings as the 70k run.3. Re-encodes the same 100 Coffee D0 source demonstrations and repeats the four-source comparison under `artifacts/retrieval/multi_source_plus_coffee_d0_90k/`.4. Regenerates phase plots and a direct 70k-versus-90k comparison JSON/chart.
The 70k retrieval arrays and rankings remain untouched. Raw BR distances andKDE log densities across the two checkpoints are not directly comparablebecause the latent coordinate system can move. The planned comparison focuseson source-task mix, source phases, selected-window overlap, and unique sourcetimesteps.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104#!/usr/bin/env python3"""Make compact charts of task and phase choices in nonoverlap retrieval."""
import argparseimport jsonfrom pathlib import Path
import matplotlib.pyplot as pltfrom matplotlib.patches import Patchimport numpy as np
TASKS = ( ("coffee_preparation_d0", "Coffee Prep", "#8c564b"), ("pick_place_d0", "Pick Place", "#d62728"), ("kitchen_d0", "Kitchen", "#1f77b4"),)PANELS = ( ("mug_cleanup_o1", "br_nonoverlap", "Mug O1 · BR"), ("mug_cleanup_o1", "iwr_nonoverlap", "Mug O1 · IWR"), ("hammer_cleanup_d0", "br_nonoverlap", "Hammer D0 · BR"), ("hammer_cleanup_d0", "iwr_nonoverlap", "Hammer D0 · IWR"),)
def phase_name(task, phase): task_short = next(label for key, label, _ in TASKS if key == task) phase_short = phase.replace("_rough", "").replace("_", " ") return f"{task_short} · {phase_short}"
def main(): parser = argparse.ArgumentParser() parser.add_argument("--analysis-dir", type=Path, default=Path("/workspace/single_task_transfer/artifacts/retrieval/multi_source_3task/analysis")) args = parser.parse_args() folder = args.analysis_dir data = json.loads((folder / "phase_analysis.json").read_text()) colors = {task: color for task, _, color in TASKS} legend = [Patch(facecolor=color, label=label) for _, label, color in TASKS]
fig, ax = plt.subplots(figsize=(10.5, 4.9), constrained_layout=True) labels = ["Eligible source pool"] + [name for _, _, name in PANELS] totals = [sum(data["source_candidate_count"].values())] + [ data["targets"][target][method]["clip_count"] for target, method, _ in PANELS ] values = [data["source_candidate_count"]] + [ data["targets"][target][method]["source_task_counts"] for target, method, _ in PANELS ] for row, (label, total, counts) in enumerate(zip(labels, totals, values)): left = 0 for task, _, color in TASKS: count = counts.get(task, 0) percentage = 100 * count / total ax.barh(row, percentage, left=left, height=0.68, color=color) if percentage >= 5: ax.text(left + percentage / 2, row, f"{percentage:.0f}%\n({count:,})", ha="center", va="center", color="white", fontweight="bold", fontsize=9) left += percentage ax.set_yticks(range(len(labels)), labels, fontsize=11) ax.invert_yaxis() ax.set_xlim(0, 100) ax.set_xticks(range(0, 101, 20), [f"{x}%" for x in range(0, 101, 20)]) ax.set_xlabel("Share of eligible windows or selected clips") ax.set_title("Which source tasks are retrieved? (nonoverlap selections)", fontsize=15) ax.legend(handles=legend, loc="lower center", bbox_to_anchor=(0.5, -0.30), ncol=3, frameon=False, fontsize=10) ax.grid(axis="x", alpha=0.2) ax.set_axisbelow(True) fig.savefig(folder / "task_mix_simple.png", dpi=180) plt.close(fig)
fig, axes = plt.subplots(2, 2, figsize=(15, 9.5), constrained_layout=True) for ax, (target, method, title) in zip(axes.flat, PANELS): selection = data["targets"][target][method] total = selection["clip_count"] phases = [ (count, task, phase) for task, counts in selection["source_phase_counts"].items() for phase, count in counts.items() ] top = sorted(phases, reverse=True)[:6] top.reverse() y = np.arange(len(top)) shares = [100 * count / total for count, _, _ in top] ax.barh(y, shares, color=[colors[task] for _, task, _ in top], height=0.65) ax.set_yticks(y, [phase_name(task, phase) for _, task, phase in top], fontsize=9) ax.set_xlim(0, max(shares) * 1.3) ax.set_xlabel("% of selected clips") ax.set_title(f"{title} (n={total})", fontsize=13) ax.grid(axis="x", alpha=0.2) ax.set_axisbelow(True) for i, (count, _, _) in enumerate(top): ax.text(shares[i] + max(shares) * 0.02, i, str(count), va="center", fontsize=9) fig.suptitle("Most selected source task phases (rough labels + gripper events)", fontsize=16) fig.legend(handles=legend, loc="lower center", bbox_to_anchor=(0.5, -0.03), ncol=3, frameon=False, fontsize=10) fig.savefig(folder / "top_phases.png", dpi=180) plt.close(fig) print("MULTI_SOURCE_SUMMARY_PLOTS_OK")
if __name__ == "__main__": main()123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899#!/usr/bin/env python3"""Plot source-task and Coffee D0 phase changes after expanding the source pool."""
import argparseimport jsonfrom pathlib import Path
import matplotlib.pyplot as pltfrom matplotlib.patches import Patchimport numpy as np
TASKS = ( ("coffee_preparation_d0", "Coffee Prep", "#8c564b"), ("pick_place_d0", "Pick Place", "#d62728"), ("kitchen_d0", "Kitchen", "#1f77b4"), ("coffee_d0", "Coffee D0", "#9467bd"),)TARGETS = (("mug_cleanup_o1", "Mug Cleanup O1"), ("hammer_cleanup_d0", "Hammer Cleanup D0"))PHASES = (("before_grasp", "Before pod grasp"), ("grasp_to_release", "Grasp → release"), ("after_release", "After release"))
def main(): parser = argparse.ArgumentParser() parser.add_argument("--analysis-dir", type=Path, default=Path("/workspace/single_task_transfer/artifacts/retrieval/multi_source_plus_coffee_d0/analysis")) args = parser.parse_args() folder = args.analysis_dir data = json.loads((folder / "comparison.json").read_text()) legend = [Patch(facecolor=color, label=label) for _, label, color in TASKS]
fig, axes = plt.subplots(2, 1, figsize=(10.5, 8)) for ax, (target, title) in zip(axes, TARGETS): labels = ["3 tasks · BR", "+ Coffee D0 · BR", "3 tasks · IWR", "+ Coffee D0 · IWR"] values = [ data["targets"][target]["br_nonoverlap"]["old_source_task_counts"], data["targets"][target]["br_nonoverlap"]["new_source_task_counts"], data["targets"][target]["iwr_nonoverlap"]["old_source_task_counts"], data["targets"][target]["iwr_nonoverlap"]["new_source_task_counts"], ] for y, counts in enumerate(values): total = sum(counts.values()) left = 0 for task, _, color in TASKS: n = counts.get(task, 0) share = 100 * n / total ax.barh(y, share, left=left, color=color, height=0.68) if share >= 6: ax.text(left + share / 2, y, f"{share:.0f}%\n({n})", ha="center", va="center", color="white", fontweight="bold", fontsize=8) left += share ax.set_yticks(range(4), labels) ax.invert_yaxis() ax.set_xlim(0, 100) ax.set_xticks(range(0, 101, 20), [f"{x}%" for x in range(0, 101, 20)]) ax.set_title(title, fontsize=13) ax.set_xlabel("Share of selected 10-step clips") ax.grid(axis="x", alpha=0.2) ax.set_axisbelow(True) fig.suptitle("Effect of adding Coffee D0 to the source pool (nonoverlap)", fontsize=15) fig.legend(handles=legend, loc="upper center", bbox_to_anchor=(0.5, 0.94), ncol=4, frameon=False, fontsize=9) fig.subplots_adjust(left=0.23, right=0.98, bottom=0.07, top=0.84, hspace=0.55) fig.savefig(folder / "task_mix_comparison.png", dpi=180) plt.close(fig)
fig, axes = plt.subplots(1, 2, figsize=(12.5, 4.6), sharey=True, constrained_layout=True) baseline = data["coffee_d0_candidate_phase_counts"] base_total = sum(baseline.values()) for ax, (target, title) in zip(axes, TARGETS): x = np.arange(3) br = data["targets"][target]["br_nonoverlap"]["coffee_d0_phase_counts"] iwr = data["targets"][target]["iwr_nonoverlap"]["coffee_d0_phase_counts"] br_total, iwr_total = sum(br.values()), sum(iwr.values()) ax.bar(x - 0.25, [100 * baseline.get(k, 0) / base_total for k, _ in PHASES], width=0.24, color="#999", label="Eligible Coffee D0") if br_total: ax.bar(x, [100 * br.get(k, 0) / br_total for k, _ in PHASES], width=0.24, color="#2ca02c", label=f"BR (n={br_total})") if iwr_total: ax.bar(x + 0.25, [100 * iwr.get(k, 0) / iwr_total for k, _ in PHASES], width=0.24, color="#ff7f0e", label=f"IWR (n={iwr_total})") ax.set_xticks(x, [label for _, label in PHASES]) ax.set_ylim(0, 100) ax.set_ylabel("Share within Coffee D0") ax.set_title(title) ax.legend(fontsize=8) ax.grid(axis="y", alpha=0.2) ax.set_axisbelow(True) fig.suptitle("Where the selected Coffee D0 clips occur", fontsize=15) fig.savefig(folder / "coffee_d0_gripper_phases.png", dpi=180) plt.close(fig) print("PLUS_COFFEE_D0_SOURCE_PLOTS_OK")
if __name__ == "__main__": main()12345678910111213141516171819202122232425262728293031323334353637#!/usr/bin/env bashset -euo pipefail
PROJECT_ROOT="${PROJECT_ROOT:-/workspace/single_task_transfer}"ROOT="${PROJECT_ROOT}/artifacts/encoders/multi_source_3task"PARENT="${ROOT}/multi-source-coffee-pick-kitchen-b128-70k-seed1"RUN_NAME="multi-source-coffee-pick-kitchen-b128-90k-cont-from-70k-seed1"CONTINUED="${ROOT}/${RUN_NAME}"
test -f "${PARENT}/.training_done"test -f "${PARENT}/state/70000/_CHECKPOINT_METADATA"test -f "${PARENT}/70000/_CHECKPOINT_METADATA"if [[ ! -d "${CONTINUED}/state/70000" ]]; then if [[ -e "${CONTINUED}" ]]; then echo "refusing to overwrite partial continuation ${CONTINUED}" >&2 exit 1 fi mkdir -p "${CONTINUED}" cp -a "${PARENT}/state" "${CONTINUED}/state" cp -a "${PARENT}/70000" "${CONTINUED}/70000" cp "${PARENT}/config.json" "${CONTINUED}/parent_config_70k.json" cp "${PARENT}/dataset_statistics.json" "${CONTINUED}/parent_dataset_statistics_70k.json" cat > "${CONTINUED}/continuation.json" <<EOF{ "parent_run": "${PARENT}", "resumed_from_step": 70000, "target_step": 90000, "additional_updates": 20000, "same_source_manifests": true, "same_model_and_batch_size": true}EOFfi
STEPS=90000 RUN_NAME="${RUN_NAME}" bash "${PROJECT_ROOT}/scripts/train_multi_source_encoder.sh"test -f "${CONTINUED}/90000/_CHECKPOINT_METADATA"echo MULTI_SOURCE_90K_CONTINUATION_DONE123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657#!/usr/bin/env bashset -euo pipefail
PROJECT_ROOT="${PROJECT_ROOT:-/workspace/single_task_transfer}"PYTHON="${PROJECT_ROOT}/envs/train/bin/python"RUN_NAME="multi-source-coffee-pick-kitchen-b128-90k-cont-from-70k-seed1"RUN_DIR="${PROJECT_ROOT}/artifacts/encoders/multi_source_3task/${RUN_NAME}"THREE="multi_source_3task_90k"FOUR="multi_source_plus_coffee_d0_90k"THREE_ROOT="${PROJECT_ROOT}/artifacts/retrieval/${THREE}"mkdir -p "${THREE_ROOT}"on_exit() { status=$? if [[ ${status} -ne 0 ]]; then touch "${THREE_ROOT}/.comparison_failed"; fi}trap on_exit EXIT
for attempt in $(seq 1 240); do if [[ -f "${RUN_DIR}/.training_done" ]]; then break; fi if [[ -f "${RUN_DIR}/.training_failed" ]]; then echo "90k continuation failed" >&2 exit 1 fi sleep 60donetest -f "${RUN_DIR}/.training_done"test -f "${RUN_DIR}/90000/_CHECKPOINT_METADATA"
export JAX_PLATFORMS=cudaexport XLA_PYTHON_CLIENT_PREALLOCATE=false"${PYTHON}" "${PROJECT_ROOT}/scripts/extract_multi_source_embeddings.py" \ --run-name "${RUN_NAME}" --checkpoint-step 90000 --retrieval-name "${THREE}""${PYTHON}" "${PROJECT_ROOT}/scripts/extract_multi_source_target_embeddings.py" \ --run-name "${RUN_NAME}" --checkpoint-step 90000 --retrieval-name "${THREE}""${PYTHON}" "${PROJECT_ROOT}/scripts/score_multi_source_retrieval.py" \ --retrieval-name "${THREE}" \ --source-tasks coffee_preparation_d0 pick_place_d0 kitchen_d0
"${PYTHON}" "${PROJECT_ROOT}/scripts/analyze_multi_source_retrieval_phases.py" \ --retrieval-name "${THREE}""${PYTHON}" "${PROJECT_ROOT}/scripts/plot_multi_source_retrieval_summary.py" \ --analysis-dir "${PROJECT_ROOT}/artifacts/retrieval/${THREE}/analysis"
"${PYTHON}" "${PROJECT_ROOT}/scripts/extract_coffee_d0_source_embeddings.py" \ --run-name "${RUN_NAME}" --checkpoint-step 90000 \ --prior-retrieval-name "${THREE}" --output-retrieval-name "${FOUR}""${PYTHON}" "${PROJECT_ROOT}/scripts/score_multi_source_retrieval.py" \ --retrieval-name "${FOUR}" \ --source-tasks coffee_preparation_d0 pick_place_d0 kitchen_d0 coffee_d0"${PYTHON}" "${PROJECT_ROOT}/scripts/analyze_plus_coffee_d0_source.py" \ --old-name "${THREE}" --new-name "${FOUR}""${PYTHON}" "${PROJECT_ROOT}/scripts/plot_plus_coffee_d0_source.py" \ --analysis-dir "${PROJECT_ROOT}/artifacts/retrieval/${FOUR}/analysis"
"${PYTHON}" "${PROJECT_ROOT}/scripts/compare_multi_source_70k_90k.py"touch "${THREE_ROOT}/.comparison_done"echo MULTI_SOURCE_90K_RETRIEVAL_COMPARISON_DONE123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290#!/usr/bin/env python3"""Score BR and exact global IWR over the complete three-task source pool."""
import argparseimport csvimport hashlibimport jsonimport mathimport osfrom pathlib import Path
import jaximport jax.numpy as jnpimport numpy as npfrom jax.scipy.special import logsumexp
TASKS = ("coffee_preparation_d0", "pick_place_d0", "kitchen_d0")TARGETS = { "mug_cleanup_o1": "target_episodes.json", "hammer_cleanup_d0": "multi_hammer_cleanup_d0_episodes.json",}
def sha256(path): digest = hashlib.sha256() with path.open("rb") as stream: for block in iter(lambda: stream.read(8 * 1024 * 1024), b""): digest.update(block) return digest.hexdigest()
def atomic_npz(path, **arrays): temporary = path.with_suffix(path.suffix + ".tmp") with temporary.open("wb") as stream: np.savez_compressed(stream, **arrays) os.replace(temporary, path)
def fit_kernel(reference, bandwidth=8.0, regularization=1e-4): count, dimension = reference.shape scott = count ** (-1.0 / (dimension + 4.0)) factor = bandwidth * scott covariance = np.cov(reference, rowvar=False, dtype=np.float64) mean_variance = float(np.trace(covariance) / dimension) diagonal = regularization * max(mean_variance, 1e-12) kernel_covariance = covariance * factor**2 + diagonal * np.eye(dimension) sign, logdet = np.linalg.slogdet(kernel_covariance) if sign <= 0 or not np.isfinite(logdet): raise RuntimeError("non-positive KDE covariance") # Whitened Euclidean distances equal the full-covariance Mahalanobis # distances, but can be evaluated in bounded GPU batches by matrix multiply. cholesky = np.linalg.cholesky(kernel_covariance) whitening = np.linalg.inv(cholesky) whitened = reference.astype(np.float64) @ whitening.T normalizer = -0.5 * (dimension * np.log(2 * np.pi) + logdet) - np.log(count) metadata = { "count": count, "dimension": dimension, "scott_factor": scott, "bandwidth_multiplier": bandwidth, "covariance_factor": factor, "regularization_relative_to_mean_variance": regularization, "regularization_diagonal": diagonal, "kernel_covariance_logdet": float(logdet), } return whitened.astype(np.float32), whitening.astype(np.float32), np.float32(normalizer), metadata
def make_logpdf(reference_whitened, whitening, normalizer): reference = jnp.asarray(reference_whitened) reference_norm = jnp.sum(reference * reference, axis=1) whitening = jnp.asarray(whitening) normalizer = jnp.asarray(normalizer)
@jax.jit def score(query): q = query @ whitening.T q_norm = jnp.sum(q * q, axis=1) squared = jnp.maximum(q_norm[:, None] + reference_norm[None, :] - 2 * (q @ reference.T), 0) return logsumexp(-0.5 * squared, axis=1) + normalizer
return score
def batched_logpdf(fn, values, batch_size=128, label="KDE"): output = np.empty(len(values), dtype=np.float64) for start in range(0, len(values), batch_size): chunk = values[start : start + batch_size] valid = len(chunk) if valid < batch_size: chunk = np.concatenate((chunk, np.repeat(chunk[-1:], batch_size - valid, axis=0))) output[start : start + valid] = np.asarray(fn(jnp.asarray(chunk)))[:valid] if start % (50 * batch_size) == 0: print(label, start, len(values), flush=True) if not np.isfinite(output).all(): raise RuntimeError(f"non-finite {label} values") return output
def score_br(source, target, batch_size=512): target_device = jnp.asarray(target) target_norm = jnp.sum(target_device * target_device, axis=1)
@jax.jit def nearest(query): squared = jnp.maximum( jnp.sum(query * query, axis=1)[:, None] + target_norm[None, :] - 2 * (query @ target_device.T), 0 ) indices = jnp.argmin(squared, axis=1) distances = jnp.sqrt(jnp.take_along_axis(squared, indices[:, None], axis=1)[:, 0]) return distances, indices
distances = np.empty(len(source), dtype=np.float32) indices = np.empty(len(source), dtype=np.int32) for start in range(0, len(source), batch_size): chunk = source[start : start + batch_size] valid = len(chunk) if valid < batch_size: chunk = np.concatenate((chunk, np.repeat(chunk[-1:], batch_size - valid, axis=0))) d, i = nearest(jnp.asarray(chunk)) distances[start : start + valid] = np.asarray(d)[:valid] indices[start : start + valid] = np.asarray(i)[:valid] if start % (50 * batch_size) == 0: print("BR", start, len(source), flush=True) return distances, indices
def save_ranking(path, order, score, task_ids, ids, method, target_ids=None, nearest=None): fields = ["rank", "source_task", "source_task_id", "source_episode", "source_timestep", "score"] if nearest is not None: fields += ["query_episode", "query_timestep"] with path.open("w", newline="") as stream: writer = csv.DictWriter(stream, fieldnames=fields) writer.writeheader() for rank, index in enumerate(order, 1): index = int(index) task_id = int(task_ids[index]) row = { "rank": rank, "source_task": TASKS[task_id], "source_task_id": task_id, "source_episode": int(ids[index, 0]), "source_timestep": int(ids[index, 1]), "score": float(score[index]), } if nearest is not None: query = target_ids[int(nearest[index])] row.update(query_episode=int(query[0]), query_timestep=int(query[1])) writer.writerow(row)
def select(order, score, task_ids, ids, budget, overlap, target_ids=None, nearest=None): selected, used = [], {} for rank, index in enumerate(order, 1): index = int(index) task_id, episode, start = int(task_ids[index]), int(ids[index, 0]), int(ids[index, 1]) key = (task_id, episode) steps = set(range(start, start + 10)) if not overlap and not steps.isdisjoint(used.get(key, set())): continue row = { "rank": rank, "source_task": TASKS[task_id], "source_task_id": task_id, "source_episode": episode, "source_timestep": start, "score": float(score[index]), } if nearest is not None: query = target_ids[int(nearest[index])] row.update(query_episode=int(query[0]), query_timestep=int(query[1])) selected.append(row) used.setdefault(key, set()).update(steps) if len(selected) == budget: break if len(selected) != budget: raise RuntimeError(f"only selected {len(selected)} of {budget} clips") by_task = {task: sum(row["source_task"] == task for row in selected) for task in TASKS} return { "clip_length": 10, "clip_count": budget, "overlap_allowed": overlap, "nominal_state_action_points": budget * 10, "unique_source_timesteps": sum(len(steps) for steps in used.values()), "source_task_counts": by_task, "max_scanned_rank": selected[-1]["rank"], "clips": selected, }
def main(): global TASKS parser = argparse.ArgumentParser() parser.add_argument("--project-root", type=Path, default=Path("/workspace/single_task_transfer")) parser.add_argument("--retrieval-name", default="multi_source_3task") parser.add_argument("--source-tasks", nargs="+", default=list(TASKS)) parser.add_argument("--bandwidth", type=float, default=8.0) parser.add_argument("--regularization", type=float, default=1e-4) args = parser.parse_args() TASKS = tuple(args.source_tasks) root = args.project_root / "artifacts/retrieval" / args.retrieval_name embedding_dir = root / "embeddings" source_path = embedding_dir / "source_embeddings.npz" source = np.load(source_path) source_z = source["embeddings"].astype(np.float32) source_ids = source["ids"].astype(np.int32) source_task_ids = source["task_ids"].astype(np.int16) if source_z.shape[1] != 16 or source_ids.shape != (len(source_z), 2) or source_task_ids.shape != (len(source_z),): raise RuntimeError("bad combined source embedding shapes") if set(source_task_ids.tolist()) != set(range(len(TASKS))): raise RuntimeError("missing or unexpected source task IDs") source_hash = sha256(source_path) density_path = root / "source_logpdf_exact.npz" if density_path.exists(): cached = np.load(density_path) if cached["source_sha256"].item() != source_hash: raise RuntimeError("cached source density belongs to different embeddings") source_logpdf = cached["source_logpdf_exact"].astype(np.float64) source_kde_meta = json.loads((root / "source_kde_metadata.json").read_text()) else: source_w, source_whitening, source_norm, source_kde_meta = fit_kernel( source_z, args.bandwidth, args.regularization ) source_logpdf = batched_logpdf( make_logpdf(source_w, source_whitening, source_norm), source_z, label="SOURCE_KDE" ) atomic_npz(density_path, source_sha256=np.array(source_hash), source_logpdf_exact=source_logpdf.astype(np.float32), ids=source_ids, task_ids=source_task_ids) (root / "source_kde_metadata.json").write_text(json.dumps(source_kde_meta, indent=2, sort_keys=True) + "\n") if source_logpdf.shape != (len(source_z),): raise RuntimeError("bad source logpdf shape")
target_manifest_root = args.project_root / "data/manifests/multi_source_targets" for target_name, manifest_name in TARGETS.items(): target_path = embedding_dir / f"{target_name}_target_embeddings.npz" target = np.load(target_path) target_z = target["embeddings"].astype(np.float32) target_ids = target["ids"].astype(np.int32) manifest = json.loads((target_manifest_root / manifest_name).read_text()) budget = math.ceil(sum(int(row["timesteps"]) for row in manifest["episodes"]) / 10) target_root = root / "selections" / target_name target_root.mkdir(parents=True, exist_ok=True)
print("SCORING_BR", target_name, flush=True) br_distance, nearest = score_br(source_z, target_z) br_order = np.lexsort((source_ids[:, 1], source_ids[:, 0], source_task_ids, br_distance)) save_ranking(target_root / "br_full_ranking.csv", br_order, br_distance, source_task_ids, source_ids, "br", target_ids, nearest)
print("SCORING_IWR", target_name, flush=True) target_w, target_whitening, target_norm, target_kde_meta = fit_kernel( target_z, args.bandwidth, args.regularization ) target_logpdf = batched_logpdf( make_logpdf(target_w, target_whitening, target_norm), source_z, label=f"TARGET_KDE_{target_name}", ) log_ratio = target_logpdf - source_logpdf if not np.isfinite(log_ratio).all(): raise RuntimeError("non-finite IWR ratios") iwr_order = np.lexsort((source_ids[:, 1], source_ids[:, 0], source_task_ids, -log_ratio)) save_ranking(target_root / "iwr_full_ranking.csv", iwr_order, log_ratio, source_task_ids, source_ids, "iwr") atomic_npz(target_root / "iwr_scores.npz", ids=source_ids, task_ids=source_task_ids, source_logpdf=source_logpdf.astype(np.float32), target_logpdf=target_logpdf.astype(np.float32), log_density_ratio=log_ratio.astype(np.float32))
rng = np.random.default_rng(0) random_order = rng.permutation(len(source_z)) scores = {"br": (br_order, br_distance, target_ids, nearest), "iwr": (iwr_order, log_ratio, None, None), "random": (random_order, np.zeros(len(source_z), np.float32), None, None)} summaries = {} for method, (order, values, query_ids, nearest_index) in scores.items(): for overlap in (True, False): result = select(order, values, source_task_ids, source_ids, budget, overlap, query_ids, nearest_index) result.update(method=method, target_task=target_name, source_candidate_count=len(source_z), target_embedding_count=len(target_z)) suffix = "overlap" if overlap else "nonoverlap" (target_root / f"{method}_{suffix}.json").write_text( json.dumps(result, indent=2, sort_keys=True) + "\n" ) summaries[f"{method}_{suffix}"] = {k: v for k, v in result.items() if k != "clips"} summary = { "target_task": target_name, "source_tasks": TASKS, "source_candidates": len(source_z), "target_embeddings": len(target_z), "clip_budget": budget, "source_embedding_sha256": source_hash, "target_embedding_sha256": sha256(target_path), "br_metric": "Euclidean distance to nearest target embedding", "iwr_score": "log p_target(z) - log p_source(z)", "source_kde": source_kde_meta, "target_kde": target_kde_meta, "selections": summaries, } (target_root / "summary.json").write_text(json.dumps(summary, indent=2, sort_keys=True) + "\n") print("TARGET_SELECTIONS_DONE", target_name, budget, flush=True) print("MULTI_SOURCE_RETRIEVAL_OK", flush=True)
if __name__ == "__main__": main()123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081#!/usr/bin/env bashset -euo pipefail
PROJECT_ROOT="${PROJECT_ROOT:-/workspace/single_task_transfer}"REPO_ID="${REPO_ID:-Chand0320/single-task-transfer-artifacts}"HF_BIN="${HF_BIN:-/root/.local/bin/hf}"TOKEN_FILE="${TOKEN_FILE:-/workspace/.multi_source_90k_hf_token}"THREE="${PROJECT_ROOT}/artifacts/retrieval/multi_source_3task_90k"FOUR="${PROJECT_ROOT}/artifacts/retrieval/multi_source_plus_coffee_d0_90k"RUN_NAME="multi-source-coffee-pick-kitchen-b128-90k-cont-from-70k-seed1"RUN="${PROJECT_ROOT}/artifacts/encoders/multi_source_3task/${RUN_NAME}"EXPERIMENT="${PROJECT_ROOT}/experiments/multi_source_90k_comparison"mkdir -p "${THREE}"on_exit() { status=$? if [[ ${status} -ne 0 ]]; then touch "${THREE}/.upload_failed"; fi}trap on_exit EXIT
for attempt in $(seq 1 360); do if [[ -f "${THREE}/.comparison_done" ]]; then break; fi if [[ -f "${THREE}/.comparison_failed" ]]; then echo "90k retrieval comparison failed; upload not started" >&2 exit 1 fi sleep 60donetest -f "${THREE}/.comparison_done"test -s "${TOKEN_FILE}"test -f "${RUN}/90000/_CHECKPOINT_METADATA"mkdir -p "${EXPERIMENT}/repro" "${EXPERIMENT}/logs"cp "${PROJECT_ROOT}/docs/multi_source_90k_continuation.md" "${EXPERIMENT}/repro/"for script in resume_multi_source_encoder_to_90k.sh \ run_multi_source_90k_retrieval_when_ready.sh \ extract_multi_source_embeddings.py extract_multi_source_target_embeddings.py \ extract_coffee_d0_source_embeddings.py score_multi_source_retrieval.py \ analyze_multi_source_retrieval_phases.py plot_multi_source_retrieval_summary.py \ analyze_plus_coffee_d0_source.py plot_plus_coffee_d0_source.py \ compare_multi_source_70k_90k.py upload_multi_source_90k_when_ready.sh; do cp "${PROJECT_ROOT}/scripts/${script}" "${EXPERIMENT}/repro/${script}"donecp /workspace/multi_source_90k_train.log "${EXPERIMENT}/logs/"cp /workspace/multi_source_90k_retrieval.log "${EXPERIMENT}/logs/"sha256sum \ "${RUN}/90000/_CHECKPOINT_METADATA" \ "${THREE}/embeddings/source_embeddings.npz" \ "${THREE}/selections/mug_cleanup_o1/summary.json" \ "${THREE}/selections/hammer_cleanup_d0/summary.json" \ "${FOUR}/embeddings/source_embeddings.npz" \ "${THREE}/analysis/checkpoint_comparison.json" \ > "${EXPERIMENT}/repro/artifact_sha256.txt"
export HF_TOKEN="$(cat "${TOKEN_FILE}")"python3 - "${TOKEN_FILE}" <<'PY'from pathlib import Pathimport sysPath(sys.argv[1]).unlink()PY"${HF_BIN}" auth whoami --format quiet"${HF_BIN}" upload "${REPO_ID}" "${RUN}" \ "artifacts/encoders/multi_source_3task/${RUN_NAME}" \ --type dataset --commit-message "Add 90k SAILOR continuation checkpoint""${HF_BIN}" upload "${REPO_ID}" "${THREE}" \ artifacts/retrieval/multi_source_3task_90k \ --type dataset --commit-message "Add 90k three-source retrieval comparison""${HF_BIN}" upload "${REPO_ID}" "${FOUR}" \ artifacts/retrieval/multi_source_plus_coffee_d0_90k \ --type dataset --commit-message "Add 90k four-source retrieval comparison""${HF_BIN}" upload "${REPO_ID}" "${EXPERIMENT}" \ experiments/multi_source_90k_comparison \ --type dataset --commit-message "Add 70k versus 90k run code and logs"
for file in \ "artifacts/encoders/multi_source_3task/${RUN_NAME}/90000/_CHECKPOINT_METADATA" \ artifacts/retrieval/multi_source_3task_90k/analysis/checkpoint_comparison.json \ artifacts/retrieval/multi_source_3task_90k/analysis/task_mix_70k_vs_90k.png \ artifacts/retrieval/multi_source_plus_coffee_d0_90k/selections/mug_cleanup_o1/summary.json; do "${HF_BIN}" download "${REPO_ID}" "${file}" --type dataset --dry-run --format quiet >/dev/nulldonetouch "${THREE}/.upload_done"echo MULTI_SOURCE_90K_HF_UPLOAD_DONEexperiments/multi_source_90k_comparison/logs/multi_source_90k_retrieval.logAdded+944
experiments/multi_source_90k_comparison/logs/multi_source_90k_train.logAdded
experiments/multi_source_90k_comparison/repro/analyze_multi_source_retrieval_phases.pyAdded+200
experiments/multi_source_90k_comparison/repro/analyze_plus_coffee_d0_source.pyAdded+95
experiments/multi_source_90k_comparison/repro/artifact_sha256.txtAdded+6
experiments/multi_source_90k_comparison/repro/compare_multi_source_70k_90k.pyAdded+125
experiments/multi_source_90k_comparison/repro/extract_coffee_d0_source_embeddings.pyAdded+77
experiments/multi_source_90k_comparison/repro/extract_multi_source_embeddings.pyAdded+117
experiments/multi_source_90k_comparison/repro/extract_multi_source_target_embeddings.pyAdded+52
experiments/multi_source_90k_comparison/repro/multi_source_90k_continuation.mdAdded+33
experiments/multi_source_90k_comparison/repro/plot_multi_source_retrieval_summary.pyAdded+104
experiments/multi_source_90k_comparison/repro/plot_plus_coffee_d0_source.pyAdded+99
experiments/multi_source_90k_comparison/repro/resume_multi_source_encoder_to_90k.shAdded+37
experiments/multi_source_90k_comparison/repro/run_multi_source_90k_retrieval_when_ready.shAdded+57
experiments/multi_source_90k_comparison/repro/score_multi_source_retrieval.pyAdded+290
experiments/multi_source_90k_comparison/repro/upload_multi_source_90k_when_ready.shAdded+81