File size: 2,590 Bytes
465d9ba | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | #!/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"
|