Initial commit: source code for minimax-h3
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Check for project name argument
|
||||
if [ -z "$1" ]; then
|
||||
echo "Usage: ./run_h3.sh <project_name> [step]"
|
||||
echo "Example: ./run_h3.sh surf_girl_v1 3"
|
||||
echo "Step options: 1 (Text Encoding), 2 (DiT Denoising), 3 (VAE Decoding), or omit to run all."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
PROJECT_NAME=$1
|
||||
STEP=$2
|
||||
BASE_DIR="/home/mikehu/data/AI/minimax-h3"
|
||||
BASE_DIR="/home/mikehu/data/AI/minimax-h3"
|
||||
PROJECT_DIR="$BASE_DIR/outputs/$PROJECT_NAME"
|
||||
VENV_PYTHON="$BASE_DIR/.venv/bin/python"
|
||||
|
||||
echo "----------------------------------------------------------------"
|
||||
echo "🚀 Initializing MiniMax-H3 Project: $PROJECT_NAME"
|
||||
echo "📂 Project Root: $PROJECT_DIR"
|
||||
echo "----------------------------------------------------------------"
|
||||
|
||||
# Create project directory
|
||||
mkdir -p "$PROJECT_DIR"
|
||||
|
||||
# Copy template config.py to the project directory if it doesn't exist
|
||||
if [ ! -f "$PROJECT_DIR/config.py" ]; then
|
||||
cp "$BASE_DIR/config_template.py" "$PROJECT_DIR/config.py"
|
||||
echo "📝 Copied template config.py to project folder. Please edit it for specific settings."
|
||||
else
|
||||
echo "📄 Using existing project config.py."
|
||||
fi
|
||||
|
||||
# CRITICAL: Change working directory to the project folder
|
||||
# This ensures that 'import config' finds the project-specific config.py
|
||||
# and all relative paths like 'result1_te_*.pt' are saved/loaded here.
|
||||
cd "$PROJECT_DIR"
|
||||
export PYTHONPATH="$BASE_DIR:$PYTHONPATH"
|
||||
|
||||
echo -e "\n----------------------------------------------------------------"
|
||||
if [ -z "$STEP" ] || [ "$STEP" == "1" ]; then
|
||||
if [ -n "$STEP" ] && [ "$STEP" != "1" ] && [ "$STEP" != "2" ] && [ "$STEP" != "3" ]; then echo "Invalid step $STEP"; exit 1; fi
|
||||
echo -e "\n[1/3] Running Step 1: Text Encoding..."
|
||||
$VENV_PYTHON $BASE_DIR/fl2va_step1.py
|
||||
fi
|
||||
|
||||
if [ -z "$STEP" ] || [ "$STEP" == "2" ]; then
|
||||
if [ -n "$STEP" ] && [ "$STEP" != "1" ] && [ "$STEP" != "2" ] && [ "$STEP" != "3" ]; then echo "Invalid step $STEP"; exit 1; fi
|
||||
echo -e "\n[2/3] Running Step 2: DiT Denoising..."
|
||||
$VENV_PYTHON $BASE_DIR/fl2va_step2.py
|
||||
fi
|
||||
|
||||
if [ -z "$STEP" ] || [ "$STEP" == "3" ]; then
|
||||
if [ -n "$STEP" ] && [ "$STEP" != "1" ] && [ "$STEP" != "2" ] && [ "$STEP" != "3" ]; then echo "Invalid step $STEP"; exit 1; fi
|
||||
echo -e "\n[3/3] Running Step 3: VAE Decoding..."
|
||||
$VENV_PYTHON $BASE_DIR/fl2va_step3.py
|
||||
fi
|
||||
|
||||
# Validate step argument if provided
|
||||
if [ -n "$STEP" ] && [[ ! "$STEP" =~ ^[1-3]$ ]]; then
|
||||
echo "Error: Step must be 1, 2, or 3."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -e "\n----------------------------------------------------------------"
|
||||
echo "✅ Project $PROJECT_NAME Completed Successfully!"
|
||||
echo "All assets (config, .pt, .mp4) are located in: $PROJECT_DIR"
|
||||
echo "----------------------------------------------------------------"
|
||||
date
|
||||
Reference in New Issue
Block a user