Scheduled Commit
Browse files
scripts/train/dexmg_lifttray_finetune_wan22.sh
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# DreamZero fine-tuning on DexMimicGen bimanual_panda_hand.LiftTray (Wan2.2-TI2V-5B backbone),
|
| 3 |
+
# warm-started from the T-Rex LoRA checkpoint (checkpoints/dreamzero_trex_wan22_lora).
|
| 4 |
+
#
|
| 5 |
+
# DexMG LiftTray: two Panda arms + Inspire dexterous hands, 1000 generated demos.
|
| 6 |
+
# state 40-dim / action 24-dim (per side: delta-EEF pos+rot 6 + hand 6) -> max_action_dim=64
|
| 7 |
+
# 3 views: ego_view, left_wrist_view, right_wrist_view (256x256 @ 20fps, resized to 320x160)
|
| 8 |
+
#
|
| 9 |
+
# Usage:
|
| 10 |
+
# bash scripts/train/dexmg_lifttray_finetune_wan22.sh
|
| 11 |
+
#
|
| 12 |
+
# Prerequisites:
|
| 13 |
+
# 1) LiftTray LeRobot dataset downloaded, e.g. to
|
| 14 |
+
# /scratch1/home/zhicao/dexmimicgen/datasets/lerobot/bimanual_panda_hand.LiftTray
|
| 15 |
+
# 2) GEAR metadata generated on top of it (run once):
|
| 16 |
+
# python scripts/data/convert_lerobot_to_gear.py \
|
| 17 |
+
# --dataset-path /scratch1/home/zhicao/dexmimicgen/datasets/lerobot/bimanual_panda_hand.LiftTray \
|
| 18 |
+
# --embodiment-tag robocasa_bimanual_panda_inspire_hand \
|
| 19 |
+
# --action-horizon 24
|
| 20 |
+
# 3) Wan2.2-TI2V-5B / Wan2.1 CLIP / umt5-xxl weights (already under ./checkpoints)
|
| 21 |
+
|
| 22 |
+
export HYDRA_FULL_ERROR=1
|
| 23 |
+
|
| 24 |
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
| 25 |
+
SCRIPT_REPO_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
| 26 |
+
if [ -n "$DREAMZERO_ROOT" ] && [ -d "$DREAMZERO_ROOT/groot" ]; then
|
| 27 |
+
:
|
| 28 |
+
elif [ -d "$SCRIPT_REPO_ROOT/groot" ]; then
|
| 29 |
+
DREAMZERO_ROOT="$SCRIPT_REPO_ROOT"
|
| 30 |
+
else
|
| 31 |
+
echo "ERROR: Set DREAMZERO_ROOT to the dreamzero repo root that contains groot/."
|
| 32 |
+
exit 1
|
| 33 |
+
fi
|
| 34 |
+
|
| 35 |
+
# ============ USER CONFIGURATION ============
|
| 36 |
+
DEXMG_DATA_ROOT=${DEXMG_DATA_ROOT:-"/scratch1/home/zhicao/dexmimicgen/datasets/lerobot/bimanual_panda_hand.LiftTray"}
|
| 37 |
+
OUTPUT_DIR=${OUTPUT_DIR:-"$DREAMZERO_ROOT/checkpoints/dreamzero_dexmg_lifttray_wan22_lora"}
|
| 38 |
+
|
| 39 |
+
# Warm start: T-Rex LoRA checkpoint (7+22 joints per side -> 6+6 here; both pad to 64)
|
| 40 |
+
PRETRAINED_CKPT=${PRETRAINED_CKPT:-"$DREAMZERO_ROOT/checkpoints/dreamzero_trex_wan22_lora/checkpoint-16000"}
|
| 41 |
+
|
| 42 |
+
WAN22_CKPT_DIR=${WAN22_CKPT_DIR:-"$DREAMZERO_ROOT/checkpoints/Wan2.2-TI2V-5B"}
|
| 43 |
+
IMAGE_ENCODER_DIR=${IMAGE_ENCODER_DIR:-"$DREAMZERO_ROOT/checkpoints/Wan2.1-I2V-14B-480P"}
|
| 44 |
+
TOKENIZER_DIR=${TOKENIZER_DIR:-"$DREAMZERO_ROOT/checkpoints/umt5-xxl"}
|
| 45 |
+
# =============================================
|
| 46 |
+
|
| 47 |
+
# Validate dataset exists and is GEAR-converted
|
| 48 |
+
if [ ! -d "$DEXMG_DATA_ROOT" ]; then
|
| 49 |
+
echo "ERROR: DexMG LiftTray dataset not found at $DEXMG_DATA_ROOT"
|
| 50 |
+
exit 1
|
| 51 |
+
fi
|
| 52 |
+
if [ ! -f "$DEXMG_DATA_ROOT/meta/embodiment.json" ]; then
|
| 53 |
+
echo "ERROR: $DEXMG_DATA_ROOT/meta/embodiment.json missing - run convert_lerobot_to_gear.py first (see header)"
|
| 54 |
+
exit 1
|
| 55 |
+
fi
|
| 56 |
+
if [ ! -d "$PRETRAINED_CKPT" ]; then
|
| 57 |
+
echo "ERROR: warm-start checkpoint not found at $PRETRAINED_CKPT"
|
| 58 |
+
exit 1
|
| 59 |
+
fi
|
| 60 |
+
|
| 61 |
+
EXPERIMENT_PY="$DREAMZERO_ROOT/groot/vla/experiment/experiment.py"
|
| 62 |
+
cd "$DREAMZERO_ROOT"
|
| 63 |
+
|
| 64 |
+
torchrun --nproc_per_node=gpu --standalone "$EXPERIMENT_PY" \
|
| 65 |
+
report_to=wandb \
|
| 66 |
+
data=dreamzero/dexmg_lifttray_wan22 \
|
| 67 |
+
wandb_project=dreamzero \
|
| 68 |
+
train_architecture=lora \
|
| 69 |
+
num_frames=33 \
|
| 70 |
+
action_horizon=24 \
|
| 71 |
+
max_action_dim=64 \
|
| 72 |
+
++action_head_cfg.config.diffusion_model_cfg.action_dim=64 \
|
| 73 |
+
num_views=3 \
|
| 74 |
+
model=dreamzero/vla \
|
| 75 |
+
model/dreamzero/action_head=wan_flow_matching_action_tf_wan22 \
|
| 76 |
+
model/dreamzero/transform=dreamzero_cotrain \
|
| 77 |
+
num_frame_per_block=2 \
|
| 78 |
+
num_action_per_block=24 \
|
| 79 |
+
num_state_per_block=1 \
|
| 80 |
+
seed=42 \
|
| 81 |
+
training_args.learning_rate=1e-5 \
|
| 82 |
+
training_args.deepspeed="groot/vla/configs/deepspeed/zero2.json" \
|
| 83 |
+
save_steps=4000 \
|
| 84 |
+
training_args.warmup_ratio=0.05 \
|
| 85 |
+
output_dir="$OUTPUT_DIR" \
|
| 86 |
+
per_device_train_batch_size=1 \
|
| 87 |
+
max_steps=20000 \
|
| 88 |
+
weight_decay=1e-5 \
|
| 89 |
+
save_total_limit=5 \
|
| 90 |
+
upload_checkpoints=false \
|
| 91 |
+
bf16=true \
|
| 92 |
+
tf32=true \
|
| 93 |
+
eval_bf16=true \
|
| 94 |
+
dataloader_pin_memory=false \
|
| 95 |
+
dataloader_num_workers=1 \
|
| 96 |
+
save_lora_only=true \
|
| 97 |
+
max_chunk_size=4 \
|
| 98 |
+
save_strategy=steps \
|
| 99 |
+
enable_wandb_video_reconstruction=true \
|
| 100 |
+
wandb_video_reconstruction_steps=1000 \
|
| 101 |
+
wandb_video_reconstruction_episode=0 \
|
| 102 |
+
wandb_video_reconstruction_num_chunks=4 \
|
| 103 |
+
dexmg_data_root="$DEXMG_DATA_ROOT" \
|
| 104 |
+
pretrained_model_path="$PRETRAINED_CKPT" \
|
| 105 |
+
++action_head_cfg.config.defer_lora_injection=true \
|
| 106 |
+
dit_version="$WAN22_CKPT_DIR" \
|
| 107 |
+
text_encoder_pretrained_path="$WAN22_CKPT_DIR/models_t5_umt5-xxl-enc-bf16.pth" \
|
| 108 |
+
image_encoder_pretrained_path="$IMAGE_ENCODER_DIR/models_clip_open-clip-xlm-roberta-large-vit-huge-14.pth" \
|
| 109 |
+
vae_pretrained_path="$WAN22_CKPT_DIR/Wan2.2_VAE.pth" \
|
| 110 |
+
tokenizer_path="$TOKENIZER_DIR" \
|
| 111 |
+
"$@"
|