Add files using upload-large-folder tool
Browse files- code/reveal_vla_bimanual/sim_rlbench/__pycache__/dataset.cpython-310.pyc +0 -0
- code/reveal_vla_bimanual/sim_rlbench/__pycache__/launch_smoke.cpython-310.pyc +0 -0
- code/reveal_vla_bimanual/sim_rlbench/__pycache__/obs_adapter.cpython-310.pyc +0 -0
- code/reveal_vla_bimanual/sim_rlbench/__pycache__/obs_config.cpython-310.pyc +0 -0
- code/reveal_vla_bimanual/sim_rlbench/__pycache__/peract2_runner.cpython-310.pyc +0 -0
- code/reveal_vla_bimanual/sim_rlbench/__pycache__/smoke_test.cpython-310.pyc +0 -0
- code/reveal_vla_bimanual/sim_rlbench/__pycache__/task_resolver.cpython-310.pyc +0 -0
- code/reveal_vla_bimanual/sim_rlbench/__pycache__/task_splits.cpython-310.pyc +0 -0
- code/reveal_vla_bimanual/sim_rlbench/launch_smoke.py +4 -1
- code/reveal_vla_bimanual/sim_rlbench/task_resolver.py +4 -0
- code/reveal_vla_bimanual/train/__pycache__/__init__.cpython-310.pyc +0 -0
- code/reveal_vla_bimanual/train/__pycache__/__init__.cpython-311.pyc +0 -0
- code/reveal_vla_bimanual/train/__pycache__/losses.cpython-310.pyc +0 -0
- code/reveal_vla_bimanual/train/__pycache__/losses.cpython-311.pyc +0 -0
- code/reveal_vla_bimanual/train/__pycache__/run_experiment.cpython-311.pyc +0 -0
- code/reveal_vla_bimanual/train/__pycache__/smoke_checks.cpython-311.pyc +0 -0
- code/reveal_vla_bimanual/train/__pycache__/trainer.cpython-310.pyc +0 -0
- code/reveal_vla_bimanual/train/__pycache__/trainer.cpython-311.pyc +0 -0
- code/reveal_vla_bimanual/train/configs/proxy_interaction_r3d_ablation_nodepth.yaml +16 -0
- code/reveal_vla_bimanual/train/configs/proxy_interaction_r3d_ablation_noplanner.yaml +16 -0
- code/reveal_vla_bimanual/train/configs/proxy_interaction_r3d_ablation_norolesym.yaml +16 -0
- code/reveal_vla_bimanual/train/configs/proxy_interaction_r3d_ablation_nowm.yaml +16 -0
- code/reveal_vla_bimanual/train/configs/proxy_interaction_r3d_stage1_clip.yaml +72 -0
- code/reveal_vla_bimanual/train/configs/proxy_interaction_r3d_stage1_dummy.yaml +75 -0
- code/reveal_vla_bimanual/train/configs/proxy_interaction_r3d_stage2_clip.yaml +18 -0
- code/reveal_vla_bimanual/train/configs/proxy_interaction_r3d_stage2_dummy.yaml +17 -0
- code/reveal_vla_bimanual/train/configs/proxy_interaction_r3d_stage3_clip_rgbd.yaml +18 -0
- code/reveal_vla_bimanual/train/losses.py +178 -13
- code/reveal_vla_bimanual/train/run_experiment.py +54 -0
- code/reveal_vla_bimanual/train/smoke_checks.py +79 -4
- code/reveal_vla_bimanual/train/trainer.py +31 -2
- tests/__pycache__/test_dual_memory_contract.cpython-311-pytest-9.0.2.pyc +0 -0
code/reveal_vla_bimanual/sim_rlbench/__pycache__/dataset.cpython-310.pyc
CHANGED
|
Binary files a/code/reveal_vla_bimanual/sim_rlbench/__pycache__/dataset.cpython-310.pyc and b/code/reveal_vla_bimanual/sim_rlbench/__pycache__/dataset.cpython-310.pyc differ
|
|
|
code/reveal_vla_bimanual/sim_rlbench/__pycache__/launch_smoke.cpython-310.pyc
CHANGED
|
Binary files a/code/reveal_vla_bimanual/sim_rlbench/__pycache__/launch_smoke.cpython-310.pyc and b/code/reveal_vla_bimanual/sim_rlbench/__pycache__/launch_smoke.cpython-310.pyc differ
|
|
|
code/reveal_vla_bimanual/sim_rlbench/__pycache__/obs_adapter.cpython-310.pyc
CHANGED
|
Binary files a/code/reveal_vla_bimanual/sim_rlbench/__pycache__/obs_adapter.cpython-310.pyc and b/code/reveal_vla_bimanual/sim_rlbench/__pycache__/obs_adapter.cpython-310.pyc differ
|
|
|
code/reveal_vla_bimanual/sim_rlbench/__pycache__/obs_config.cpython-310.pyc
ADDED
|
Binary file (1.26 kB). View file
|
|
|
code/reveal_vla_bimanual/sim_rlbench/__pycache__/peract2_runner.cpython-310.pyc
CHANGED
|
Binary files a/code/reveal_vla_bimanual/sim_rlbench/__pycache__/peract2_runner.cpython-310.pyc and b/code/reveal_vla_bimanual/sim_rlbench/__pycache__/peract2_runner.cpython-310.pyc differ
|
|
|
code/reveal_vla_bimanual/sim_rlbench/__pycache__/smoke_test.cpython-310.pyc
CHANGED
|
Binary files a/code/reveal_vla_bimanual/sim_rlbench/__pycache__/smoke_test.cpython-310.pyc and b/code/reveal_vla_bimanual/sim_rlbench/__pycache__/smoke_test.cpython-310.pyc differ
|
|
|
code/reveal_vla_bimanual/sim_rlbench/__pycache__/task_resolver.cpython-310.pyc
ADDED
|
Binary file (698 Bytes). View file
|
|
|
code/reveal_vla_bimanual/sim_rlbench/__pycache__/task_splits.cpython-310.pyc
CHANGED
|
Binary files a/code/reveal_vla_bimanual/sim_rlbench/__pycache__/task_splits.cpython-310.pyc and b/code/reveal_vla_bimanual/sim_rlbench/__pycache__/task_splits.cpython-310.pyc differ
|
|
|
code/reveal_vla_bimanual/sim_rlbench/launch_smoke.py
CHANGED
|
@@ -72,7 +72,8 @@ def main() -> None:
|
|
| 72 |
env.launch()
|
| 73 |
task = env.get_task(task_cls)
|
| 74 |
descriptions, obs = task.reset()
|
| 75 |
-
|
|
|
|
| 76 |
payload = {
|
| 77 |
"display": args.display or os.environ.get("DISPLAY"),
|
| 78 |
"headless": headless,
|
|
@@ -84,6 +85,8 @@ def main() -> None:
|
|
| 84 |
"right_pose_shape": list(obs.right.gripper_pose.shape),
|
| 85 |
"left_pose_shape": list(obs.left.gripper_pose.shape),
|
| 86 |
"stepped_mode": "bimanual_noop",
|
|
|
|
|
|
|
| 87 |
"reward": float(reward),
|
| 88 |
"done": bool(done),
|
| 89 |
"front_rgb_shape_after_step": _camera_shape(next_obs, "front"),
|
|
|
|
| 72 |
env.launch()
|
| 73 |
task = env.get_task(task_cls)
|
| 74 |
descriptions, obs = task.reset()
|
| 75 |
+
noop_action = _noop_bimanual_action(obs)
|
| 76 |
+
next_obs, reward, done = task.step(noop_action)
|
| 77 |
payload = {
|
| 78 |
"display": args.display or os.environ.get("DISPLAY"),
|
| 79 |
"headless": headless,
|
|
|
|
| 85 |
"right_pose_shape": list(obs.right.gripper_pose.shape),
|
| 86 |
"left_pose_shape": list(obs.left.gripper_pose.shape),
|
| 87 |
"stepped_mode": "bimanual_noop",
|
| 88 |
+
"action_finite": bool(np.isfinite(noop_action).all()),
|
| 89 |
+
"action_dim": int(noop_action.shape[0]),
|
| 90 |
"reward": float(reward),
|
| 91 |
"done": bool(done),
|
| 92 |
"front_rgb_shape_after_step": _camera_shape(next_obs, "front"),
|
code/reveal_vla_bimanual/sim_rlbench/task_resolver.py
CHANGED
|
@@ -8,4 +8,8 @@ def is_bimanual_task_name(task_name: str) -> bool:
|
|
| 8 |
|
| 9 |
|
| 10 |
def resolve_task_class(task_name: str):
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
return task_file_to_task_class(task_name, bimanual=is_bimanual_task_name(task_name))
|
|
|
|
| 8 |
|
| 9 |
|
| 10 |
def resolve_task_class(task_name: str):
|
| 11 |
+
if task_name == "open_drawer":
|
| 12 |
+
# The dual-panda RLBench fork provides dedicated bimanual drawer tasks.
|
| 13 |
+
# Route the generic smoke/rollout task name to the compatible variant.
|
| 14 |
+
return task_file_to_task_class("right_open_drawer", bimanual=True)
|
| 15 |
return task_file_to_task_class(task_name, bimanual=is_bimanual_task_name(task_name))
|
code/reveal_vla_bimanual/train/__pycache__/__init__.cpython-310.pyc
CHANGED
|
Binary files a/code/reveal_vla_bimanual/train/__pycache__/__init__.cpython-310.pyc and b/code/reveal_vla_bimanual/train/__pycache__/__init__.cpython-310.pyc differ
|
|
|
code/reveal_vla_bimanual/train/__pycache__/__init__.cpython-311.pyc
CHANGED
|
Binary files a/code/reveal_vla_bimanual/train/__pycache__/__init__.cpython-311.pyc and b/code/reveal_vla_bimanual/train/__pycache__/__init__.cpython-311.pyc differ
|
|
|
code/reveal_vla_bimanual/train/__pycache__/losses.cpython-310.pyc
CHANGED
|
Binary files a/code/reveal_vla_bimanual/train/__pycache__/losses.cpython-310.pyc and b/code/reveal_vla_bimanual/train/__pycache__/losses.cpython-310.pyc differ
|
|
|
code/reveal_vla_bimanual/train/__pycache__/losses.cpython-311.pyc
CHANGED
|
Binary files a/code/reveal_vla_bimanual/train/__pycache__/losses.cpython-311.pyc and b/code/reveal_vla_bimanual/train/__pycache__/losses.cpython-311.pyc differ
|
|
|
code/reveal_vla_bimanual/train/__pycache__/run_experiment.cpython-311.pyc
CHANGED
|
Binary files a/code/reveal_vla_bimanual/train/__pycache__/run_experiment.cpython-311.pyc and b/code/reveal_vla_bimanual/train/__pycache__/run_experiment.cpython-311.pyc differ
|
|
|
code/reveal_vla_bimanual/train/__pycache__/smoke_checks.cpython-311.pyc
ADDED
|
Binary file (18.6 kB). View file
|
|
|
code/reveal_vla_bimanual/train/__pycache__/trainer.cpython-310.pyc
CHANGED
|
Binary files a/code/reveal_vla_bimanual/train/__pycache__/trainer.cpython-310.pyc and b/code/reveal_vla_bimanual/train/__pycache__/trainer.cpython-310.pyc differ
|
|
|
code/reveal_vla_bimanual/train/__pycache__/trainer.cpython-311.pyc
CHANGED
|
Binary files a/code/reveal_vla_bimanual/train/__pycache__/trainer.cpython-311.pyc and b/code/reveal_vla_bimanual/train/__pycache__/trainer.cpython-311.pyc differ
|
|
|
code/reveal_vla_bimanual/train/configs/proxy_interaction_r3d_ablation_nodepth.yaml
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
experiment_name: proxy_interaction_r3d_ablation_nodepth
|
| 2 |
+
output_dir: /workspace/VLAarchtests/artifacts/outputs/r3d
|
| 3 |
+
device: cuda
|
| 4 |
+
seed: 17
|
| 5 |
+
data: {proxies: [foliage_proxy, bag_proxy, cloth_proxy], resolution: 224, dataset_version: reveal_proxy_v6_rgbd_elastic_state, train_episodes_per_proxy: 48, val_episodes_per_proxy: 16, train_dataset_path: /workspace/VLAarchtests/artifacts/data/reveal_proxy/proxy_train_clip224_v6_rgbd_stage3.pt, val_dataset_path: /workspace/VLAarchtests/artifacts/data/reveal_proxy/proxy_val_clip224_v6_rgbd_stage3.pt, rebuild_dataset: false, chunk_horizon: 8, rollout_horizon: 5, history_steps: 6, planner_candidates: 8, seed: 17}
|
| 6 |
+
optim: {epochs: 4, batch_size: 2, num_workers: 0, lr: 0.0003, weight_decay: 0.0001}
|
| 7 |
+
trainer: {policy_type: elastic_reveal, use_bf16: true, grad_clip_norm: 1.0, freeze_backbone: true, gradient_checkpointing: false, plan_during_train: true, plan_during_eval: true, support_mode_conditioning: true, planner_mode: trainable, use_depth: false, use_world_model: true, use_role_tokens: true, compute_equivariance_probe: true}
|
| 8 |
+
policy:
|
| 9 |
+
backbone: {model_name: openai/clip-vit-base-patch32, hidden_dim: 512, max_text_tokens: 32, freeze_backbone: true, gradient_checkpointing: false, use_dummy_backbone: false}
|
| 10 |
+
fusion: {hidden_dim: 512, num_cameras: 3, num_layers: 4, num_heads: 8, ff_dim: 2048, dropout: 0.1, proprio_dim: 32, proprio_tokens: 1}
|
| 11 |
+
memory: {hidden_dim: 512, action_dim: 14, history_steps: 6, scene_history_steps: 3, belief_history_steps: 8, num_layers: 2, dropout: 0.1, memory_bank_size: 4, scene_bank_size: 2, belief_bank_size: 2, num_heads: 8, max_history_steps: 8}
|
| 12 |
+
decoder: {hidden_dim: 512, num_heads: 8, num_layers: 4, ff_dim: 2048, dropout: 0.1, chunk_size: 8, action_dim: 14, arm_action_dim: 7, num_candidates: 8, num_phases: 5, num_arm_roles: 4, num_proposal_modes: 6, planner_top_k: 4}
|
| 13 |
+
reveal_head: {hidden_dim: 512, num_support_modes: 3, num_approach_templates: 32, rollout_horizon: 5, belief_map_size: 32, field_size: 16, num_heads: 8, predict_belief_map: true, num_phases: 5, num_arm_roles: 4, num_interaction_tokens: 8}
|
| 14 |
+
world_model: {hidden_dim: 512, action_dim: 14, num_support_modes: 3, num_approach_templates: 32, rollout_horizon: 5, field_size: 16, num_heads: 8, num_phases: 5, num_arm_roles: 4, num_interaction_tokens: 8, belief_map_size: 32, predict_belief_map: true, scene_bank_size: 2, belief_bank_size: 2}
|
| 15 |
+
planner: {hidden_dim: 512, num_candidates: 8, action_dim: 14, num_support_modes: 3, utility_margin: 0.1, num_heads: 8, num_layers: 2, num_phases: 5, num_arm_roles: 4, top_k: 4}
|
| 16 |
+
loss_weights: {action: 1.0, phase: 0.1, arm_role: 0.15, support_mode: 0.1, corridor: 0.15, persistence: 0.05, disturbance: 0.05, world_model: 0.25, belief: 0.05, visibility: 0.05, clearance: 0.05, support_stability: 0.05, reocclusion: 0.05, occluder_contact: 0.05, grasp_affordance: 0.05, planner_success: 0.25, planner_risk: 0.1, planner_ranking: 0.2, proposal_reconstruction: 0.1, proposal_success: 0.15, proposal_ranking: 0.2, proposal_diversity: 0.05, role_swap_consistency: 0.05}
|
code/reveal_vla_bimanual/train/configs/proxy_interaction_r3d_ablation_noplanner.yaml
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
experiment_name: proxy_interaction_r3d_ablation_noplanner
|
| 2 |
+
output_dir: /workspace/VLAarchtests/artifacts/outputs/r3d
|
| 3 |
+
device: cuda
|
| 4 |
+
seed: 17
|
| 5 |
+
data: {proxies: [foliage_proxy, bag_proxy, cloth_proxy], resolution: 96, dataset_version: reveal_proxy_v6_rgbd_elastic_state, train_episodes_per_proxy: 48, val_episodes_per_proxy: 16, train_dataset_path: /workspace/VLAarchtests/artifacts/data/reveal_proxy/proxy_train_v6_rgbd_stage2_dummy.pt, val_dataset_path: /workspace/VLAarchtests/artifacts/data/reveal_proxy/proxy_val_v6_rgbd_stage2_dummy.pt, rebuild_dataset: false, chunk_horizon: 8, rollout_horizon: 5, history_steps: 6, planner_candidates: 8, seed: 17}
|
| 6 |
+
optim: {epochs: 10, batch_size: 16, num_workers: 0, lr: 0.001, weight_decay: 0.0001}
|
| 7 |
+
trainer: {policy_type: elastic_reveal, use_bf16: false, grad_clip_norm: 1.0, freeze_backbone: true, gradient_checkpointing: false, plan_during_train: false, plan_during_eval: false, support_mode_conditioning: true, planner_mode: off, use_depth: false, use_world_model: true, use_role_tokens: true, compute_equivariance_probe: true}
|
| 8 |
+
policy:
|
| 9 |
+
backbone: {model_name: openai/clip-vit-base-patch32, hidden_dim: 192, max_text_tokens: 32, freeze_backbone: true, gradient_checkpointing: false, use_dummy_backbone: true}
|
| 10 |
+
fusion: {hidden_dim: 192, num_cameras: 3, num_layers: 2, num_heads: 4, ff_dim: 384, dropout: 0.1, proprio_dim: 32, proprio_tokens: 1}
|
| 11 |
+
memory: {hidden_dim: 192, action_dim: 14, history_steps: 6, scene_history_steps: 3, belief_history_steps: 8, num_layers: 2, dropout: 0.1, memory_bank_size: 4, scene_bank_size: 2, belief_bank_size: 2, num_heads: 4, max_history_steps: 8}
|
| 12 |
+
decoder: {hidden_dim: 192, num_heads: 4, num_layers: 2, ff_dim: 384, dropout: 0.1, chunk_size: 8, action_dim: 14, arm_action_dim: 7, num_candidates: 8, num_phases: 5, num_arm_roles: 4, num_proposal_modes: 6, planner_top_k: 4}
|
| 13 |
+
reveal_head: {hidden_dim: 192, num_support_modes: 3, num_approach_templates: 32, rollout_horizon: 5, belief_map_size: 32, field_size: 16, num_heads: 4, predict_belief_map: true, num_phases: 5, num_arm_roles: 4, num_interaction_tokens: 8}
|
| 14 |
+
world_model: {hidden_dim: 192, action_dim: 14, num_support_modes: 3, num_approach_templates: 32, rollout_horizon: 5, field_size: 16, num_heads: 4, num_phases: 5, num_arm_roles: 4, num_interaction_tokens: 8, belief_map_size: 32, predict_belief_map: true, scene_bank_size: 2, belief_bank_size: 2}
|
| 15 |
+
planner: {hidden_dim: 192, num_candidates: 8, action_dim: 14, num_support_modes: 3, utility_margin: 0.1, num_heads: 4, num_layers: 2, num_phases: 5, num_arm_roles: 4, top_k: 4}
|
| 16 |
+
loss_weights: {action: 1.0}
|
code/reveal_vla_bimanual/train/configs/proxy_interaction_r3d_ablation_norolesym.yaml
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
experiment_name: proxy_interaction_r3d_ablation_norolesym
|
| 2 |
+
output_dir: /workspace/VLAarchtests/artifacts/outputs/r3d
|
| 3 |
+
device: cuda
|
| 4 |
+
seed: 17
|
| 5 |
+
data: {proxies: [foliage_proxy, bag_proxy, cloth_proxy], resolution: 96, dataset_version: reveal_proxy_v6_rgbd_elastic_state, train_episodes_per_proxy: 48, val_episodes_per_proxy: 16, train_dataset_path: /workspace/VLAarchtests/artifacts/data/reveal_proxy/proxy_train_v6_rgbd_stage2_dummy.pt, val_dataset_path: /workspace/VLAarchtests/artifacts/data/reveal_proxy/proxy_val_v6_rgbd_stage2_dummy.pt, rebuild_dataset: false, chunk_horizon: 8, rollout_horizon: 5, history_steps: 6, planner_candidates: 8, seed: 17}
|
| 6 |
+
optim: {epochs: 10, batch_size: 16, num_workers: 0, lr: 0.001, weight_decay: 0.0001}
|
| 7 |
+
trainer: {policy_type: elastic_reveal, use_bf16: false, grad_clip_norm: 1.0, freeze_backbone: true, gradient_checkpointing: false, plan_during_train: true, plan_during_eval: true, support_mode_conditioning: true, planner_mode: trainable, use_depth: false, use_world_model: true, use_role_tokens: false, compute_equivariance_probe: false}
|
| 8 |
+
policy:
|
| 9 |
+
backbone: {model_name: openai/clip-vit-base-patch32, hidden_dim: 192, max_text_tokens: 32, freeze_backbone: true, gradient_checkpointing: false, use_dummy_backbone: true}
|
| 10 |
+
fusion: {hidden_dim: 192, num_cameras: 3, num_layers: 2, num_heads: 4, ff_dim: 384, dropout: 0.1, proprio_dim: 32, proprio_tokens: 1}
|
| 11 |
+
memory: {hidden_dim: 192, action_dim: 14, history_steps: 6, scene_history_steps: 3, belief_history_steps: 8, num_layers: 2, dropout: 0.1, memory_bank_size: 4, scene_bank_size: 2, belief_bank_size: 2, num_heads: 4, max_history_steps: 8}
|
| 12 |
+
decoder: {hidden_dim: 192, num_heads: 4, num_layers: 2, ff_dim: 384, dropout: 0.1, chunk_size: 8, action_dim: 14, arm_action_dim: 7, num_candidates: 8, num_phases: 5, num_arm_roles: 4, num_proposal_modes: 6, planner_top_k: 4}
|
| 13 |
+
reveal_head: {hidden_dim: 192, num_support_modes: 3, num_approach_templates: 32, rollout_horizon: 5, belief_map_size: 32, field_size: 16, num_heads: 4, predict_belief_map: true, num_phases: 5, num_arm_roles: 4, num_interaction_tokens: 8}
|
| 14 |
+
world_model: {hidden_dim: 192, action_dim: 14, num_support_modes: 3, num_approach_templates: 32, rollout_horizon: 5, field_size: 16, num_heads: 4, num_phases: 5, num_arm_roles: 4, num_interaction_tokens: 8, belief_map_size: 32, predict_belief_map: true, scene_bank_size: 2, belief_bank_size: 2}
|
| 15 |
+
planner: {hidden_dim: 192, num_candidates: 8, action_dim: 14, num_support_modes: 3, utility_margin: 0.1, num_heads: 4, num_layers: 2, num_phases: 5, num_arm_roles: 4, top_k: 4}
|
| 16 |
+
loss_weights: {action: 1.0}
|
code/reveal_vla_bimanual/train/configs/proxy_interaction_r3d_ablation_nowm.yaml
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
experiment_name: proxy_interaction_r3d_ablation_nowm
|
| 2 |
+
output_dir: /workspace/VLAarchtests/artifacts/outputs/r3d
|
| 3 |
+
device: cuda
|
| 4 |
+
seed: 17
|
| 5 |
+
data: {proxies: [foliage_proxy, bag_proxy, cloth_proxy], resolution: 96, dataset_version: reveal_proxy_v6_rgbd_elastic_state, train_episodes_per_proxy: 48, val_episodes_per_proxy: 16, train_dataset_path: /workspace/VLAarchtests/artifacts/data/reveal_proxy/proxy_train_v6_rgbd_stage2_dummy.pt, val_dataset_path: /workspace/VLAarchtests/artifacts/data/reveal_proxy/proxy_val_v6_rgbd_stage2_dummy.pt, rebuild_dataset: false, chunk_horizon: 8, rollout_horizon: 5, history_steps: 6, planner_candidates: 8, seed: 17}
|
| 6 |
+
optim: {epochs: 10, batch_size: 16, num_workers: 0, lr: 0.001, weight_decay: 0.0001}
|
| 7 |
+
trainer: {policy_type: elastic_reveal, use_bf16: false, grad_clip_norm: 1.0, freeze_backbone: true, gradient_checkpointing: false, plan_during_train: true, plan_during_eval: true, support_mode_conditioning: true, planner_mode: trainable, use_depth: false, use_world_model: false, use_role_tokens: true, compute_equivariance_probe: true}
|
| 8 |
+
policy:
|
| 9 |
+
backbone: {model_name: openai/clip-vit-base-patch32, hidden_dim: 192, max_text_tokens: 32, freeze_backbone: true, gradient_checkpointing: false, use_dummy_backbone: true}
|
| 10 |
+
fusion: {hidden_dim: 192, num_cameras: 3, num_layers: 2, num_heads: 4, ff_dim: 384, dropout: 0.1, proprio_dim: 32, proprio_tokens: 1}
|
| 11 |
+
memory: {hidden_dim: 192, action_dim: 14, history_steps: 6, scene_history_steps: 3, belief_history_steps: 8, num_layers: 2, dropout: 0.1, memory_bank_size: 4, scene_bank_size: 2, belief_bank_size: 2, num_heads: 4, max_history_steps: 8}
|
| 12 |
+
decoder: {hidden_dim: 192, num_heads: 4, num_layers: 2, ff_dim: 384, dropout: 0.1, chunk_size: 8, action_dim: 14, arm_action_dim: 7, num_candidates: 8, num_phases: 5, num_arm_roles: 4, num_proposal_modes: 6, planner_top_k: 4}
|
| 13 |
+
reveal_head: {hidden_dim: 192, num_support_modes: 3, num_approach_templates: 32, rollout_horizon: 5, belief_map_size: 32, field_size: 16, num_heads: 4, predict_belief_map: true, num_phases: 5, num_arm_roles: 4, num_interaction_tokens: 8}
|
| 14 |
+
world_model: {hidden_dim: 192, action_dim: 14, num_support_modes: 3, num_approach_templates: 32, rollout_horizon: 5, field_size: 16, num_heads: 4, num_phases: 5, num_arm_roles: 4, num_interaction_tokens: 8, belief_map_size: 32, predict_belief_map: true, scene_bank_size: 2, belief_bank_size: 2}
|
| 15 |
+
planner: {hidden_dim: 192, num_candidates: 8, action_dim: 14, num_support_modes: 3, utility_margin: 0.1, num_heads: 4, num_layers: 2, num_phases: 5, num_arm_roles: 4, top_k: 4}
|
| 16 |
+
loss_weights: {action: 1.0}
|
code/reveal_vla_bimanual/train/configs/proxy_interaction_r3d_stage1_clip.yaml
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
experiment_name: proxy_interaction_r3d_stage1_clip
|
| 2 |
+
output_dir: /workspace/VLAarchtests/artifacts/outputs/r3d
|
| 3 |
+
device: cuda
|
| 4 |
+
seed: 7
|
| 5 |
+
init_checkpoint: /workspace/VLAarchtests/artifacts/outputs/reveal_runs/proxy_backbone_only_clip/checkpoint_best.pt
|
| 6 |
+
init_strict: false
|
| 7 |
+
|
| 8 |
+
data:
|
| 9 |
+
proxies: [foliage_proxy, bag_proxy, cloth_proxy]
|
| 10 |
+
resolution: 224
|
| 11 |
+
dataset_version: reveal_proxy_v6_rgbd_elastic_state
|
| 12 |
+
train_episodes_per_proxy: 48
|
| 13 |
+
val_episodes_per_proxy: 16
|
| 14 |
+
train_dataset_path: /workspace/VLAarchtests/artifacts/data/reveal_proxy/proxy_train_clip224_v6_rgbd_stage1.pt
|
| 15 |
+
val_dataset_path: /workspace/VLAarchtests/artifacts/data/reveal_proxy/proxy_val_clip224_v6_rgbd_stage1.pt
|
| 16 |
+
rebuild_dataset: false
|
| 17 |
+
chunk_horizon: 8
|
| 18 |
+
rollout_horizon: 5
|
| 19 |
+
history_steps: 6
|
| 20 |
+
planner_candidates: 8
|
| 21 |
+
seed: 7
|
| 22 |
+
|
| 23 |
+
optim: {epochs: 4, batch_size: 2, num_workers: 4, lr: 0.0003, weight_decay: 0.0001}
|
| 24 |
+
|
| 25 |
+
trainer:
|
| 26 |
+
policy_type: elastic_reveal
|
| 27 |
+
use_bf16: true
|
| 28 |
+
grad_clip_norm: 1.0
|
| 29 |
+
freeze_backbone: true
|
| 30 |
+
gradient_checkpointing: false
|
| 31 |
+
plan_during_train: true
|
| 32 |
+
plan_during_eval: true
|
| 33 |
+
support_mode_conditioning: true
|
| 34 |
+
planner_mode: trainable
|
| 35 |
+
use_depth: false
|
| 36 |
+
use_world_model: true
|
| 37 |
+
use_role_tokens: true
|
| 38 |
+
compute_equivariance_probe: true
|
| 39 |
+
|
| 40 |
+
policy:
|
| 41 |
+
backbone: {model_name: openai/clip-vit-base-patch32, hidden_dim: 512, max_text_tokens: 32, freeze_backbone: true, gradient_checkpointing: false, use_dummy_backbone: false}
|
| 42 |
+
fusion: {hidden_dim: 512, num_cameras: 3, num_layers: 4, num_heads: 8, ff_dim: 2048, dropout: 0.1, proprio_dim: 32, proprio_tokens: 1}
|
| 43 |
+
memory: {hidden_dim: 512, action_dim: 14, history_steps: 6, scene_history_steps: 3, belief_history_steps: 8, num_layers: 2, dropout: 0.1, memory_bank_size: 4, scene_bank_size: 2, belief_bank_size: 2, num_heads: 8, max_history_steps: 8}
|
| 44 |
+
decoder: {hidden_dim: 512, num_heads: 8, num_layers: 4, ff_dim: 2048, dropout: 0.1, chunk_size: 8, action_dim: 14, arm_action_dim: 7, num_candidates: 8, num_phases: 5, num_arm_roles: 4, num_proposal_modes: 6, planner_top_k: 4}
|
| 45 |
+
reveal_head: {hidden_dim: 512, num_support_modes: 3, num_approach_templates: 32, rollout_horizon: 5, belief_map_size: 32, field_size: 16, num_heads: 8, predict_belief_map: true, num_phases: 5, num_arm_roles: 4, num_interaction_tokens: 8}
|
| 46 |
+
world_model: {hidden_dim: 512, action_dim: 14, num_support_modes: 3, num_approach_templates: 32, rollout_horizon: 5, field_size: 16, num_heads: 8, num_phases: 5, num_arm_roles: 4, num_interaction_tokens: 8, belief_map_size: 32, predict_belief_map: true, scene_bank_size: 2, belief_bank_size: 2}
|
| 47 |
+
planner: {hidden_dim: 512, num_candidates: 8, action_dim: 14, num_support_modes: 3, utility_margin: 0.1, num_heads: 8, num_layers: 2, num_phases: 5, num_arm_roles: 4, top_k: 4}
|
| 48 |
+
|
| 49 |
+
loss_weights:
|
| 50 |
+
action: 1.0
|
| 51 |
+
phase: 0.1
|
| 52 |
+
arm_role: 0.15
|
| 53 |
+
support_mode: 0.1
|
| 54 |
+
corridor: 0.15
|
| 55 |
+
persistence: 0.05
|
| 56 |
+
disturbance: 0.05
|
| 57 |
+
world_model: 0.2
|
| 58 |
+
belief: 0.05
|
| 59 |
+
visibility: 0.05
|
| 60 |
+
clearance: 0.05
|
| 61 |
+
support_stability: 0.05
|
| 62 |
+
reocclusion: 0.05
|
| 63 |
+
occluder_contact: 0.05
|
| 64 |
+
grasp_affordance: 0.05
|
| 65 |
+
planner_success: 0.25
|
| 66 |
+
planner_risk: 0.1
|
| 67 |
+
planner_ranking: 0.2
|
| 68 |
+
proposal_reconstruction: 0.1
|
| 69 |
+
proposal_success: 0.15
|
| 70 |
+
proposal_ranking: 0.2
|
| 71 |
+
proposal_diversity: 0.05
|
| 72 |
+
role_swap_consistency: 0.05
|
code/reveal_vla_bimanual/train/configs/proxy_interaction_r3d_stage1_dummy.yaml
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
experiment_name: proxy_interaction_r3d_stage1_dummy
|
| 2 |
+
output_dir: /workspace/VLAarchtests/artifacts/outputs/r3d
|
| 3 |
+
device: cuda
|
| 4 |
+
seed: 13
|
| 5 |
+
|
| 6 |
+
data:
|
| 7 |
+
proxies: [foliage_proxy, bag_proxy, cloth_proxy]
|
| 8 |
+
resolution: 96
|
| 9 |
+
dataset_version: reveal_proxy_v6_rgbd_elastic_state
|
| 10 |
+
train_episodes_per_proxy: 48
|
| 11 |
+
val_episodes_per_proxy: 16
|
| 12 |
+
train_dataset_path: /workspace/VLAarchtests/artifacts/data/reveal_proxy/proxy_train_v6_rgbd_stage1_dummy.pt
|
| 13 |
+
val_dataset_path: /workspace/VLAarchtests/artifacts/data/reveal_proxy/proxy_val_v6_rgbd_stage1_dummy.pt
|
| 14 |
+
rebuild_dataset: false
|
| 15 |
+
chunk_horizon: 8
|
| 16 |
+
rollout_horizon: 5
|
| 17 |
+
history_steps: 6
|
| 18 |
+
planner_candidates: 8
|
| 19 |
+
seed: 13
|
| 20 |
+
|
| 21 |
+
optim:
|
| 22 |
+
epochs: 4
|
| 23 |
+
batch_size: 16
|
| 24 |
+
num_workers: 4
|
| 25 |
+
lr: 0.001
|
| 26 |
+
weight_decay: 0.0001
|
| 27 |
+
|
| 28 |
+
trainer:
|
| 29 |
+
policy_type: elastic_reveal
|
| 30 |
+
use_bf16: false
|
| 31 |
+
grad_clip_norm: 1.0
|
| 32 |
+
freeze_backbone: true
|
| 33 |
+
gradient_checkpointing: false
|
| 34 |
+
plan_during_train: true
|
| 35 |
+
plan_during_eval: true
|
| 36 |
+
support_mode_conditioning: true
|
| 37 |
+
planner_mode: trainable
|
| 38 |
+
use_depth: false
|
| 39 |
+
use_world_model: true
|
| 40 |
+
use_role_tokens: true
|
| 41 |
+
compute_equivariance_probe: true
|
| 42 |
+
|
| 43 |
+
policy:
|
| 44 |
+
backbone: {model_name: openai/clip-vit-base-patch32, hidden_dim: 192, max_text_tokens: 32, freeze_backbone: true, gradient_checkpointing: false, use_dummy_backbone: true}
|
| 45 |
+
fusion: {hidden_dim: 192, num_cameras: 3, num_layers: 2, num_heads: 4, ff_dim: 384, dropout: 0.1, proprio_dim: 32, proprio_tokens: 1}
|
| 46 |
+
memory: {hidden_dim: 192, action_dim: 14, history_steps: 6, scene_history_steps: 3, belief_history_steps: 8, num_layers: 2, dropout: 0.1, memory_bank_size: 4, scene_bank_size: 2, belief_bank_size: 2, num_heads: 4, max_history_steps: 8}
|
| 47 |
+
decoder: {hidden_dim: 192, num_heads: 4, num_layers: 2, ff_dim: 384, dropout: 0.1, chunk_size: 8, action_dim: 14, arm_action_dim: 7, num_candidates: 8, num_phases: 5, num_arm_roles: 4, num_proposal_modes: 6, planner_top_k: 4}
|
| 48 |
+
reveal_head: {hidden_dim: 192, num_support_modes: 3, num_approach_templates: 32, rollout_horizon: 5, belief_map_size: 32, field_size: 16, num_heads: 4, predict_belief_map: true, num_phases: 5, num_arm_roles: 4, num_interaction_tokens: 8}
|
| 49 |
+
world_model: {hidden_dim: 192, action_dim: 14, num_support_modes: 3, num_approach_templates: 32, rollout_horizon: 5, field_size: 16, num_heads: 4, num_phases: 5, num_arm_roles: 4, num_interaction_tokens: 8, belief_map_size: 32, predict_belief_map: true, scene_bank_size: 2, belief_bank_size: 2}
|
| 50 |
+
planner: {hidden_dim: 192, num_candidates: 8, action_dim: 14, num_support_modes: 3, utility_margin: 0.1, num_heads: 4, num_layers: 2, num_phases: 5, num_arm_roles: 4, top_k: 4}
|
| 51 |
+
|
| 52 |
+
loss_weights:
|
| 53 |
+
action: 1.0
|
| 54 |
+
phase: 0.15
|
| 55 |
+
arm_role: 0.2
|
| 56 |
+
support_mode: 0.15
|
| 57 |
+
corridor: 0.2
|
| 58 |
+
persistence: 0.1
|
| 59 |
+
disturbance: 0.1
|
| 60 |
+
world_model: 0.25
|
| 61 |
+
belief: 0.05
|
| 62 |
+
visibility: 0.05
|
| 63 |
+
clearance: 0.05
|
| 64 |
+
support_stability: 0.05
|
| 65 |
+
reocclusion: 0.05
|
| 66 |
+
occluder_contact: 0.05
|
| 67 |
+
grasp_affordance: 0.05
|
| 68 |
+
planner_success: 0.2
|
| 69 |
+
planner_risk: 0.1
|
| 70 |
+
planner_ranking: 0.1
|
| 71 |
+
proposal_reconstruction: 0.2
|
| 72 |
+
proposal_success: 0.1
|
| 73 |
+
proposal_ranking: 0.1
|
| 74 |
+
proposal_diversity: 0.05
|
| 75 |
+
role_swap_consistency: 0.05
|
code/reveal_vla_bimanual/train/configs/proxy_interaction_r3d_stage2_clip.yaml
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
experiment_name: proxy_interaction_r3d_stage2_clip
|
| 2 |
+
output_dir: /workspace/VLAarchtests/artifacts/outputs/r3d
|
| 3 |
+
device: cuda
|
| 4 |
+
seed: 11
|
| 5 |
+
init_checkpoint: /workspace/VLAarchtests/artifacts/outputs/reveal_runs/proxy_backbone_only_clip/checkpoint_best.pt
|
| 6 |
+
init_strict: false
|
| 7 |
+
data: {proxies: [foliage_proxy, bag_proxy, cloth_proxy], resolution: 224, dataset_version: reveal_proxy_v6_rgbd_elastic_state, train_episodes_per_proxy: 48, val_episodes_per_proxy: 16, train_dataset_path: /workspace/VLAarchtests/artifacts/data/reveal_proxy/proxy_train_clip224_v6_rgbd_stage2.pt, val_dataset_path: /workspace/VLAarchtests/artifacts/data/reveal_proxy/proxy_val_clip224_v6_rgbd_stage2.pt, rebuild_dataset: false, chunk_horizon: 8, rollout_horizon: 5, history_steps: 6, planner_candidates: 8, seed: 11}
|
| 8 |
+
optim: {epochs: 4, batch_size: 2, num_workers: 4, lr: 0.0003, weight_decay: 0.0001}
|
| 9 |
+
trainer: {policy_type: elastic_reveal, use_bf16: true, grad_clip_norm: 1.0, freeze_backbone: true, gradient_checkpointing: false, plan_during_train: true, plan_during_eval: true, support_mode_conditioning: true, planner_mode: trainable, use_depth: false, use_world_model: true, use_role_tokens: true, compute_equivariance_probe: true}
|
| 10 |
+
policy:
|
| 11 |
+
backbone: {model_name: openai/clip-vit-base-patch32, hidden_dim: 512, max_text_tokens: 32, freeze_backbone: true, gradient_checkpointing: false, use_dummy_backbone: false}
|
| 12 |
+
fusion: {hidden_dim: 512, num_cameras: 3, num_layers: 4, num_heads: 8, ff_dim: 2048, dropout: 0.1, proprio_dim: 32, proprio_tokens: 1}
|
| 13 |
+
memory: {hidden_dim: 512, action_dim: 14, history_steps: 6, scene_history_steps: 3, belief_history_steps: 8, num_layers: 2, dropout: 0.1, memory_bank_size: 4, scene_bank_size: 2, belief_bank_size: 2, num_heads: 8, max_history_steps: 8}
|
| 14 |
+
decoder: {hidden_dim: 512, num_heads: 8, num_layers: 4, ff_dim: 2048, dropout: 0.1, chunk_size: 8, action_dim: 14, arm_action_dim: 7, num_candidates: 8, num_phases: 5, num_arm_roles: 4, num_proposal_modes: 6, planner_top_k: 4}
|
| 15 |
+
reveal_head: {hidden_dim: 512, num_support_modes: 3, num_approach_templates: 32, rollout_horizon: 5, belief_map_size: 32, field_size: 16, num_heads: 8, predict_belief_map: true, num_phases: 5, num_arm_roles: 4, num_interaction_tokens: 8}
|
| 16 |
+
world_model: {hidden_dim: 512, action_dim: 14, num_support_modes: 3, num_approach_templates: 32, rollout_horizon: 5, field_size: 16, num_heads: 8, num_phases: 5, num_arm_roles: 4, num_interaction_tokens: 8, belief_map_size: 32, predict_belief_map: true, scene_bank_size: 2, belief_bank_size: 2}
|
| 17 |
+
planner: {hidden_dim: 512, num_candidates: 8, action_dim: 14, num_support_modes: 3, utility_margin: 0.1, num_heads: 8, num_layers: 2, num_phases: 5, num_arm_roles: 4, top_k: 4}
|
| 18 |
+
loss_weights: {action: 1.0, phase: 0.1, arm_role: 0.15, support_mode: 0.1, corridor: 0.15, persistence: 0.05, disturbance: 0.05, world_model: 0.25, belief: 0.05, visibility: 0.05, clearance: 0.05, support_stability: 0.05, reocclusion: 0.05, occluder_contact: 0.05, grasp_affordance: 0.05, planner_success: 0.25, planner_risk: 0.1, planner_ranking: 0.2, proposal_reconstruction: 0.1, proposal_success: 0.15, proposal_ranking: 0.2, proposal_diversity: 0.05, role_swap_consistency: 0.05}
|
code/reveal_vla_bimanual/train/configs/proxy_interaction_r3d_stage2_dummy.yaml
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
experiment_name: proxy_interaction_r3d_stage2_dummy
|
| 2 |
+
output_dir: /workspace/VLAarchtests/artifacts/outputs/r3d
|
| 3 |
+
device: cuda
|
| 4 |
+
seed: 21
|
| 5 |
+
defaults: []
|
| 6 |
+
data: {proxies: [foliage_proxy, bag_proxy, cloth_proxy], resolution: 96, dataset_version: reveal_proxy_v6_rgbd_elastic_state, train_episodes_per_proxy: 48, val_episodes_per_proxy: 16, train_dataset_path: /workspace/VLAarchtests/artifacts/data/reveal_proxy/proxy_train_v6_rgbd_stage2_dummy.pt, val_dataset_path: /workspace/VLAarchtests/artifacts/data/reveal_proxy/proxy_val_v6_rgbd_stage2_dummy.pt, rebuild_dataset: false, chunk_horizon: 8, rollout_horizon: 5, history_steps: 6, planner_candidates: 8, seed: 21}
|
| 7 |
+
optim: {epochs: 4, batch_size: 16, num_workers: 4, lr: 0.001, weight_decay: 0.0001}
|
| 8 |
+
trainer: {policy_type: elastic_reveal, use_bf16: false, grad_clip_norm: 1.0, freeze_backbone: true, gradient_checkpointing: false, plan_during_train: true, plan_during_eval: true, support_mode_conditioning: true, planner_mode: trainable, use_depth: false, use_world_model: true, use_role_tokens: true, compute_equivariance_probe: true}
|
| 9 |
+
policy:
|
| 10 |
+
backbone: {model_name: openai/clip-vit-base-patch32, hidden_dim: 192, max_text_tokens: 32, freeze_backbone: true, gradient_checkpointing: false, use_dummy_backbone: true}
|
| 11 |
+
fusion: {hidden_dim: 192, num_cameras: 3, num_layers: 2, num_heads: 4, ff_dim: 384, dropout: 0.1, proprio_dim: 32, proprio_tokens: 1}
|
| 12 |
+
memory: {hidden_dim: 192, action_dim: 14, history_steps: 6, scene_history_steps: 3, belief_history_steps: 8, num_layers: 2, dropout: 0.1, memory_bank_size: 4, scene_bank_size: 2, belief_bank_size: 2, num_heads: 4, max_history_steps: 8}
|
| 13 |
+
decoder: {hidden_dim: 192, num_heads: 4, num_layers: 2, ff_dim: 384, dropout: 0.1, chunk_size: 8, action_dim: 14, arm_action_dim: 7, num_candidates: 8, num_phases: 5, num_arm_roles: 4, num_proposal_modes: 6, planner_top_k: 4}
|
| 14 |
+
reveal_head: {hidden_dim: 192, num_support_modes: 3, num_approach_templates: 32, rollout_horizon: 5, belief_map_size: 32, field_size: 16, num_heads: 4, predict_belief_map: true, num_phases: 5, num_arm_roles: 4, num_interaction_tokens: 8}
|
| 15 |
+
world_model: {hidden_dim: 192, action_dim: 14, num_support_modes: 3, num_approach_templates: 32, rollout_horizon: 5, field_size: 16, num_heads: 4, num_phases: 5, num_arm_roles: 4, num_interaction_tokens: 8, belief_map_size: 32, predict_belief_map: true, scene_bank_size: 2, belief_bank_size: 2}
|
| 16 |
+
planner: {hidden_dim: 192, num_candidates: 8, action_dim: 14, num_support_modes: 3, utility_margin: 0.1, num_heads: 4, num_layers: 2, num_phases: 5, num_arm_roles: 4, top_k: 4}
|
| 17 |
+
loss_weights: {action: 1.0, phase: 0.15, arm_role: 0.2, support_mode: 0.15, corridor: 0.2, persistence: 0.1, disturbance: 0.1, world_model: 0.3, belief: 0.05, visibility: 0.05, clearance: 0.05, support_stability: 0.05, reocclusion: 0.05, occluder_contact: 0.05, grasp_affordance: 0.05, planner_success: 0.2, planner_risk: 0.1, planner_ranking: 0.1, proposal_reconstruction: 0.2, proposal_success: 0.1, proposal_ranking: 0.1, proposal_diversity: 0.05, role_swap_consistency: 0.05}
|
code/reveal_vla_bimanual/train/configs/proxy_interaction_r3d_stage3_clip_rgbd.yaml
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
experiment_name: proxy_interaction_r3d_stage3_clip_rgbd
|
| 2 |
+
output_dir: /workspace/VLAarchtests/artifacts/outputs/r3d
|
| 3 |
+
device: cuda
|
| 4 |
+
seed: 17
|
| 5 |
+
init_checkpoint: /workspace/VLAarchtests/artifacts/outputs/reveal_runs/proxy_backbone_only_clip/checkpoint_best.pt
|
| 6 |
+
init_strict: false
|
| 7 |
+
data: {proxies: [foliage_proxy, bag_proxy, cloth_proxy], resolution: 224, dataset_version: reveal_proxy_v6_rgbd_elastic_state, train_episodes_per_proxy: 48, val_episodes_per_proxy: 16, train_dataset_path: /workspace/VLAarchtests/artifacts/data/reveal_proxy/proxy_train_clip224_v6_rgbd_stage3.pt, val_dataset_path: /workspace/VLAarchtests/artifacts/data/reveal_proxy/proxy_val_clip224_v6_rgbd_stage3.pt, rebuild_dataset: false, chunk_horizon: 8, rollout_horizon: 5, history_steps: 6, planner_candidates: 8, seed: 17}
|
| 8 |
+
optim: {epochs: 4, batch_size: 2, num_workers: 4, lr: 0.0003, weight_decay: 0.0001}
|
| 9 |
+
trainer: {policy_type: elastic_reveal, use_bf16: true, grad_clip_norm: 1.0, freeze_backbone: true, gradient_checkpointing: false, plan_during_train: true, plan_during_eval: true, support_mode_conditioning: true, planner_mode: trainable, use_depth: true, use_world_model: true, use_role_tokens: true, compute_equivariance_probe: true}
|
| 10 |
+
policy:
|
| 11 |
+
backbone: {model_name: openai/clip-vit-base-patch32, hidden_dim: 512, max_text_tokens: 32, freeze_backbone: true, gradient_checkpointing: false, use_dummy_backbone: false}
|
| 12 |
+
fusion: {hidden_dim: 512, num_cameras: 3, num_layers: 4, num_heads: 8, ff_dim: 2048, dropout: 0.1, proprio_dim: 32, proprio_tokens: 1}
|
| 13 |
+
memory: {hidden_dim: 512, action_dim: 14, history_steps: 6, scene_history_steps: 3, belief_history_steps: 8, num_layers: 2, dropout: 0.1, memory_bank_size: 4, scene_bank_size: 2, belief_bank_size: 2, num_heads: 8, max_history_steps: 8}
|
| 14 |
+
decoder: {hidden_dim: 512, num_heads: 8, num_layers: 4, ff_dim: 2048, dropout: 0.1, chunk_size: 8, action_dim: 14, arm_action_dim: 7, num_candidates: 8, num_phases: 5, num_arm_roles: 4, num_proposal_modes: 6, planner_top_k: 4}
|
| 15 |
+
reveal_head: {hidden_dim: 512, num_support_modes: 3, num_approach_templates: 32, rollout_horizon: 5, belief_map_size: 32, field_size: 16, num_heads: 8, predict_belief_map: true, num_phases: 5, num_arm_roles: 4, num_interaction_tokens: 8}
|
| 16 |
+
world_model: {hidden_dim: 512, action_dim: 14, num_support_modes: 3, num_approach_templates: 32, rollout_horizon: 5, field_size: 16, num_heads: 8, num_phases: 5, num_arm_roles: 4, num_interaction_tokens: 8, belief_map_size: 32, predict_belief_map: true, scene_bank_size: 2, belief_bank_size: 2}
|
| 17 |
+
planner: {hidden_dim: 512, num_candidates: 8, action_dim: 14, num_support_modes: 3, utility_margin: 0.1, num_heads: 8, num_layers: 2, num_phases: 5, num_arm_roles: 4, top_k: 4}
|
| 18 |
+
loss_weights: {action: 1.0, phase: 0.1, arm_role: 0.15, support_mode: 0.1, corridor: 0.15, persistence: 0.05, disturbance: 0.05, world_model: 0.25, belief: 0.05, visibility: 0.05, clearance: 0.05, support_stability: 0.05, reocclusion: 0.05, occluder_contact: 0.05, grasp_affordance: 0.05, planner_success: 0.25, planner_risk: 0.1, planner_ranking: 0.2, proposal_reconstruction: 0.1, proposal_success: 0.15, proposal_ranking: 0.2, proposal_diversity: 0.05, role_swap_consistency: 0.05}
|
code/reveal_vla_bimanual/train/losses.py
CHANGED
|
@@ -18,12 +18,20 @@ class LossWeights:
|
|
| 18 |
disturbance: float = 0.05
|
| 19 |
world_model: float = 0.1
|
| 20 |
belief: float = 0.05
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
planner_success: float = 0.1
|
| 22 |
planner_risk: float = 0.05
|
| 23 |
planner_ranking: float = 0.05
|
| 24 |
proposal_reconstruction: float = 0.1
|
| 25 |
proposal_success: float = 0.05
|
| 26 |
proposal_ranking: float = 0.05
|
|
|
|
|
|
|
| 27 |
|
| 28 |
|
| 29 |
def chunk_bc_loss(pred_actions: Tensor, target_actions: Tensor, mask: Tensor | None = None) -> Tensor:
|
|
@@ -62,6 +70,46 @@ def _role_targets_like(arm_role_logits: Tensor) -> Tensor:
|
|
| 62 |
return role_target.view(*expand_shape).expand(*arm_role_logits.shape[:-1])
|
| 63 |
|
| 64 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
def reveal_state_loss(pred: dict[str, Tensor], target: dict[str, Tensor], weights: LossWeights) -> dict[str, Tensor]:
|
| 66 |
losses = {}
|
| 67 |
if "phase_logits" in pred:
|
|
@@ -75,11 +123,7 @@ def reveal_state_loss(pred: dict[str, Tensor], target: dict[str, Tensor], weight
|
|
| 75 |
else:
|
| 76 |
losses["phase"] = pred["support_mode_logits"].new_tensor(0.0)
|
| 77 |
if "arm_role_logits" in pred:
|
| 78 |
-
|
| 79 |
-
role_ce = F.cross_entropy(
|
| 80 |
-
pred["arm_role_logits"].reshape(-1, pred["arm_role_logits"].shape[-1]),
|
| 81 |
-
role_target.reshape(-1),
|
| 82 |
-
)
|
| 83 |
role_probs = pred["arm_role_logits"].softmax(dim=-1)
|
| 84 |
role_gap = torch.mean(torch.abs(role_probs[:, 0] - role_probs[:, 1]), dim=-1)
|
| 85 |
role_separation = torch.relu(0.25 - role_gap).mean()
|
|
@@ -95,11 +139,50 @@ def reveal_state_loss(pred: dict[str, Tensor], target: dict[str, Tensor], weight
|
|
| 95 |
losses["persistence"] = F.mse_loss(pred["persistence_horizon"], target["persistence_horizon"].float())
|
| 96 |
losses["disturbance"] = F.mse_loss(pred["disturbance_cost"], target["disturbance_cost"].float())
|
| 97 |
if "belief_map" in pred and "belief_map" in target:
|
| 98 |
-
losses["belief"] = F.binary_cross_entropy_with_logits(pred["belief_map"], target["belief_map"].float())
|
| 99 |
else:
|
| 100 |
losses["belief"] = pred["support_mode_logits"].new_tensor(0.0)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
if "reocclusion_logit" in pred and "corridor_feasible" in target:
|
| 102 |
-
target_reocclusion =
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
losses["reocclusion"] = F.binary_cross_entropy_with_logits(pred["reocclusion_logit"], target_reocclusion)
|
| 104 |
else:
|
| 105 |
losses["reocclusion"] = pred["support_mode_logits"].new_tensor(0.0)
|
|
@@ -157,11 +240,30 @@ def world_model_rollout_consistency_loss(pred_rollout: dict[str, Tensor], target
|
|
| 157 |
phase_target.reshape(-1),
|
| 158 |
)
|
| 159 |
if "arm_role_logits" in pred_rollout:
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 165 |
return loss
|
| 166 |
|
| 167 |
|
|
@@ -192,7 +294,12 @@ def compute_total_loss(
|
|
| 192 |
+ weights.persistence * reveal_losses["persistence"]
|
| 193 |
+ weights.disturbance * reveal_losses["disturbance"]
|
| 194 |
+ weights.belief * reveal_losses["belief"]
|
| 195 |
-
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 196 |
+ 0.01 * reveal_losses["uncertainty"]
|
| 197 |
)
|
| 198 |
|
|
@@ -207,6 +314,28 @@ def compute_total_loss(
|
|
| 207 |
"disturbance_cost": batch["candidate_rollout_disturbance_cost"],
|
| 208 |
"action_chunk": batch["candidate_action_chunks"],
|
| 209 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 210 |
else:
|
| 211 |
rollout_target = {
|
| 212 |
"support_mode": batch["rollout_support_mode"],
|
|
@@ -215,6 +344,17 @@ def compute_total_loss(
|
|
| 215 |
"disturbance_cost": batch["rollout_disturbance_cost"],
|
| 216 |
"action_chunk": batch["action_chunk"],
|
| 217 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 218 |
world_model_loss = world_model_rollout_consistency_loss(
|
| 219 |
model_output["planned_rollout"],
|
| 220 |
rollout_target,
|
|
@@ -234,8 +374,16 @@ def compute_total_loss(
|
|
| 234 |
1.0,
|
| 235 |
)
|
| 236 |
utility_target = batch.get("candidate_utility")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 237 |
if utility_target is None:
|
| 238 |
utility_target = success_target - risk_target
|
|
|
|
|
|
|
| 239 |
success_loss = F.binary_cross_entropy_with_logits(model_output["planner_success_logits"], success_target)
|
| 240 |
risk_loss = F.mse_loss(model_output["planner_risk_values"], risk_target.float())
|
| 241 |
pred_diff = model_output["planner_scores"].unsqueeze(-1) - model_output["planner_scores"].unsqueeze(-2)
|
|
@@ -322,5 +470,22 @@ def compute_total_loss(
|
|
| 322 |
losses["proposal_success"] = model_output["action_mean"].new_tensor(0.0)
|
| 323 |
losses["proposal_ranking"] = model_output["action_mean"].new_tensor(0.0)
|
| 324 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 325 |
losses["total"] = total
|
| 326 |
return losses
|
|
|
|
| 18 |
disturbance: float = 0.05
|
| 19 |
world_model: float = 0.1
|
| 20 |
belief: float = 0.05
|
| 21 |
+
visibility: float = 0.05
|
| 22 |
+
clearance: float = 0.05
|
| 23 |
+
support_stability: float = 0.05
|
| 24 |
+
reocclusion: float = 0.05
|
| 25 |
+
occluder_contact: float = 0.05
|
| 26 |
+
grasp_affordance: float = 0.05
|
| 27 |
planner_success: float = 0.1
|
| 28 |
planner_risk: float = 0.05
|
| 29 |
planner_ranking: float = 0.05
|
| 30 |
proposal_reconstruction: float = 0.1
|
| 31 |
proposal_success: float = 0.05
|
| 32 |
proposal_ranking: float = 0.05
|
| 33 |
+
proposal_diversity: float = 0.05
|
| 34 |
+
role_swap_consistency: float = 0.05
|
| 35 |
|
| 36 |
|
| 37 |
def chunk_bc_loss(pred_actions: Tensor, target_actions: Tensor, mask: Tensor | None = None) -> Tensor:
|
|
|
|
| 70 |
return role_target.view(*expand_shape).expand(*arm_role_logits.shape[:-1])
|
| 71 |
|
| 72 |
|
| 73 |
+
def swap_arm_actions(action_chunk: Tensor) -> Tensor:
|
| 74 |
+
midpoint = action_chunk.shape[-1] // 2
|
| 75 |
+
return torch.cat([action_chunk[..., midpoint:], action_chunk[..., :midpoint]], dim=-1)
|
| 76 |
+
|
| 77 |
+
|
| 78 |
+
def permutation_invariant_role_loss(arm_role_logits: Tensor) -> Tensor:
|
| 79 |
+
role_target = _role_targets_like(arm_role_logits)
|
| 80 |
+
swapped_target = role_target.flip(-1)
|
| 81 |
+
flat_logits = arm_role_logits.reshape(-1, arm_role_logits.shape[-1])
|
| 82 |
+
loss_a = F.cross_entropy(flat_logits, role_target.reshape(-1), reduction="none").view(*role_target.shape)
|
| 83 |
+
loss_b = F.cross_entropy(flat_logits, swapped_target.reshape(-1), reduction="none").view(*role_target.shape)
|
| 84 |
+
return torch.minimum(loss_a.sum(dim=-1), loss_b.sum(dim=-1)).mean()
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
def role_swap_consistency_loss(pred: Tensor, target: Tensor) -> Tensor:
|
| 88 |
+
return F.smooth_l1_loss(pred, target)
|
| 89 |
+
|
| 90 |
+
|
| 91 |
+
def proposal_diversity_loss(proposal_candidates: Tensor, minimum_distance: float = 0.05) -> Tensor:
|
| 92 |
+
if proposal_candidates.ndim != 4 or proposal_candidates.shape[1] <= 1:
|
| 93 |
+
return proposal_candidates.new_tensor(0.0)
|
| 94 |
+
flat = proposal_candidates.flatten(start_dim=2)
|
| 95 |
+
distances = torch.cdist(flat, flat, p=1)
|
| 96 |
+
eye = torch.eye(distances.shape[-1], device=distances.device, dtype=torch.bool).unsqueeze(0)
|
| 97 |
+
valid = (~eye).expand(distances.shape[0], -1, -1)
|
| 98 |
+
if not valid.any():
|
| 99 |
+
return proposal_candidates.new_tensor(0.0)
|
| 100 |
+
return torch.relu(minimum_distance - distances[valid]).mean()
|
| 101 |
+
|
| 102 |
+
|
| 103 |
+
def _resize_like(target: Tensor, prediction: Tensor) -> Tensor:
|
| 104 |
+
if target.shape == prediction.shape:
|
| 105 |
+
return target
|
| 106 |
+
if target.ndim == prediction.ndim == 4:
|
| 107 |
+
return F.interpolate(target.float(), size=prediction.shape[-2:], mode="bilinear", align_corners=False)
|
| 108 |
+
if target.ndim == 3 and prediction.ndim == 4:
|
| 109 |
+
return F.interpolate(target.unsqueeze(1).float(), size=prediction.shape[-2:], mode="bilinear", align_corners=False)
|
| 110 |
+
return target
|
| 111 |
+
|
| 112 |
+
|
| 113 |
def reveal_state_loss(pred: dict[str, Tensor], target: dict[str, Tensor], weights: LossWeights) -> dict[str, Tensor]:
|
| 114 |
losses = {}
|
| 115 |
if "phase_logits" in pred:
|
|
|
|
| 123 |
else:
|
| 124 |
losses["phase"] = pred["support_mode_logits"].new_tensor(0.0)
|
| 125 |
if "arm_role_logits" in pred:
|
| 126 |
+
role_ce = permutation_invariant_role_loss(pred["arm_role_logits"])
|
|
|
|
|
|
|
|
|
|
|
|
|
| 127 |
role_probs = pred["arm_role_logits"].softmax(dim=-1)
|
| 128 |
role_gap = torch.mean(torch.abs(role_probs[:, 0] - role_probs[:, 1]), dim=-1)
|
| 129 |
role_separation = torch.relu(0.25 - role_gap).mean()
|
|
|
|
| 139 |
losses["persistence"] = F.mse_loss(pred["persistence_horizon"], target["persistence_horizon"].float())
|
| 140 |
losses["disturbance"] = F.mse_loss(pred["disturbance_cost"], target["disturbance_cost"].float())
|
| 141 |
if "belief_map" in pred and "belief_map" in target:
|
| 142 |
+
losses["belief"] = F.binary_cross_entropy_with_logits(pred["belief_map"], _resize_like(target["belief_map"].float(), pred["belief_map"]))
|
| 143 |
else:
|
| 144 |
losses["belief"] = pred["support_mode_logits"].new_tensor(0.0)
|
| 145 |
+
if "visibility_field" in pred and "visibility_map" in target:
|
| 146 |
+
losses["visibility"] = F.binary_cross_entropy_with_logits(
|
| 147 |
+
pred["visibility_field"],
|
| 148 |
+
_resize_like(target["visibility_map"].float(), pred["visibility_field"]),
|
| 149 |
+
)
|
| 150 |
+
else:
|
| 151 |
+
losses["visibility"] = pred["support_mode_logits"].new_tensor(0.0)
|
| 152 |
+
if "clearance_field" in pred and "clearance_map" in target:
|
| 153 |
+
losses["clearance"] = F.binary_cross_entropy_with_logits(
|
| 154 |
+
pred["clearance_field"],
|
| 155 |
+
_resize_like(target["clearance_map"].float(), pred["clearance_field"]),
|
| 156 |
+
)
|
| 157 |
+
else:
|
| 158 |
+
losses["clearance"] = pred["support_mode_logits"].new_tensor(0.0)
|
| 159 |
+
if "support_stability_field" in pred and "support_stability_map" in target:
|
| 160 |
+
losses["support_stability"] = F.binary_cross_entropy_with_logits(
|
| 161 |
+
pred["support_stability_field"],
|
| 162 |
+
_resize_like(target["support_stability_map"].float(), pred["support_stability_field"]),
|
| 163 |
+
)
|
| 164 |
+
else:
|
| 165 |
+
losses["support_stability"] = pred["support_mode_logits"].new_tensor(0.0)
|
| 166 |
+
if "occluder_contact_field" in pred and "occluder_contact_map" in target:
|
| 167 |
+
losses["occluder_contact"] = F.binary_cross_entropy_with_logits(
|
| 168 |
+
pred["occluder_contact_field"],
|
| 169 |
+
_resize_like(target["occluder_contact_map"].float(), pred["occluder_contact_field"]),
|
| 170 |
+
)
|
| 171 |
+
else:
|
| 172 |
+
losses["occluder_contact"] = pred["support_mode_logits"].new_tensor(0.0)
|
| 173 |
+
if "grasp_affordance_field" in pred and "grasp_affordance_map" in target:
|
| 174 |
+
losses["grasp_affordance"] = F.binary_cross_entropy_with_logits(
|
| 175 |
+
pred["grasp_affordance_field"],
|
| 176 |
+
_resize_like(target["grasp_affordance_map"].float(), pred["grasp_affordance_field"]),
|
| 177 |
+
)
|
| 178 |
+
else:
|
| 179 |
+
losses["grasp_affordance"] = pred["support_mode_logits"].new_tensor(0.0)
|
| 180 |
if "reocclusion_logit" in pred and "corridor_feasible" in target:
|
| 181 |
+
target_reocclusion = target.get("reocclusion_target")
|
| 182 |
+
if target_reocclusion is None:
|
| 183 |
+
target_reocclusion = 1.0 - target["corridor_feasible"].float().amax(dim=-1)
|
| 184 |
+
if target_reocclusion.ndim < pred["reocclusion_logit"].ndim:
|
| 185 |
+
target_reocclusion = target_reocclusion.unsqueeze(-1).expand_as(pred["reocclusion_logit"])
|
| 186 |
losses["reocclusion"] = F.binary_cross_entropy_with_logits(pred["reocclusion_logit"], target_reocclusion)
|
| 187 |
else:
|
| 188 |
losses["reocclusion"] = pred["support_mode_logits"].new_tensor(0.0)
|
|
|
|
| 240 |
phase_target.reshape(-1),
|
| 241 |
)
|
| 242 |
if "arm_role_logits" in pred_rollout:
|
| 243 |
+
loss = loss + 0.25 * permutation_invariant_role_loss(pred_rollout["arm_role_logits"])
|
| 244 |
+
optional_pairs = (
|
| 245 |
+
("target_belief_field", "belief_map", "rollout_belief_map"),
|
| 246 |
+
("visibility_field", "visibility_map", "rollout_visibility_map"),
|
| 247 |
+
("clearance_field", "clearance_map", "rollout_clearance_map"),
|
| 248 |
+
("support_stability_field", "support_stability_map", "rollout_support_stability"),
|
| 249 |
+
("occluder_contact_field", "occluder_contact_map", "rollout_occluder_contact_map"),
|
| 250 |
+
("grasp_affordance_field", "grasp_affordance_map", "rollout_grasp_affordance_map"),
|
| 251 |
+
("reocclusion_field", "reocclusion_map", "rollout_reocclusion_target"),
|
| 252 |
+
)
|
| 253 |
+
for pred_key, _, target_key in optional_pairs:
|
| 254 |
+
if pred_key not in pred_rollout or target_key not in target_rollout:
|
| 255 |
+
continue
|
| 256 |
+
target_value = _expand_target(target_rollout[target_key][..., :horizon, ...])
|
| 257 |
+
pred_value = pred_rollout[pred_key][..., :horizon, :, :, :] if pred_rollout[pred_key].ndim >= 6 else pred_rollout[pred_key][..., :horizon, :, :]
|
| 258 |
+
if target_value.ndim + 1 == pred_value.ndim:
|
| 259 |
+
target_value = target_value.unsqueeze(-3)
|
| 260 |
+
if pred_key in {"support_stability_field", "reocclusion_field"} and target_value.ndim == pred_value.ndim - 1:
|
| 261 |
+
target_value = target_value.unsqueeze(-1).unsqueeze(-1)
|
| 262 |
+
if pred_key == "support_stability_field" and target_value.ndim == pred_value.ndim - 2:
|
| 263 |
+
target_value = target_value.unsqueeze(-1).unsqueeze(-1)
|
| 264 |
+
if pred_key == "reocclusion_field" and target_value.ndim == pred_value.ndim - 2:
|
| 265 |
+
target_value = target_value.unsqueeze(-1).unsqueeze(-1)
|
| 266 |
+
loss = loss + 0.1 * F.binary_cross_entropy_with_logits(pred_value, target_value.float())
|
| 267 |
return loss
|
| 268 |
|
| 269 |
|
|
|
|
| 294 |
+ weights.persistence * reveal_losses["persistence"]
|
| 295 |
+ weights.disturbance * reveal_losses["disturbance"]
|
| 296 |
+ weights.belief * reveal_losses["belief"]
|
| 297 |
+
+ weights.visibility * reveal_losses["visibility"]
|
| 298 |
+
+ weights.clearance * reveal_losses["clearance"]
|
| 299 |
+
+ weights.support_stability * reveal_losses["support_stability"]
|
| 300 |
+
+ weights.occluder_contact * reveal_losses["occluder_contact"]
|
| 301 |
+
+ weights.grasp_affordance * reveal_losses["grasp_affordance"]
|
| 302 |
+
+ weights.reocclusion * reveal_losses["reocclusion"]
|
| 303 |
+ 0.01 * reveal_losses["uncertainty"]
|
| 304 |
)
|
| 305 |
|
|
|
|
| 314 |
"disturbance_cost": batch["candidate_rollout_disturbance_cost"],
|
| 315 |
"action_chunk": batch["candidate_action_chunks"],
|
| 316 |
}
|
| 317 |
+
for optional_key in (
|
| 318 |
+
"candidate_rollout_belief_map",
|
| 319 |
+
"candidate_rollout_visibility_map",
|
| 320 |
+
"candidate_rollout_clearance_map",
|
| 321 |
+
"candidate_rollout_support_stability",
|
| 322 |
+
"candidate_rollout_reocclusion_target",
|
| 323 |
+
"candidate_rollout_occluder_contact_map",
|
| 324 |
+
"candidate_rollout_grasp_affordance_map",
|
| 325 |
+
):
|
| 326 |
+
if optional_key in batch:
|
| 327 |
+
rollout_target[optional_key.replace("candidate_", "")] = batch[optional_key]
|
| 328 |
+
planner_indices = model_output.get("planner_topk_indices")
|
| 329 |
+
if planner_indices is not None:
|
| 330 |
+
for key, value in list(rollout_target.items()):
|
| 331 |
+
if isinstance(value, Tensor) and value.ndim >= 2 and value.shape[1] >= planner_indices.shape[1]:
|
| 332 |
+
expand_indices = planner_indices
|
| 333 |
+
while expand_indices.ndim < value.ndim:
|
| 334 |
+
expand_indices = expand_indices.unsqueeze(-1)
|
| 335 |
+
rollout_target[key] = value.gather(
|
| 336 |
+
1,
|
| 337 |
+
expand_indices.expand(-1, -1, *value.shape[2:]),
|
| 338 |
+
)
|
| 339 |
else:
|
| 340 |
rollout_target = {
|
| 341 |
"support_mode": batch["rollout_support_mode"],
|
|
|
|
| 344 |
"disturbance_cost": batch["rollout_disturbance_cost"],
|
| 345 |
"action_chunk": batch["action_chunk"],
|
| 346 |
}
|
| 347 |
+
for optional_key in (
|
| 348 |
+
"rollout_belief_map",
|
| 349 |
+
"rollout_visibility_map",
|
| 350 |
+
"rollout_clearance_map",
|
| 351 |
+
"rollout_support_stability",
|
| 352 |
+
"rollout_reocclusion_target",
|
| 353 |
+
"rollout_occluder_contact_map",
|
| 354 |
+
"rollout_grasp_affordance_map",
|
| 355 |
+
):
|
| 356 |
+
if optional_key in batch:
|
| 357 |
+
rollout_target[optional_key] = batch[optional_key]
|
| 358 |
world_model_loss = world_model_rollout_consistency_loss(
|
| 359 |
model_output["planned_rollout"],
|
| 360 |
rollout_target,
|
|
|
|
| 374 |
1.0,
|
| 375 |
)
|
| 376 |
utility_target = batch.get("candidate_utility")
|
| 377 |
+
planner_indices = model_output.get("planner_topk_indices")
|
| 378 |
+
if planner_indices is not None and success_target.shape[1] != model_output["planner_success_logits"].shape[1]:
|
| 379 |
+
success_target = success_target.gather(1, planner_indices)
|
| 380 |
+
risk_target = risk_target.gather(1, planner_indices)
|
| 381 |
+
if utility_target is not None:
|
| 382 |
+
utility_target = utility_target.gather(1, planner_indices)
|
| 383 |
if utility_target is None:
|
| 384 |
utility_target = success_target - risk_target
|
| 385 |
+
elif "utility_structured" in model_output:
|
| 386 |
+
utility_target = 0.5 * utility_target + 0.5 * model_output["utility_structured"].detach()
|
| 387 |
success_loss = F.binary_cross_entropy_with_logits(model_output["planner_success_logits"], success_target)
|
| 388 |
risk_loss = F.mse_loss(model_output["planner_risk_values"], risk_target.float())
|
| 389 |
pred_diff = model_output["planner_scores"].unsqueeze(-1) - model_output["planner_scores"].unsqueeze(-2)
|
|
|
|
| 470 |
losses["proposal_success"] = model_output["action_mean"].new_tensor(0.0)
|
| 471 |
losses["proposal_ranking"] = model_output["action_mean"].new_tensor(0.0)
|
| 472 |
|
| 473 |
+
if "proposal_candidates" in model_output:
|
| 474 |
+
diversity_loss = proposal_diversity_loss(model_output["proposal_candidates"])
|
| 475 |
+
losses["proposal_diversity"] = diversity_loss
|
| 476 |
+
total = total + weights.proposal_diversity * diversity_loss
|
| 477 |
+
else:
|
| 478 |
+
losses["proposal_diversity"] = model_output["action_mean"].new_tensor(0.0)
|
| 479 |
+
|
| 480 |
+
if "equivariance_probe_action_mean" in model_output and "equivariance_target_action_mean" in model_output:
|
| 481 |
+
swap_loss = role_swap_consistency_loss(
|
| 482 |
+
model_output["equivariance_probe_action_mean"],
|
| 483 |
+
model_output["equivariance_target_action_mean"].detach(),
|
| 484 |
+
)
|
| 485 |
+
losses["role_swap_consistency"] = swap_loss
|
| 486 |
+
total = total + weights.role_swap_consistency * swap_loss
|
| 487 |
+
else:
|
| 488 |
+
losses["role_swap_consistency"] = model_output["action_mean"].new_tensor(0.0)
|
| 489 |
+
|
| 490 |
losses["total"] = total
|
| 491 |
return losses
|
code/reveal_vla_bimanual/train/run_experiment.py
CHANGED
|
@@ -2,6 +2,7 @@ from __future__ import annotations
|
|
| 2 |
|
| 3 |
import argparse
|
| 4 |
import json
|
|
|
|
| 5 |
from dataclasses import asdict
|
| 6 |
from pathlib import Path
|
| 7 |
from typing import Any
|
|
@@ -102,6 +103,7 @@ def _build_dataset_from_config(data_cfg: Any, split: str) -> dict[str, Any]:
|
|
| 102 |
rollout_horizon=int(data_cfg.rollout_horizon),
|
| 103 |
history_steps=int(data_cfg.get("history_steps", 2)),
|
| 104 |
planner_candidates=int(data_cfg.get("planner_candidates", 4)),
|
|
|
|
| 105 |
)
|
| 106 |
if dataset_path:
|
| 107 |
save_teacher_dataset(dataset_path, dataset_bundle)
|
|
@@ -145,6 +147,16 @@ def main() -> None:
|
|
| 145 |
|
| 146 |
train_bundle = _build_dataset_from_config(cfg.data, "train")
|
| 147 |
val_bundle = _build_dataset_from_config(cfg.data, "val")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 148 |
train_loader = _make_loader(
|
| 149 |
train_bundle["samples"],
|
| 150 |
resolution=int(cfg.data.resolution),
|
|
@@ -159,6 +171,7 @@ def main() -> None:
|
|
| 159 |
shuffle=False,
|
| 160 |
num_workers=int(cfg.optim.num_workers),
|
| 161 |
)
|
|
|
|
| 162 |
|
| 163 |
policy_config = _policy_config_from_omega(cfg.policy)
|
| 164 |
trainer_config = _trainer_config_from_omega(cfg.trainer)
|
|
@@ -173,8 +186,13 @@ def main() -> None:
|
|
| 173 |
history: list[dict[str, Any]] = []
|
| 174 |
best_val = float("inf")
|
| 175 |
best_checkpoint = output_dir / "checkpoint_best.pt"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 176 |
|
| 177 |
for epoch in range(int(cfg.optim.epochs)):
|
|
|
|
| 178 |
model.train()
|
| 179 |
train_losses: list[dict[str, float]] = []
|
| 180 |
for batch in train_loader:
|
|
@@ -200,6 +218,22 @@ def main() -> None:
|
|
| 200 |
forward_kwargs["support_mode_conditioning"] = trainer_config.support_mode_conditioning
|
| 201 |
if "candidate_action_chunks" in moved:
|
| 202 |
forward_kwargs["candidate_chunks_override"] = moved["candidate_action_chunks"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 203 |
output = model(**forward_kwargs)
|
| 204 |
losses = compute_total_loss(output, moved, weights=loss_weights)
|
| 205 |
val_losses.append({key: float(value.detach().cpu()) for key, value in losses.items()})
|
|
@@ -212,6 +246,18 @@ def main() -> None:
|
|
| 212 |
"val": val_summary,
|
| 213 |
}
|
| 214 |
history.append(record)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 215 |
if val_summary["total"] <= best_val:
|
| 216 |
best_val = val_summary["total"]
|
| 217 |
torch.save(
|
|
@@ -231,12 +277,20 @@ def main() -> None:
|
|
| 231 |
metrics_path = output_dir / "metrics.json"
|
| 232 |
metrics_path.write_text(json.dumps(history, indent=2), encoding="utf-8")
|
| 233 |
(output_dir / "config_resolved.yaml").write_text(OmegaConf.to_yaml(cfg, resolve=True), encoding="utf-8")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 234 |
summary = {
|
| 235 |
"experiment_name": cfg.experiment_name,
|
| 236 |
"device": str(device),
|
| 237 |
"best_checkpoint": str(best_checkpoint),
|
| 238 |
"final_train_total": history[-1]["train"]["total"],
|
| 239 |
"final_val_total": history[-1]["val"]["total"],
|
|
|
|
|
|
|
| 240 |
"num_train_samples": len(train_bundle["samples"]),
|
| 241 |
"num_val_samples": len(val_bundle["samples"]),
|
| 242 |
"planner_mode": trainer_config.planner_mode,
|
|
|
|
| 2 |
|
| 3 |
import argparse
|
| 4 |
import json
|
| 5 |
+
import time
|
| 6 |
from dataclasses import asdict
|
| 7 |
from pathlib import Path
|
| 8 |
from typing import Any
|
|
|
|
| 103 |
rollout_horizon=int(data_cfg.rollout_horizon),
|
| 104 |
history_steps=int(data_cfg.get("history_steps", 2)),
|
| 105 |
planner_candidates=int(data_cfg.get("planner_candidates", 4)),
|
| 106 |
+
dataset_version=str(data_cfg.get("dataset_version", "reveal_proxy_v5_noleak_actionhist")),
|
| 107 |
)
|
| 108 |
if dataset_path:
|
| 109 |
save_teacher_dataset(dataset_path, dataset_bundle)
|
|
|
|
| 147 |
|
| 148 |
train_bundle = _build_dataset_from_config(cfg.data, "train")
|
| 149 |
val_bundle = _build_dataset_from_config(cfg.data, "val")
|
| 150 |
+
print(
|
| 151 |
+
json.dumps(
|
| 152 |
+
{
|
| 153 |
+
"phase": "datasets_ready",
|
| 154 |
+
"train_samples": len(train_bundle["samples"]),
|
| 155 |
+
"val_samples": len(val_bundle["samples"]),
|
| 156 |
+
}
|
| 157 |
+
),
|
| 158 |
+
flush=True,
|
| 159 |
+
)
|
| 160 |
train_loader = _make_loader(
|
| 161 |
train_bundle["samples"],
|
| 162 |
resolution=int(cfg.data.resolution),
|
|
|
|
| 171 |
shuffle=False,
|
| 172 |
num_workers=int(cfg.optim.num_workers),
|
| 173 |
)
|
| 174 |
+
print(json.dumps({"phase": "loaders_ready"}), flush=True)
|
| 175 |
|
| 176 |
policy_config = _policy_config_from_omega(cfg.policy)
|
| 177 |
trainer_config = _trainer_config_from_omega(cfg.trainer)
|
|
|
|
| 186 |
history: list[dict[str, Any]] = []
|
| 187 |
best_val = float("inf")
|
| 188 |
best_checkpoint = output_dir / "checkpoint_best.pt"
|
| 189 |
+
train_start_time = time.time()
|
| 190 |
+
if device.type == "cuda":
|
| 191 |
+
torch.cuda.reset_peak_memory_stats(device)
|
| 192 |
+
print(json.dumps({"phase": "training_start", "epochs": int(cfg.optim.epochs)}), flush=True)
|
| 193 |
|
| 194 |
for epoch in range(int(cfg.optim.epochs)):
|
| 195 |
+
epoch_start_time = time.time()
|
| 196 |
model.train()
|
| 197 |
train_losses: list[dict[str, float]] = []
|
| 198 |
for batch in train_loader:
|
|
|
|
| 218 |
forward_kwargs["support_mode_conditioning"] = trainer_config.support_mode_conditioning
|
| 219 |
if "candidate_action_chunks" in moved:
|
| 220 |
forward_kwargs["candidate_chunks_override"] = moved["candidate_action_chunks"]
|
| 221 |
+
if trainer_config.policy_type == "elastic_reveal":
|
| 222 |
+
forward_kwargs["depths"] = moved.get("depths")
|
| 223 |
+
forward_kwargs["depth_valid"] = moved.get("depth_valid")
|
| 224 |
+
forward_kwargs["camera_intrinsics"] = moved.get("camera_intrinsics")
|
| 225 |
+
forward_kwargs["camera_extrinsics"] = moved.get("camera_extrinsics")
|
| 226 |
+
forward_kwargs["history_depths"] = moved.get("history_depths")
|
| 227 |
+
forward_kwargs["history_depth_valid"] = moved.get("history_depth_valid")
|
| 228 |
+
forward_kwargs["use_depth"] = trainer_config.use_depth
|
| 229 |
+
forward_kwargs["use_world_model"] = trainer_config.use_world_model
|
| 230 |
+
forward_kwargs["use_planner"] = planner_enabled(trainer_config, during_eval=True)
|
| 231 |
+
forward_kwargs["use_role_tokens"] = trainer_config.use_role_tokens
|
| 232 |
+
forward_kwargs["history_steps_override"] = trainer_config.history_steps_override
|
| 233 |
+
forward_kwargs["compute_equivariance_probe"] = False
|
| 234 |
+
elif trainer_config.policy_type == "interaction_state":
|
| 235 |
+
forward_kwargs["use_role_tokens"] = trainer_config.use_role_tokens
|
| 236 |
+
forward_kwargs["history_steps_override"] = trainer_config.history_steps_override
|
| 237 |
output = model(**forward_kwargs)
|
| 238 |
losses = compute_total_loss(output, moved, weights=loss_weights)
|
| 239 |
val_losses.append({key: float(value.detach().cpu()) for key, value in losses.items()})
|
|
|
|
| 246 |
"val": val_summary,
|
| 247 |
}
|
| 248 |
history.append(record)
|
| 249 |
+
print(
|
| 250 |
+
json.dumps(
|
| 251 |
+
{
|
| 252 |
+
"phase": "epoch_complete",
|
| 253 |
+
"epoch": epoch,
|
| 254 |
+
"train_total": train_summary["total"],
|
| 255 |
+
"val_total": val_summary["total"],
|
| 256 |
+
"epoch_time_sec": float(time.time() - epoch_start_time),
|
| 257 |
+
}
|
| 258 |
+
),
|
| 259 |
+
flush=True,
|
| 260 |
+
)
|
| 261 |
if val_summary["total"] <= best_val:
|
| 262 |
best_val = val_summary["total"]
|
| 263 |
torch.save(
|
|
|
|
| 277 |
metrics_path = output_dir / "metrics.json"
|
| 278 |
metrics_path.write_text(json.dumps(history, indent=2), encoding="utf-8")
|
| 279 |
(output_dir / "config_resolved.yaml").write_text(OmegaConf.to_yaml(cfg, resolve=True), encoding="utf-8")
|
| 280 |
+
train_time_sec = float(time.time() - train_start_time)
|
| 281 |
+
peak_gpu_memory_mb = (
|
| 282 |
+
float(torch.cuda.max_memory_allocated(device) / (1024.0 * 1024.0))
|
| 283 |
+
if device.type == "cuda"
|
| 284 |
+
else 0.0
|
| 285 |
+
)
|
| 286 |
summary = {
|
| 287 |
"experiment_name": cfg.experiment_name,
|
| 288 |
"device": str(device),
|
| 289 |
"best_checkpoint": str(best_checkpoint),
|
| 290 |
"final_train_total": history[-1]["train"]["total"],
|
| 291 |
"final_val_total": history[-1]["val"]["total"],
|
| 292 |
+
"train_time_sec": train_time_sec,
|
| 293 |
+
"peak_gpu_memory_mb": peak_gpu_memory_mb,
|
| 294 |
"num_train_samples": len(train_bundle["samples"]),
|
| 295 |
"num_val_samples": len(val_bundle["samples"]),
|
| 296 |
"planner_mode": trainer_config.planner_mode,
|
code/reveal_vla_bimanual/train/smoke_checks.py
CHANGED
|
@@ -17,7 +17,7 @@ from models.planner import PlannerConfig
|
|
| 17 |
from models.policy import PolicyConfig
|
| 18 |
from models.reveal_head import RevealHeadConfig
|
| 19 |
from models.world_model import RevealWMConfig
|
| 20 |
-
from sim_reveal.dataset import dataset_from_bundle, load_teacher_dataset
|
| 21 |
from train.losses import LossWeights, compute_total_loss
|
| 22 |
from train.trainer import TrainerConfig, apply_planner_mode, build_policy, planner_enabled
|
| 23 |
|
|
@@ -68,7 +68,7 @@ def _small_policy_config() -> PolicyConfig:
|
|
| 68 |
num_layers=2,
|
| 69 |
ff_dim=128,
|
| 70 |
dropout=0.1,
|
| 71 |
-
chunk_size=
|
| 72 |
action_dim=14,
|
| 73 |
arm_action_dim=7,
|
| 74 |
num_candidates=4,
|
|
@@ -114,9 +114,9 @@ def _small_policy_config() -> PolicyConfig:
|
|
| 114 |
)
|
| 115 |
|
| 116 |
|
| 117 |
-
def _trainer_config(planner_mode: str = "trainable") -> TrainerConfig:
|
| 118 |
return TrainerConfig(
|
| 119 |
-
policy_type=
|
| 120 |
use_bf16=False,
|
| 121 |
grad_clip_norm=1.0,
|
| 122 |
freeze_backbone=True,
|
|
@@ -226,6 +226,72 @@ def main() -> None:
|
|
| 226 |
)
|
| 227 |
proxy_optimizer.step()
|
| 228 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 229 |
rlbench_trainer_config = _trainer_config(planner_mode="proxy_pretrained")
|
| 230 |
rlbench_model = build_policy(policy_config, rlbench_trainer_config).to(device)
|
| 231 |
frozen_modules = apply_planner_mode(rlbench_model, rlbench_trainer_config)
|
|
@@ -283,6 +349,15 @@ def main() -> None:
|
|
| 283 |
"planner_enabled_for_eval": planner_gate,
|
| 284 |
"frozen_modules": frozen_modules,
|
| 285 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 286 |
"policy_config": asdict(policy_config),
|
| 287 |
}
|
| 288 |
|
|
|
|
| 17 |
from models.policy import PolicyConfig
|
| 18 |
from models.reveal_head import RevealHeadConfig
|
| 19 |
from models.world_model import RevealWMConfig
|
| 20 |
+
from sim_reveal.dataset import RGBD_PROXY_DATASET_VERSION, collect_teacher_dataset, dataset_from_bundle, load_teacher_dataset
|
| 21 |
from train.losses import LossWeights, compute_total_loss
|
| 22 |
from train.trainer import TrainerConfig, apply_planner_mode, build_policy, planner_enabled
|
| 23 |
|
|
|
|
| 68 |
num_layers=2,
|
| 69 |
ff_dim=128,
|
| 70 |
dropout=0.1,
|
| 71 |
+
chunk_size=8,
|
| 72 |
action_dim=14,
|
| 73 |
arm_action_dim=7,
|
| 74 |
num_candidates=4,
|
|
|
|
| 114 |
)
|
| 115 |
|
| 116 |
|
| 117 |
+
def _trainer_config(planner_mode: str = "trainable", policy_type: str = "interaction_state") -> TrainerConfig:
|
| 118 |
return TrainerConfig(
|
| 119 |
+
policy_type=policy_type,
|
| 120 |
use_bf16=False,
|
| 121 |
grad_clip_norm=1.0,
|
| 122 |
freeze_backbone=True,
|
|
|
|
| 226 |
)
|
| 227 |
proxy_optimizer.step()
|
| 228 |
|
| 229 |
+
rgbd_bundle = collect_teacher_dataset(
|
| 230 |
+
episodes_per_proxy=1,
|
| 231 |
+
resolution=32,
|
| 232 |
+
history_steps=2,
|
| 233 |
+
planner_candidates=4,
|
| 234 |
+
dataset_version=RGBD_PROXY_DATASET_VERSION,
|
| 235 |
+
)
|
| 236 |
+
rgbd_dataset = dataset_from_bundle(rgbd_bundle, resolution=int(rgbd_bundle["resolution"]))
|
| 237 |
+
rgbd_loader = DataLoader(rgbd_dataset, batch_size=args.batch_size, shuffle=False, num_workers=0)
|
| 238 |
+
rgbd_batch = _move_batch_to_device(next(iter(rgbd_loader)), device)
|
| 239 |
+
elastic_trainer_config = _trainer_config(planner_mode="trainable", policy_type="elastic_reveal")
|
| 240 |
+
elastic_model = build_policy(policy_config, elastic_trainer_config).to(device)
|
| 241 |
+
elastic_model.eval()
|
| 242 |
+
with torch.no_grad():
|
| 243 |
+
rgb_only_outputs = elastic_model(
|
| 244 |
+
images=rgbd_batch["images"],
|
| 245 |
+
proprio=rgbd_batch["proprio"],
|
| 246 |
+
texts=rgbd_batch["texts"],
|
| 247 |
+
history_images=rgbd_batch.get("history_images"),
|
| 248 |
+
history_proprio=rgbd_batch.get("history_proprio"),
|
| 249 |
+
history_actions=rgbd_batch.get("history_actions"),
|
| 250 |
+
plan=True,
|
| 251 |
+
use_depth=False,
|
| 252 |
+
)
|
| 253 |
+
rgbd_outputs = elastic_model(
|
| 254 |
+
images=rgbd_batch["images"],
|
| 255 |
+
depths=rgbd_batch["depths"],
|
| 256 |
+
depth_valid=rgbd_batch["depth_valid"],
|
| 257 |
+
camera_intrinsics=rgbd_batch["camera_intrinsics"],
|
| 258 |
+
camera_extrinsics=rgbd_batch["camera_extrinsics"],
|
| 259 |
+
proprio=rgbd_batch["proprio"],
|
| 260 |
+
texts=rgbd_batch["texts"],
|
| 261 |
+
history_images=rgbd_batch.get("history_images"),
|
| 262 |
+
history_depths=rgbd_batch.get("history_depths"),
|
| 263 |
+
history_depth_valid=rgbd_batch.get("history_depth_valid"),
|
| 264 |
+
history_proprio=rgbd_batch.get("history_proprio"),
|
| 265 |
+
history_actions=rgbd_batch.get("history_actions"),
|
| 266 |
+
plan=True,
|
| 267 |
+
use_depth=True,
|
| 268 |
+
compute_equivariance_probe=True,
|
| 269 |
+
)
|
| 270 |
+
noplanner_outputs = elastic_model(
|
| 271 |
+
images=rgbd_batch["images"],
|
| 272 |
+
depths=rgbd_batch["depths"],
|
| 273 |
+
depth_valid=rgbd_batch["depth_valid"],
|
| 274 |
+
proprio=rgbd_batch["proprio"],
|
| 275 |
+
texts=rgbd_batch["texts"],
|
| 276 |
+
history_images=rgbd_batch.get("history_images"),
|
| 277 |
+
history_depths=rgbd_batch.get("history_depths"),
|
| 278 |
+
history_depth_valid=rgbd_batch.get("history_depth_valid"),
|
| 279 |
+
history_proprio=rgbd_batch.get("history_proprio"),
|
| 280 |
+
history_actions=rgbd_batch.get("history_actions"),
|
| 281 |
+
plan=True,
|
| 282 |
+
use_depth=True,
|
| 283 |
+
use_planner=False,
|
| 284 |
+
)
|
| 285 |
+
dataset_v6_required = (
|
| 286 |
+
"depths",
|
| 287 |
+
"depth_valid",
|
| 288 |
+
"visibility_map",
|
| 289 |
+
"clearance_map",
|
| 290 |
+
"support_stability",
|
| 291 |
+
"reocclusion_target",
|
| 292 |
+
)
|
| 293 |
+
missing_v6_fields = [key for key in dataset_v6_required if key not in rgbd_batch]
|
| 294 |
+
|
| 295 |
rlbench_trainer_config = _trainer_config(planner_mode="proxy_pretrained")
|
| 296 |
rlbench_model = build_policy(policy_config, rlbench_trainer_config).to(device)
|
| 297 |
frozen_modules = apply_planner_mode(rlbench_model, rlbench_trainer_config)
|
|
|
|
| 349 |
"planner_enabled_for_eval": planner_gate,
|
| 350 |
"frozen_modules": frozen_modules,
|
| 351 |
},
|
| 352 |
+
"elastic_reveal": {
|
| 353 |
+
"rgb_only_candidate_shape": list(rgb_only_outputs["candidate_chunks"].shape),
|
| 354 |
+
"rgbd_candidate_shape": list(rgbd_outputs["candidate_chunks"].shape),
|
| 355 |
+
"rgbd_topk_shape": list(rgbd_outputs["planner_topk_indices"].shape),
|
| 356 |
+
"rgbd_rollout_shape": list(rgbd_outputs["planned_rollout"]["target_belief_field"].shape),
|
| 357 |
+
"noplanner_chunk_shape": list(noplanner_outputs["planned_chunk"].shape),
|
| 358 |
+
"equivariance_probe_shape": list(rgbd_outputs["equivariance_probe_action_mean"].shape),
|
| 359 |
+
"dataset_v6_missing_fields": missing_v6_fields,
|
| 360 |
+
},
|
| 361 |
"policy_config": asdict(policy_config),
|
| 362 |
}
|
| 363 |
|
code/reveal_vla_bimanual/train/trainer.py
CHANGED
|
@@ -6,7 +6,13 @@ from typing import Sequence
|
|
| 6 |
import torch
|
| 7 |
from torch import Tensor, nn
|
| 8 |
|
| 9 |
-
from models.policy import
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
from train.losses import LossWeights, compute_total_loss
|
| 11 |
|
| 12 |
|
|
@@ -21,11 +27,18 @@ class TrainerConfig:
|
|
| 21 |
plan_during_eval: bool = True
|
| 22 |
support_mode_conditioning: bool = True
|
| 23 |
planner_mode: str = "trainable"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
|
| 26 |
def build_policy(config: PolicyConfig, trainer_config: TrainerConfig) -> nn.Module:
|
| 27 |
config.backbone.freeze_backbone = trainer_config.freeze_backbone
|
| 28 |
config.backbone.gradient_checkpointing = trainer_config.gradient_checkpointing
|
|
|
|
|
|
|
| 29 |
if trainer_config.policy_type == "reveal_state":
|
| 30 |
return RevealBimanualPolicy(config)
|
| 31 |
if trainer_config.policy_type == "interaction_state":
|
|
@@ -34,7 +47,7 @@ def build_policy(config: PolicyConfig, trainer_config: TrainerConfig) -> nn.Modu
|
|
| 34 |
|
| 35 |
|
| 36 |
def policy_supports_planning(policy_type: str) -> bool:
|
| 37 |
-
return policy_type in {"reveal_state", "interaction_state"}
|
| 38 |
|
| 39 |
|
| 40 |
def planner_enabled(trainer_config: TrainerConfig, during_eval: bool) -> bool:
|
|
@@ -93,6 +106,22 @@ class BimanualTrainer:
|
|
| 93 |
forward_kwargs["support_mode_conditioning"] = self.config.support_mode_conditioning
|
| 94 |
if "candidate_action_chunks" in batch:
|
| 95 |
forward_kwargs["candidate_chunks_override"] = batch["candidate_action_chunks"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 96 |
model_output = self.model(**forward_kwargs)
|
| 97 |
losses = compute_total_loss(model_output, batch, weights=loss_weights)
|
| 98 |
losses["total"].backward()
|
|
|
|
| 6 |
import torch
|
| 7 |
from torch import Tensor, nn
|
| 8 |
|
| 9 |
+
from models.policy import (
|
| 10 |
+
BackboneOnlyPolicy,
|
| 11 |
+
ElasticRevealBimanualPolicy,
|
| 12 |
+
InteractionBimanualPolicy,
|
| 13 |
+
PolicyConfig,
|
| 14 |
+
RevealBimanualPolicy,
|
| 15 |
+
)
|
| 16 |
from train.losses import LossWeights, compute_total_loss
|
| 17 |
|
| 18 |
|
|
|
|
| 27 |
plan_during_eval: bool = True
|
| 28 |
support_mode_conditioning: bool = True
|
| 29 |
planner_mode: str = "trainable"
|
| 30 |
+
use_depth: bool = True
|
| 31 |
+
use_world_model: bool = True
|
| 32 |
+
use_role_tokens: bool = True
|
| 33 |
+
history_steps_override: int | None = None
|
| 34 |
+
compute_equivariance_probe: bool = True
|
| 35 |
|
| 36 |
|
| 37 |
def build_policy(config: PolicyConfig, trainer_config: TrainerConfig) -> nn.Module:
|
| 38 |
config.backbone.freeze_backbone = trainer_config.freeze_backbone
|
| 39 |
config.backbone.gradient_checkpointing = trainer_config.gradient_checkpointing
|
| 40 |
+
if trainer_config.policy_type == "elastic_reveal":
|
| 41 |
+
return ElasticRevealBimanualPolicy(config)
|
| 42 |
if trainer_config.policy_type == "reveal_state":
|
| 43 |
return RevealBimanualPolicy(config)
|
| 44 |
if trainer_config.policy_type == "interaction_state":
|
|
|
|
| 47 |
|
| 48 |
|
| 49 |
def policy_supports_planning(policy_type: str) -> bool:
|
| 50 |
+
return policy_type in {"reveal_state", "interaction_state", "elastic_reveal"}
|
| 51 |
|
| 52 |
|
| 53 |
def planner_enabled(trainer_config: TrainerConfig, during_eval: bool) -> bool:
|
|
|
|
| 106 |
forward_kwargs["support_mode_conditioning"] = self.config.support_mode_conditioning
|
| 107 |
if "candidate_action_chunks" in batch:
|
| 108 |
forward_kwargs["candidate_chunks_override"] = batch["candidate_action_chunks"]
|
| 109 |
+
if self.config.policy_type == "elastic_reveal":
|
| 110 |
+
forward_kwargs["depths"] = batch.get("depths")
|
| 111 |
+
forward_kwargs["depth_valid"] = batch.get("depth_valid")
|
| 112 |
+
forward_kwargs["camera_intrinsics"] = batch.get("camera_intrinsics")
|
| 113 |
+
forward_kwargs["camera_extrinsics"] = batch.get("camera_extrinsics")
|
| 114 |
+
forward_kwargs["history_depths"] = batch.get("history_depths")
|
| 115 |
+
forward_kwargs["history_depth_valid"] = batch.get("history_depth_valid")
|
| 116 |
+
forward_kwargs["use_depth"] = self.config.use_depth
|
| 117 |
+
forward_kwargs["use_world_model"] = self.config.use_world_model
|
| 118 |
+
forward_kwargs["use_planner"] = planner_enabled(self.config, during_eval=False)
|
| 119 |
+
forward_kwargs["use_role_tokens"] = self.config.use_role_tokens
|
| 120 |
+
forward_kwargs["history_steps_override"] = self.config.history_steps_override
|
| 121 |
+
forward_kwargs["compute_equivariance_probe"] = self.config.compute_equivariance_probe
|
| 122 |
+
elif self.config.policy_type == "interaction_state":
|
| 123 |
+
forward_kwargs["use_role_tokens"] = self.config.use_role_tokens
|
| 124 |
+
forward_kwargs["history_steps_override"] = self.config.history_steps_override
|
| 125 |
model_output = self.model(**forward_kwargs)
|
| 126 |
losses = compute_total_loss(model_output, batch, weights=loss_weights)
|
| 127 |
losses["total"].backward()
|
tests/__pycache__/test_dual_memory_contract.cpython-311-pytest-9.0.2.pyc
ADDED
|
Binary file (6.5 kB). View file
|
|
|