Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +37 -42
Dockerfile
CHANGED
@@ -6,17 +6,10 @@ ENV MKL_THREADING_LAYER=GNU
|
|
6 |
# Install dependencies
|
7 |
RUN apt-get update && apt-get install -y \
|
8 |
git wget libgl1-mesa-glx libglib2.0-0 ffmpeg libx264-dev pkg-config \
|
9 |
-
build-essential cmake g++ python3
|
10 |
-
|
11 |
rm -rf /var/lib/apt/lists/*
|
12 |
|
13 |
-
# Ensure Python 3.9 is the default version
|
14 |
-
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1 && \
|
15 |
-
update-alternatives --set python3 /usr/bin/python3.9
|
16 |
-
|
17 |
-
# Upgrade pip & install dependencies for Python 3.9
|
18 |
-
RUN python3.9 -m pip install --no-cache-dir --upgrade pip setuptools wheel
|
19 |
-
|
20 |
# Add NVIDIA package repositories
|
21 |
RUN wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-keyring_1.0-1_all.deb && \
|
22 |
dpkg -i cuda-keyring_1.0-1_all.deb && \
|
@@ -25,53 +18,55 @@ RUN wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86
|
|
25 |
# Install CUDA Toolkit and cuDNN
|
26 |
RUN apt-get install -y cuda-toolkit-11-7 libcudnn8 libcudnn8-dev
|
27 |
|
|
|
|
|
|
|
|
|
28 |
# Set CUDA paths
|
29 |
-
ENV
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
CUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda \
|
31 |
CUDA_HOME=/usr/local/cuda \
|
32 |
LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH \
|
33 |
-
TORCH_CUDA_ARCH_LIST="8.6"
|
34 |
-
|
|
|
|
|
35 |
|
36 |
# Set working directory
|
37 |
-
WORKDIR /app
|
38 |
|
39 |
# Clone the repository
|
40 |
-
RUN git clone -b dev https://github.com/fffiloni/dreamtalk /app
|
41 |
-
|
42 |
-
# Create checkpoints directory if it doesn't exist
|
43 |
-
RUN mkdir -p /app/checkpoints
|
44 |
|
45 |
# Download model checkpoints
|
46 |
-
RUN wget https://huggingface.co/camenduru/dreamtalk/resolve/main/damo/dreamtalk/checkpoints/denoising_network.pth -O /app/checkpoints/denoising_network.pth
|
47 |
-
|
48 |
|
49 |
-
#
|
50 |
-
RUN
|
51 |
-
|
52 |
|
53 |
-
#
|
54 |
-
RUN
|
55 |
-
chown -R user:user /app
|
56 |
|
57 |
-
#
|
58 |
-
|
59 |
-
PYTHONUNBUFFERED=1 \
|
60 |
-
GRADIO_ALLOW_FLAGGING=never \
|
61 |
-
GRADIO_NUM_PORTS=1 \
|
62 |
-
GRADIO_SERVER_NAME=0.0.0.0 \
|
63 |
-
GRADIO_THEME=huggingface \
|
64 |
-
GRADIO_SHARE=False \
|
65 |
-
SYSTEM=spaces \
|
66 |
-
CUDA_DEVICE_ORDER=PCI_BUS_ID \
|
67 |
-
CUDA_VISIBLE_DEVICES=0
|
68 |
|
69 |
-
#
|
70 |
-
|
71 |
|
72 |
-
#
|
73 |
-
|
74 |
-
|
75 |
|
76 |
# Run the application
|
77 |
-
CMD ["
|
|
|
6 |
# Install dependencies
|
7 |
RUN apt-get update && apt-get install -y \
|
8 |
git wget libgl1-mesa-glx libglib2.0-0 ffmpeg libx264-dev pkg-config \
|
9 |
+
build-essential cmake g++ python3-dev software-properties-common \
|
10 |
+
wget gnupg2 libopenblas-dev && \
|
11 |
rm -rf /var/lib/apt/lists/*
|
12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
# Add NVIDIA package repositories
|
14 |
RUN wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-keyring_1.0-1_all.deb && \
|
15 |
dpkg -i cuda-keyring_1.0-1_all.deb && \
|
|
|
18 |
# Install CUDA Toolkit and cuDNN
|
19 |
RUN apt-get install -y cuda-toolkit-11-7 libcudnn8 libcudnn8-dev
|
20 |
|
21 |
+
# Create a user
|
22 |
+
RUN useradd -m -u 1000 user
|
23 |
+
USER user
|
24 |
+
|
25 |
# Set CUDA paths
|
26 |
+
ENV HOME=/home/user \
|
27 |
+
PATH=/home/user/.local/bin:/usr/local/cuda/bin:$PATH \
|
28 |
+
PYTHONPATH=$HOME/app \
|
29 |
+
PYTHONUNBUFFERED=1 \
|
30 |
+
GRADIO_ALLOW_FLAGGING=never \
|
31 |
+
GRADIO_NUM_PORTS=1 \
|
32 |
+
GRADIO_SERVER_NAME=0.0.0.0 \
|
33 |
+
GRADIO_THEME=huggingface \
|
34 |
+
GRADIO_SHARE=False \
|
35 |
+
SYSTEM=spaces \
|
36 |
CUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda \
|
37 |
CUDA_HOME=/usr/local/cuda \
|
38 |
LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH \
|
39 |
+
TORCH_CUDA_ARCH_LIST="8.6"
|
40 |
+
|
41 |
+
# Set CUDA & cuDNN paths
|
42 |
+
ENV CMAKE_PREFIX_PATH="/usr/local/cuda:/usr/lib/x86_64-linux-gnu/"
|
43 |
|
44 |
# Set working directory
|
45 |
+
WORKDIR $HOME/app
|
46 |
|
47 |
# Clone the repository
|
48 |
+
RUN git clone -b dev https://github.com/fffiloni/dreamtalk $HOME/app
|
|
|
|
|
|
|
49 |
|
50 |
# Download model checkpoints
|
51 |
+
RUN wget https://huggingface.co/camenduru/dreamtalk/resolve/main/damo/dreamtalk/checkpoints/denoising_network.pth -O $HOME/app/checkpoints/denoising_network.pth
|
52 |
+
RUN wget https://huggingface.co/camenduru/dreamtalk/resolve/main/damo/dreamtalk/checkpoints/renderer.pt -O $HOME/app/checkpoints/renderer.pt
|
53 |
|
54 |
+
# Upgrade pip & install dependencies
|
55 |
+
RUN pip install --upgrade pip setuptools wheel
|
56 |
+
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
|
57 |
|
58 |
+
# Install CMake first
|
59 |
+
RUN pip install cmake
|
|
|
60 |
|
61 |
+
# Install dlib with CUDA support (force source compilation)
|
62 |
+
RUN pip install --no-cache-dir dlib -vvv --no-binary dlib
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
|
64 |
+
# Copy application file
|
65 |
+
COPY app.py .
|
66 |
|
67 |
+
# Set CUDA environment variables
|
68 |
+
ENV CUDA_DEVICE_ORDER=PCI_BUS_ID
|
69 |
+
ENV CUDA_VISIBLE_DEVICES=0
|
70 |
|
71 |
# Run the application
|
72 |
+
CMD ["python", "app.py"]
|