Spaces:
Paused
Paused
FROM pytorch/pytorch:2.0.1-cuda11.7-cudnn8-runtime | |
ENV DEBIAN_FRONTEND=noninteractive | |
ENV MKL_THREADING_LAYER=GNU | |
# Install dependencies | |
RUN apt-get update && apt-get install -y \ | |
git wget libgl1-mesa-glx libglib2.0-0 ffmpeg libx264-dev pkg-config \ | |
build-essential cmake g++ python3-dev software-properties-common \ | |
wget gnupg2 libopenblas-dev && \ | |
rm -rf /var/lib/apt/lists/* | |
# Add NVIDIA package repositories | |
RUN wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-keyring_1.0-1_all.deb && \ | |
dpkg -i cuda-keyring_1.0-1_all.deb && \ | |
apt-get update | |
# Install CUDA Toolkit and cuDNN | |
RUN apt-get install -y cuda-toolkit-11-7 libcudnn8 libcudnn8-dev | |
# Create a user | |
RUN useradd -m -u 1000 user | |
USER user | |
# Set CUDA paths | |
ENV HOME=/home/user \ | |
PATH=/home/user/.local/bin:/usr/local/cuda/bin:$PATH \ | |
PYTHONPATH=$HOME/app \ | |
PYTHONUNBUFFERED=1 \ | |
GRADIO_ALLOW_FLAGGING=never \ | |
GRADIO_NUM_PORTS=1 \ | |
GRADIO_SERVER_NAME=0.0.0.0 \ | |
GRADIO_THEME=huggingface \ | |
GRADIO_SHARE=False \ | |
SYSTEM=spaces \ | |
CUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda \ | |
CUDA_HOME=/usr/local/cuda \ | |
LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH \ | |
TORCH_CUDA_ARCH_LIST="8.6" | |
# Set CUDA & cuDNN paths | |
ENV CMAKE_PREFIX_PATH="/usr/local/cuda:/usr/lib/x86_64-linux-gnu/" | |
# Set working directory | |
WORKDIR $HOME/app | |
# Clone the repository | |
RUN git clone -b dev https://github.com/fffiloni/dreamtalk $HOME/app | |
# Download model checkpoints | |
RUN wget https://huggingface.co/camenduru/dreamtalk/resolve/main/damo/dreamtalk/checkpoints/denoising_network.pth -O $HOME/app/checkpoints/denoising_network.pth | |
RUN wget https://huggingface.co/camenduru/dreamtalk/resolve/main/damo/dreamtalk/checkpoints/renderer.pt -O $HOME/app/checkpoints/renderer.pt | |
# Upgrade pip & install dependencies | |
RUN pip install --upgrade pip setuptools wheel | |
RUN pip install --no-cache-dir urllib3 transformers yacs scipy scikit-image scikit-learn PyYAML Pillow "numpy<2" opencv-python imageio ffmpeg-python av "moviepy<2" gradio | |
# Install CMake first | |
RUN pip install cmake | |
# Install dlib with CUDA support (force source compilation) | |
RUN pip install --no-cache-dir dlib -vvv --no-binary dlib | |
# Copy application file | |
COPY app.py . | |
# Set CUDA environment variables | |
ENV CUDA_DEVICE_ORDER=PCI_BUS_ID | |
ENV CUDA_VISIBLE_DEVICES=0 | |
# Run the application | |
CMD ["python", "app.py"] |