Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

download weights automatically #149

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Use an official Python runtime as a parent image
FROM python:3.10

# Install necessary packages
RUN apt-get update && apt-get install -y \
ffmpeg \
&& rm -rf /var/lib/apt/lists/*

# Set the working directory in the container
WORKDIR /app/MuseTalk

# Copy the current directory contents into the container
COPY . /app/MuseTalk

# Install necessary Python packages
RUN pip install -r requirements.txt

# Install additional dependencies
RUN pip install --no-cache-dir -U openmim && \
mim install mmengine && \
mim install "mmcv>=2.0.1" && \
mim install "mmdet>=3.1.0" && \
mim install "mmpose>=1.1.0"

# Copy the weight download script into the container
COPY download_weights.sh /app/MuseTalk/download_weights.sh

# Run the weight download script
RUN chmod +x /app/MuseTalk/download_weights.sh && /app/MuseTalk/download_weights.sh

# Entrypoint to pass arguments
ENTRYPOINT ["python", "-m", "scripts.inference"]
354 changes: 39 additions & 315 deletions README.md

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions configs/inference/test1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
task_0:
video_path: "data/video/13_K.mp4"
audio_path: "data/audio/96_A.wav"

task_1:
video_path: "data/video/13_K.mp4"
audio_path: "data/audio/96_E.wav"

task_2:
video_path: "data/video/13_K.mp4"
audio_path: "data/audio/10_S.wav"

task_3:
video_path: "data/video/13_K.mp4"
audio_path: "data/audio/96_K.wav"

Binary file added data/audio/10_S.wav
Binary file not shown.
Binary file added data/audio/96_A.wav
Binary file not shown.
Binary file added data/audio/96_E.wav
Binary file not shown.
Binary file added data/audio/96_K.wav
Binary file not shown.
Binary file added data/video/13_K.mp4
Binary file not shown.
10 changes: 10 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: '3.8'

services:
musetalk:
build: .
volumes:
- .:/app/MuseTalk
environment:
- FFMPEG_PATH=/usr/local/bin/ffmpeg
command: ["--inference_config", "configs/inference/test1.yaml"]
54 changes: 54 additions & 0 deletions download_weights.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/bin/bash

# Define the checkpoints directory
CheckpointsDir="./models"

# Function to download and verify files
download_file() {
local url=$1
local output=$2

wget -O $output $url

# Verify file size is greater than 0
if [ ! -s $output ]; then
echo "Error: File $output is empty or download failed."
exit 1
fi
}

# Create the models directory if it does not exist
if [ ! -d "$CheckpointsDir" ]; then
mkdir -p $CheckpointsDir
echo "Checkpoint Not Downloaded, start downloading..."
tic=$(date +%s)

# Download MuseTalk weights
mkdir -p $CheckpointsDir
git clone https://huggingface.co/TMElyralab/MuseTalk $CheckpointsDir

# Download SD VAE weights
mkdir -p $CheckpointsDir/sd-vae-ft-mse
git clone https://huggingface.co/stabilityai/sd-vae-ft-mse $CheckpointsDir/sd-vae-ft-mse

# Download DWPose weights
mkdir -p $CheckpointsDir/dwpose
git clone https://huggingface.co/yzd-v/DWPose $CheckpointsDir/dwpose

# Download Whisper weights
mkdir -p $CheckpointsDir/whisper
download_file "https://openaipublic.azureedge.net/main/whisper/models/65147644a518d12f04e32d6f3b26facc3f8dd46e5390956a9424a650c0ce22b9/tiny.pt" "$CheckpointsDir/whisper/tiny.pt"

# Download Face Parse Bisent weights
mkdir -p $CheckpointsDir/face-parse-bisent
gdown --id 154JgKpzCPW82qINcVieuPH3fZ2e0P812 -O $CheckpointsDir/face-parse-bisent/79999_iter.pth

# Download ResNet weights
download_file "https://download.pytorch.org/models/resnet18-5c106cde.pth" "$CheckpointsDir/face-parse-bisent/resnet18-5c106cde.pth"

toc=$(date +%s)
echo "Download completed in $(($toc-$tic)) seconds"

else
echo "Model already downloaded."
fi