Commit ·
1cdac6f
1
Parent(s): be66d07
refactor: move wav2lip installer to separate video-avatar repository
Browse filesThe Wav2Lip installer script was moved to a dedicated repository:
https://huggingface.co/marcosremar2/video-avatar-2024-12-24
This keeps dumont-talker focused on LiveKit/WebRTC connections while
video-avatar handles avatar lip-sync engines (MuseTalk, Wav2Lip).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- scripts/install_wav2lip.sh +0 -146
scripts/install_wav2lip.sh
DELETED
|
@@ -1,146 +0,0 @@
|
|
| 1 |
-
#!/bin/bash
|
| 2 |
-
# Wav2Lip-ONNX-HQ Installation Script
|
| 3 |
-
# Lightweight alternative to MuseTalk for lip-sync
|
| 4 |
-
# Tested on: RTX 4090, CUDA 12.x, Ubuntu
|
| 5 |
-
# Author: Dumont Talker Team
|
| 6 |
-
# Date: 2024-12-24
|
| 7 |
-
|
| 8 |
-
set -e
|
| 9 |
-
|
| 10 |
-
echo "=============================================="
|
| 11 |
-
echo " Wav2Lip-ONNX-HQ Installation Script"
|
| 12 |
-
echo "=============================================="
|
| 13 |
-
|
| 14 |
-
# Variables
|
| 15 |
-
INSTALL_DIR="${INSTALL_DIR:-/workspace}"
|
| 16 |
-
|
| 17 |
-
# Check if running as root or with sudo
|
| 18 |
-
if [ "$EUID" -ne 0 ]; then
|
| 19 |
-
echo "Please run as root or with sudo"
|
| 20 |
-
exit 1
|
| 21 |
-
fi
|
| 22 |
-
|
| 23 |
-
# Install system dependencies
|
| 24 |
-
echo ""
|
| 25 |
-
echo "=== Installing system dependencies ==="
|
| 26 |
-
apt-get update -qq
|
| 27 |
-
apt-get install -y -qq wget git ffmpeg python3-pip > /dev/null
|
| 28 |
-
|
| 29 |
-
# Clone Wav2Lip-ONNX-HQ repository
|
| 30 |
-
echo ""
|
| 31 |
-
echo "=== Cloning Wav2Lip-ONNX-HQ repository ==="
|
| 32 |
-
cd "$INSTALL_DIR"
|
| 33 |
-
if [ -d "wav2lip-onnx-HQ" ]; then
|
| 34 |
-
echo "wav2lip-onnx-HQ directory already exists, pulling latest changes"
|
| 35 |
-
cd wav2lip-onnx-HQ && git pull && cd ..
|
| 36 |
-
else
|
| 37 |
-
git clone --depth 1 https://github.com/instant-high/wav2lip-onnx-HQ.git
|
| 38 |
-
fi
|
| 39 |
-
cd wav2lip-onnx-HQ
|
| 40 |
-
|
| 41 |
-
# Install Python dependencies
|
| 42 |
-
echo ""
|
| 43 |
-
echo "=== Installing Python dependencies ==="
|
| 44 |
-
pip install -q numpy opencv-python onnxruntime-gpu tqdm librosa soundfile
|
| 45 |
-
|
| 46 |
-
# Create model directories
|
| 47 |
-
echo ""
|
| 48 |
-
echo "=== Creating model directories ==="
|
| 49 |
-
mkdir -p checkpoints faceID wav2lip_onnx_models
|
| 50 |
-
|
| 51 |
-
# Download models from Google Drive
|
| 52 |
-
echo ""
|
| 53 |
-
echo "=== Downloading models ==="
|
| 54 |
-
pip install -q gdown
|
| 55 |
-
|
| 56 |
-
# Models Google Drive folder: https://drive.google.com/drive/folders/1BGl9bmMtlGEMx_wwKufJrZChFyqjnlsQ
|
| 57 |
-
|
| 58 |
-
# Download wav2lip_gan.onnx (main lip-sync model)
|
| 59 |
-
if [ ! -f "checkpoints/wav2lip_gan.onnx" ]; then
|
| 60 |
-
echo "Downloading wav2lip_gan.onnx..."
|
| 61 |
-
gdown --id 1AipBxNrVQlgD7qAepQSFYDSVdI4eC-oR -O checkpoints/wav2lip_gan.onnx
|
| 62 |
-
fi
|
| 63 |
-
|
| 64 |
-
# Download wav2lip.onnx (alternative model)
|
| 65 |
-
if [ ! -f "checkpoints/wav2lip.onnx" ]; then
|
| 66 |
-
echo "Downloading wav2lip.onnx..."
|
| 67 |
-
gdown --id 1p9wFO_xHiP4xHo0KQcWJ_kVZLflJvq_L -O checkpoints/wav2lip.onnx
|
| 68 |
-
fi
|
| 69 |
-
|
| 70 |
-
# Download blendmasker.onnx (face blending)
|
| 71 |
-
if [ ! -f "checkpoints/blendmasker.onnx" ]; then
|
| 72 |
-
echo "Downloading blendmasker.onnx..."
|
| 73 |
-
gdown --id 1dXZK8hd1aKkOPaGFPMI6oiXC5N7zzXfv -O checkpoints/blendmasker.onnx
|
| 74 |
-
fi
|
| 75 |
-
|
| 76 |
-
# Download xseg.onnx (face segmentation)
|
| 77 |
-
if [ ! -f "checkpoints/xseg.onnx" ]; then
|
| 78 |
-
echo "Downloading xseg.onnx..."
|
| 79 |
-
gdown --id 1Zd7TSJF4b0x6-pFHn3nCDfLQHxd6RH8_ -O checkpoints/xseg.onnx
|
| 80 |
-
fi
|
| 81 |
-
|
| 82 |
-
# Download recognition.onnx (face recognition)
|
| 83 |
-
if [ ! -f "faceID/recognition.onnx" ]; then
|
| 84 |
-
echo "Downloading recognition.onnx..."
|
| 85 |
-
gdown --id 1c-Ib-hgb3rFcZjEAR1FnLKKgzUUlTkM5 -O faceID/recognition.onnx
|
| 86 |
-
fi
|
| 87 |
-
|
| 88 |
-
# Download denoiser.onnx
|
| 89 |
-
if [ ! -f "wav2lip_onnx_models/denoiser.onnx" ]; then
|
| 90 |
-
echo "Downloading denoiser.onnx..."
|
| 91 |
-
gdown --id 1XBhKaHKB5CmM3wPPddMbxCB0N_Ix1i1a -O wav2lip_onnx_models/denoiser.onnx
|
| 92 |
-
fi
|
| 93 |
-
|
| 94 |
-
# Patch for headless mode (no GUI)
|
| 95 |
-
echo ""
|
| 96 |
-
echo "=== Patching for headless mode ==="
|
| 97 |
-
|
| 98 |
-
# Fix ffmpeg.exe -> ffmpeg (Linux compatibility)
|
| 99 |
-
sed -i 's/ffmpeg\.exe/ffmpeg/g' inference_onnxModel.py
|
| 100 |
-
|
| 101 |
-
# Replace selectROI with auto full-frame (headless)
|
| 102 |
-
sed -i 's/roi = cv2.selectROI.*$/h, w = frame.shape[:2]; roi = (0, 0, w, h) # headless mode/g' inference_onnxModel.py
|
| 103 |
-
|
| 104 |
-
# Comment out GUI functions
|
| 105 |
-
sed -i 's/cv2.destroyAllWindows()/#cv2.destroyAllWindows() # headless/g' inference_onnxModel.py
|
| 106 |
-
sed -i 's/cv2.imshow.*$/#\0 # headless/g' inference_onnxModel.py
|
| 107 |
-
sed -i 's/cv2.waitKey.*$/#\0 # headless/g' inference_onnxModel.py
|
| 108 |
-
|
| 109 |
-
# Disable ESC key check
|
| 110 |
-
sed -i 's/if k == 27:/if False: # headless - disabled ESC check/g' inference_onnxModel.py
|
| 111 |
-
|
| 112 |
-
# Verify installation
|
| 113 |
-
echo ""
|
| 114 |
-
echo "=== Verifying installation ==="
|
| 115 |
-
python3 -c "
|
| 116 |
-
import onnxruntime as ort
|
| 117 |
-
print(f'ONNX Runtime version: {ort.__version__}')
|
| 118 |
-
providers = ort.get_available_providers()
|
| 119 |
-
print(f'Available providers: {providers}')
|
| 120 |
-
"
|
| 121 |
-
|
| 122 |
-
# List downloaded models
|
| 123 |
-
echo ""
|
| 124 |
-
echo "=== Downloaded models ==="
|
| 125 |
-
ls -lh checkpoints/ faceID/ wav2lip_onnx_models/
|
| 126 |
-
|
| 127 |
-
echo ""
|
| 128 |
-
echo "=============================================="
|
| 129 |
-
echo " Installation Complete!"
|
| 130 |
-
echo "=============================================="
|
| 131 |
-
echo ""
|
| 132 |
-
echo "To run Wav2Lip-ONNX-HQ:"
|
| 133 |
-
echo " cd $INSTALL_DIR/wav2lip-onnx-HQ"
|
| 134 |
-
echo ""
|
| 135 |
-
echo " python3 inference_onnxModel.py \\"
|
| 136 |
-
echo " --face /path/to/video.mp4 \\"
|
| 137 |
-
echo " --audio /path/to/audio.wav \\"
|
| 138 |
-
echo " --checkpoint_path checkpoints/wav2lip_gan.onnx \\"
|
| 139 |
-
echo " --outfile output.mp4 \\"
|
| 140 |
-
echo " --hq_output"
|
| 141 |
-
echo ""
|
| 142 |
-
echo "Options:"
|
| 143 |
-
echo " --hq_output Enable high-quality output with face enhancement"
|
| 144 |
-
echo " --static Use static image instead of video"
|
| 145 |
-
echo ""
|
| 146 |
-
echo "=============================================="
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|