vla-sft-code-dreamzero / scripts /train /agibot_training.sh
poet70's picture
Upload folder using huggingface_hub
ac29381 verified
Raw
History Blame Contribute Delete
4.26 kB
#!/bin/bash
# DreamZero AGIbot Training Script
#
# Usage:
# # Set your dataset path and output directory, then run:
# bash scripts/train/agibot_training.sh
#
# Prerequisites:
# - AGIbot dataset in LeRobot format at AGIBOT_DATA_ROOT (state 32, action 22, 3 views: top_head, hand_left, hand_right)
# See docs/DATASET_TO_GEAR_AND_TRAIN.md for conversion instructions
# - Wan2.1-I2V-14B-480P weights (auto-downloaded or pre-downloaded from HuggingFace)
# Download: huggingface-cli download Wan-AI/Wan2.1-I2V-14B-480P --local-dir ./checkpoints/Wan2.1-I2V-14B-480P
# - umt5-xxl tokenizer (auto-downloaded or pre-downloaded from HuggingFace)
# Download: huggingface-cli download google/umt5-xxl --local-dir ./checkpoints/umt5-xxl
# - DreamZero-AgiBot pretrained checkpoint (for loading LoRA weights before fine-tuning)
# git clone https://huggingface.co/GEAR-Dreams/DreamZero-AgiBot ./checkpoints/DreamZero-AgiBot
export HYDRA_FULL_ERROR=1
# ============ CHANGE THESE VARIABLES ============
# Dataset path (AGIbot in LeRobot format: state 32, action 22, videos top_head, hand_left, hand_right)
AGIBOT_DATA_ROOT=${AGIBOT_DATA_ROOT:-"./data/agibot_lerobot"}
# Output directory for training checkpoints
OUTPUT_DIR=${OUTPUT_DIR:-"./checkpoints/dreamzero_agibot_lora_5k"}
# Number of GPUs to use (default: all visible GPUs, so 4-GPU machines use 4 without setting NUM_GPUS)
if [ -z "${NUM_GPUS}" ]; then
NUM_GPUS=$(nvidia-smi -L 2>/dev/null | wc -l)
fi
NUM_GPUS=${NUM_GPUS:-8}
# Model weight paths (download from HuggingFace if not already present)
WAN_CKPT_DIR=${WAN_CKPT_DIR:-"./checkpoints/Wan2.1-I2V-14B-480P"}
TOKENIZER_DIR=${TOKENIZER_DIR:-"./checkpoints/umt5-xxl"}
# =============================================
# ============ AUTO-DOWNLOAD WEIGHTS ============
if [ ! -d "$WAN_CKPT_DIR" ] || [ -z "$(ls -A "$WAN_CKPT_DIR" 2>/dev/null)" ]; then
echo "Wan2.1-I2V-14B-480P not found at $WAN_CKPT_DIR. Downloading from HuggingFace..."
huggingface-cli download Wan-AI/Wan2.1-I2V-14B-480P --local-dir "$WAN_CKPT_DIR"
fi
if [ ! -d "$TOKENIZER_DIR" ] || [ -z "$(ls -A "$TOKENIZER_DIR" 2>/dev/null)" ]; then
echo "umt5-xxl tokenizer not found at $TOKENIZER_DIR. Downloading from HuggingFace..."
huggingface-cli download google/umt5-xxl --local-dir "$TOKENIZER_DIR"
fi
# ================================================
# Validate dataset exists
if [ ! -d "$AGIBOT_DATA_ROOT" ]; then
echo "ERROR: AGIbot dataset not found at $AGIBOT_DATA_ROOT"
echo "Set AGIBOT_DATA_ROOT to your LeRobot-format AGIbot dataset (e.g. Dataset/3222_raw_assemble)"
exit 1
fi
torchrun --nproc_per_node $NUM_GPUS --standalone groot/vla/experiment/experiment.py \
report_to=wandb \
data=dreamzero/agibot_relative \
wandb_project=dreamzero \
train_architecture=lora \
num_frames=33 \
action_horizon=24 \
num_views=3 \
model=dreamzero/vla \
model/dreamzero/action_head=wan_flow_matching_action_tf \
model/dreamzero/transform=dreamzero_cotrain \
num_frame_per_block=2 \
num_action_per_block=24 \
num_state_per_block=1 \
seed=42 \
training_args.learning_rate=1e-5 \
training_args.deepspeed="groot/vla/configs/deepspeed/zero2.json" \
save_steps=2500 \
training_args.warmup_ratio=0.05 \
output_dir=$OUTPUT_DIR \
per_device_train_batch_size=1 \
max_steps=5000 \
weight_decay=1e-5 \
save_total_limit=10 \
upload_checkpoints=false \
bf16=true \
tf32=true \
eval_bf16=true \
dataloader_pin_memory=false \
dataloader_num_workers=1 \
image_resolution_width=320 \
image_resolution_height=176 \
save_lora_only=true \
max_chunk_size=4 \
frame_seqlen=880 \
save_strategy=steps \
agibot_data_root=$AGIBOT_DATA_ROOT \
dit_version=$WAN_CKPT_DIR \
text_encoder_pretrained_path=$WAN_CKPT_DIR/models_t5_umt5-xxl-enc-bf16.pth \
image_encoder_pretrained_path=$WAN_CKPT_DIR/models_clip_open-clip-xlm-roberta-large-vit-huge-14.pth \
vae_pretrained_path=$WAN_CKPT_DIR/Wan2.1_VAE.pth \
tokenizer_path=$TOKENIZER_DIR \
pretrained_model_path=./checkpoints/DreamZero-AgiBot \
++action_head_cfg.config.skip_component_loading=true \
++action_head_cfg.config.defer_lora_injection=true