#!/usr/bin/bash set -x umask 007 # ─── Config ─── GPUS_PER_NODE=${GPUS_PER_NODE:-8} LOG_RANK=${LOG_RANK:-"0"} CONFIG_NAME=${CONFIG_NAME:-"robotwin_pretrain"} SAVE_ROOT=${SAVE_ROOT:-"/c20250502/szh/train_out_ego2robotwin_postrain"} LOG_DIR=${LOG_DIR:-"${SAVE_ROOT}/logs/torchrun"} DEBUG=${DEBUG:-""} cache_root=${CACHE_ROOT:-"/vepfs-mlp2/c20250502/haoce/szh/lingbot-va/cache_v2"} debug_flag="" if [ -n "${DEBUG}" ]; then debug_flag="--debug" fi overrides="" if [ $# -ne 0 ]; then overrides="$*" fi # ─── Environment ─── export DATASET_VERSION="v2" export PYTHONUNBUFFERED=1 export PYTHONWARNINGS="ignore::UserWarning" export TOKENIZERS_PARALLELISM=false export PYTORCH_ALLOC_CONF="${PYTORCH_ALLOC_CONF:-expandable_segments:True}" # export TORCH_DISTRIBUTED_DEBUG=DETAIL export NCCL_IB_DISABLE=0 export NCCL_P2P_DISABLE=0 export NCCL_SHM_DISABLE=0 export NCCL_TIMEOUT=36000 export HF_HOME="${HF_HOME:-${cache_root}/hf_home}" export HF_DATASETS_CACHE="${HF_DATASETS_CACHE:-${cache_root}/hf_datasets}" export TMPDIR="${TMPDIR:-${cache_root}/tmp/node_${MLP_ROLE_INDEX}}" export TORCHINDUCTOR_CACHE_DIR="${TORCHINDUCTOR_CACHE_DIR:-${cache_root}/torchinductor}" export TRITON_CACHE_DIR="${TRITON_CACHE_DIR:-${cache_root}/triton}" export TORCH_EXTENSIONS_DIR="${TORCH_EXTENSIONS_DIR:-${cache_root}/torch_extensions}" export WANDB_API_KEY="${WANDB_API_KEY:-"705019b40922ce96942fbdca07c2b22ebc3891fe"}" export WANDB_BASE_URL="${WANDB_BASE_URL:-"https://api.wandb.ai"}" export WANDB_TEAM_NAME="${WANDB_TEAM_NAME:-"screatorx"}" export WANDB_PROJECT="${WANDB_PROJECT:-"lingbot-va-ego2robotwin-postrain"}" # ─── Setup dirs ─── mkdir -p "${HF_HOME}" "${HF_DATASETS_CACHE}" "${TMPDIR}" \ "${TORCHINDUCTOR_CACHE_DIR}" "${TRITON_CACHE_DIR}" \ "${TORCH_EXTENSIONS_DIR}" "${LOG_DIR}" # ─── Launch ─── echo "GPUS_PER_NODE: ${GPUS_PER_NODE}" LOG_FILE="${LOG_DIR}/train_node${MLP_ROLE_INDEX}_$(date +%Y%m%d_%H%M%S).log" mkdir -p ${LOG_DIR} torchrun \ --nnodes=$MLP_WORKER_NUM \ --node_rank=$MLP_ROLE_INDEX \ --master_addr=$MLP_WORKER_0_HOST \ --master_port=$MLP_WORKER_0_PORT \ --nproc_per_node=${GPUS_PER_NODE} \ -m wan_va.pretrain_v2 \ --config-name ${CONFIG_NAME} \ --save-root ${SAVE_ROOT} \ ${debug_flag} \ $overrides \ 2>&1 | tee ${LOG_FILE}