File size: 1,307 Bytes
47b561f
 
 
 
 
 
 
f615dbd
47b561f
f615dbd
47b561f
f615dbd
47b561f
 
 
 
 
 
 
 
 
 
 
 
 
 
f615dbd
47b561f
 
f615dbd
47b561f
 
f615dbd
47b561f
 
 
 
 
 
 
 
 
 
 
 
f615dbd
47b561f
 
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
#!/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