File size: 2,131 Bytes
37a82b7 | 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 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | #!/bin/bash
# FlowCache VBench sampling script
# Usage: bash flowcache_vbench.sh [yaml_config_path]
# Default config: yaml_config/sample/flowcache_vbench.yaml
export PAD_HQ=1
export PAD_DURATION=1
export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
export OFFLOAD_T5_CACHE=true
export OFFLOAD_VAE_CACHE=true
export TORCH_CUDA_ARCH_LIST="8.9;9.0"
MAGI_ROOT=$(git rev-parse --show-toplevel)
export PYTHONPATH="$MAGI_ROOT:$PYTHONPATH"
export MAGI_ROOT="$MAGI_ROOT"
# YAML config file path (can be overridden via command line argument)
YAML_CONFIG="${1:-yaml_config/sample/flowcache_vbench.yaml}"
if [ ! -f "$YAML_CONFIG" ]; then
echo "β YAML config file not found: $YAML_CONFIG"
exit 1
fi
echo "π Using YAML config: $YAML_CONFIG"
# Create log directory
LOG_DIR="./logs"
mkdir -p "$LOG_DIR"
LOG_FILE="$LOG_DIR/flowcache_vbench_$(date +%Y%m%d_%H%M%S).log"
exec > >(tee -a "$LOG_FILE") 2>&1
echo "π Starting multi-GPU benchmark sampling"
# Define list of dimensions to process
DIMENSIONS=("overall_consistency" "subject_consistency" "scene")
echo "π’ Total dimensions to process: ${#DIMENSIONS[@]}"
echo "π Dimensions: ${DIMENSIONS[*]}"
# Loop through each dimension
for DIMENSION in "${DIMENSIONS[@]}"; do
echo "π Processing dimension: $DIMENSION"
# Use Python to temporarily modify the dimension in YAML, then run sampling
python3 -c "
import yaml
import sys
# Read YAML config
with open('$YAML_CONFIG', 'r') as f:
config = yaml.safe_load(f)
# Modify dimension
config['dimension'] = '$DIMENSION'
# Save to temporary file
temp_config = '$YAML_CONFIG.tmp'
with open(temp_config, 'w') as f:
yaml.dump(config, f, default_flow_style=False)
print(temp_config)
" > /tmp/temp_config_path.txt
TEMP_CONFIG=$(cat /tmp/temp_config_path.txt)
python sample_video.py "$TEMP_CONFIG"
rm "$TEMP_CONFIG"
if [ $? -eq 0 ]; then
echo "β
Completed: $DIMENSION"
else
echo "β Failed: $DIMENSION"
echo "π Script paused due to error. Fix the issue and rerun."
exit 1
fi
echo "---"
done
echo "π All sampling tasks completed."
|