Hunyuan-Avatar / start.sh
rahul7star's picture
Update start.sh
f615dbd verified
#!/bin/bash
export PYTHONPATH=./
export MODEL_BASE=./weights
MODEL_DIR=${MODEL_BASE}/ckpts/hunyuan-video-t2v-720p
CHECKPOINT_FILE=${MODEL_DIR}/transformers/mp_rank_00_model_states.pt
# Download model if not already downloaded
if [ -f "$CHECKPOINT_FILE" ]; then
echo "βœ… Model already exists. Skipping download."
else
echo "⬇️ Downloading model from Hugging Face..."
python3 - <<EOF
from huggingface_hub import snapshot_download
import os
target_dir = "${MODEL_DIR}"
os.makedirs(target_dir, exist_ok=True)
snapshot_download(
repo_id="tencent/HunyuanVideo-Avatar",
local_dir=target_dir,
local_dir_use_symlinks=False
)
EOF
if [ ! -f "$CHECKPOINT_FILE" ]; then
echo "❌ Failed to download model. Exiting."
exit 1
fi
echo "βœ… Model downloaded."
fi
# Start Flask inference in background
echo "πŸš€ Starting flask_audio.py..."
torchrun --nnodes=1 --nproc_per_node=8 --master_port 29605 hymm_gradio/flask_audio.py \
--input 'assets/test.csv' \
--ckpt ${CHECKPOINT_FILE} \
--sample-n-frames 129 \
--seed 128 \
--image-size 704 \
--cfg-scale 7.5 \
--infer-steps 50 \
--use-deepcache 1 \
--flow-shift-eval-video 5.0 &
# Launch Gradio UI
echo "🟒 Starting gradio_audio.py UI..."
python3 hymm_gradio/gradio_audio.py