openpi / droid /scripts /run_preprocessing_chunked.sh
zhicao's picture
Upload folder using huggingface_hub
b584148 verified
Raw
History Blame Contribute Delete
1.64 kB
#!/bin/bash
# Run DROID preprocessing in chunks to avoid OOM
# Processes episodes 0-92232 in 3000-episode chunks
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR"
# Configuration
TOTAL_START=0
TOTAL_END=92233 # Exclusive
CHUNK_SIZE=3000
MAX_FRAMES=400
OUTPUT_DIR="/tmp/droid_rlds_final"
GPU_ID=0
echo "=========================================="
echo "DROID Preprocessing (Chunked)"
echo "=========================================="
echo "Total range: $TOTAL_START to $((TOTAL_END-1))"
echo "Chunk size: $CHUNK_SIZE episodes"
echo "Max frames: $MAX_FRAMES"
echo "Output: $OUTPUT_DIR"
echo "GPU: $GPU_ID"
echo "=========================================="
echo ""
# Process in chunks
for ((start=$TOTAL_START; start<$TOTAL_END; start+=CHUNK_SIZE)); do
end=$((start + CHUNK_SIZE))
if [ $end -gt $TOTAL_END ]; then
end=$TOTAL_END
fi
echo ""
echo "=========================================="
echo "Processing chunk: $start to $((end-1))"
echo "=========================================="
python3 preprocess_droid_rlds_final.py \
--start-episode $start \
--end-episode $end \
--max-frames $MAX_FRAMES \
--output-dir "$OUTPUT_DIR" \
--gpu-id $GPU_ID \
--save-previews 0
if [ $? -ne 0 ]; then
echo "ERROR: Chunk $start-$((end-1)) failed"
exit 1
fi
echo "✓ Chunk complete: $start-$((end-1))"
done
echo ""
echo "=========================================="
echo "✓ All preprocessing complete!"
echo "=========================================="
echo "Output directory: $OUTPUT_DIR"
echo ""