To perform high-performance video generation using multiple GPUs, use torchrun to execute hymm_sp/sample_batch.py. This method supports three primary customization modes:
- Single-Subject Video Customization: Generates video based on a reference image and text prompts.
- Video-Driven Video Customization (Video Editing): Uses an input video and a mask video to edit content, utilizing the
--video-condition flag. - Audio-Driven Video Customization: Generates video driven by an audio file, utilizing the
--audio-condition flag and --audio-strength to control influence.
Ensure MODEL_BASE and PYTHONPATH are set correctly before running.
### Run Single-Subject Video Customization
```bash
cd HunyuanCustom
export MODEL_BASE="./models"
export PYTHONPATH=./
torchrun --nnodes=1 --nproc_per_node=8 --master_port 29605 hymm_sp/sample_batch.py \
--ref-image './assets/images/seg_woman_01.png' \
--pos-prompt "Realistic, High-quality. A woman is drinking coffee at a café." \
--neg-prompt "Aerial view, aerial view, overexposed, low quality, deformation, a poor composition, bad hands, bad teeth, bad eyes, bad limbs, distortion, blurring, text, subtitles, static, picture, black border." \
--ckpt ${MODEL_BASE}"/hunyuancustom_720P/mp_rank_00_model_states.pt" \
--video-size 720 1280 \
--seed 1024 \
--sample-n-frames 129 \
--infer-steps 30 \
--flow-shift-eval-video 13.0 \
--save-path './results/sp_720p'
Run Video-Driven Video Customization (Video Editing)
cd HunyuanCustom
export MODEL_BASE="./models"
export PYTHONPATH=./
torchrun --nnodes=1 --nproc_per_node=8 --master_port 29605 hymm_sp/sample_batch.py \
--ref-image './assets/images/sed_red_panda.png' \
--input-video './assets/input_videos/001_bg.mp4' \
--mask-video './assets/input_videos/001_mask.mp4' \
--expand-scale 5 \
--video-condition \
--pos-prompt "Realistic, High-quality. A red panda is walking on a stone road." \
--neg-prompt "Aerial view, aerial view, overexposed, low quality, deformation, a poor composition, bad hands, bad teeth, bad eyes, bad limbs, distortion, blurring, text, subtitles, static, picture, black border." \
--ckpt ${MODEL_BASE}"/hunyuancustom_editing_720P/mp_rank_00_model_states.pt" \
--seed 1024 \
--infer-steps 50 \
--flow-shift-eval-video 5.0 \
--save-path './results/sp_editing_720p'
# --pose-enhance # Enable for human videos to improve pose generation quality.
Run Audio-Driven Video Customization
cd HunyuanCustom
export MODEL_BASE="./models"
export PYTHONPATH=./
torchrun --nnodes=1 --nproc_per_node=8 --master_port 29605 hymm_sp/sample_batch.py \
--ref-image './assets/images/seg_man_01.png' \
--input-audio './assets/audios/milk_man.mp3' \
--audio-strength 0.8 \
--audio-condition \
--pos-prompt "Realistic, High-quality. In the study, a man sits at a table featuring a bottle of milk while delivering a product presentation." \
--neg-prompt "Two people, two persons, aerial view, overexposed, low quality, deformation, a poor composition, bad hands, bad teeth, bad eyes, bad limbs, distortion, blurring, text, subtitles, static, picture, black border." \
--ckpt ${MODEL_BASE}"/hunyuancustom_audio_720P/mp_rank_00_model_states.pt" \
--seed 1026 \
--video-size 720 1280 \
--sample-n-frames 129 \
--cfg-scale 7.5 \
--infer-steps 30 \
--use-deepcache 1 \
--flow-shift-eval-video 13.0 \
--save-path './results/sp_audio_720p'