#!/usr/bin/bash set -x # ============================================================ # Preprocess LeRobot dataset -> LingBot-VA latents # Usage: # bash script/run_preprocess.sh # NGPU=4 bash script/run_preprocess.sh # NGPU=4 WORKERS_PER_GPU=2 bash script/run_preprocess.sh # DATASET_ROOT=/data/my_dataset bash script/run_preprocess.sh # DEBUG=1 bash script/run_preprocess.sh # ============================================================ # ---------- Required: modify these to your paths ---------- DATASET_ROOT=${DATASET_ROOT:-"/c20250502/szh/human_lerobot/final_dataset"} WAN_MODEL_ROOT=${WAN_MODEL_ROOT:-"/vepfs-mlp2/c20250502/haoce/szh/lingbot-va/Wan2.2-TI2V-5B-Diffusers"} CAMERA_KEYS=${CAMERA_KEYS:-"observation.images.main"} # ---------- Optional: defaults should be fine ---------- NGPU=${NGPU:-0} # 0 = auto-detect all GPUs WORKERS_PER_GPU=${WORKERS_PER_GPU:-4} HEIGHT=${HEIGHT:-256} WIDTH=${WIDTH:-256} TARGET_FPS=${TARGET_FPS:-10} SKIP_EXISTING=${SKIP_EXISTING:-1} # 1 = skip, 0 = re-encode OVERWRITE_ACTION_CFG=${OVERWRITE_ACTION_CFG:-0} # 1 = regenerate action_config DEBUG=${DEBUG:-0} # 1 = random debug mode, process only total worker count samples DEBUG_SEED=${DEBUG_SEED:-0} # random seed for debug sample selection # ---------- Build flags ---------- extra_flags="" if [ "${SKIP_EXISTING}" -eq 1 ]; then extra_flags="${extra_flags} --skip-existing" fi if [ "${OVERWRITE_ACTION_CFG}" -eq 1 ]; then extra_flags="${extra_flags} --overwrite-action-config" fi if [ "${DEBUG}" -eq 1 ]; then extra_flags="${extra_flags} --debug --debug-seed ${DEBUG_SEED}" fi # ---------- Run ---------- echo "[run_preprocess] DATASET_ROOT=${DATASET_ROOT}" echo "[run_preprocess] WAN_MODEL_ROOT=${WAN_MODEL_ROOT}" echo "[run_preprocess] CAMERA_KEYS=${CAMERA_KEYS}" echo "[run_preprocess] HEIGHT=${HEIGHT} WIDTH=${WIDTH} TARGET_FPS=${TARGET_FPS}" echo "[run_preprocess] NGPU=${NGPU} WORKERS_PER_GPU=${WORKERS_PER_GPU} SKIP_EXISTING=${SKIP_EXISTING} OVERWRITE_ACTION_CFG=${OVERWRITE_ACTION_CFG} DEBUG=${DEBUG} DEBUG_SEED=${DEBUG_SEED}" echo "[run_preprocess] Launching preprocess_lerobot_for_lingbot_mgme_v3.py" python -W ignore script/preprocess_lerobot_for_lingbot_mgme_v3.py \ --dataset-root "${DATASET_ROOT}" \ --wan-model-root "${WAN_MODEL_ROOT}" \ --camera-keys ${CAMERA_KEYS} \ --height ${HEIGHT} \ --width ${WIDTH} \ --target-fps ${TARGET_FPS} \ --num-gpus ${NGPU} \ --workers-per-gpu ${WORKERS_PER_GPU} \ ${extra_flags} echo "[run_preprocess] Preprocess finished"