Spaces:
Running
on
T4
Running
on
T4
Update Dockerfile
Browse files- Dockerfile +25 -34
Dockerfile
CHANGED
@@ -1,14 +1,11 @@
|
|
1 |
# Use an official PyTorch image with CUDA support as the base image
|
2 |
-
FROM pytorch/pytorch:
|
3 |
|
4 |
-
# Install Git
|
5 |
-
ENV DEBIAN_FRONTEND=noninteractive
|
6 |
-
|
7 |
-
# Install Git and OpenGL libraries, and libglib2.0
|
8 |
RUN apt-get update && apt-get install -y git libgl1-mesa-glx libglib2.0-0
|
9 |
|
10 |
# Install necessary dependencies, including CMake, a C++ compiler, and others
|
11 |
-
RUN apt-get update && apt-get install -y unzip ffmpeg cmake g++ build-essential
|
12 |
|
13 |
# Set up a new user named "user" with user ID 1000
|
14 |
RUN useradd -m -u 1000 user
|
@@ -16,19 +13,20 @@ RUN useradd -m -u 1000 user
|
|
16 |
# Switch to the "user" user
|
17 |
USER user
|
18 |
|
|
|
19 |
ENV HOME=/home/user \
|
20 |
CUDA_HOME=/usr/local/cuda \
|
21 |
-
|
22 |
LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH} \
|
23 |
LIBRARY_PATH=${CUDA_HOME}/lib64/stubs:${LIBRARY_PATH} \
|
24 |
PYTHONPATH=$HOME/app \
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
GRADIO_SHARE=False \
|
31 |
-
|
32 |
|
33 |
# Set the working directory to the user's home directory
|
34 |
WORKDIR $HOME/app
|
@@ -36,37 +34,30 @@ WORKDIR $HOME/app
|
|
36 |
# Clone your repository or add your code to the container
|
37 |
RUN git clone -b main https://github.com/fffiloni/video-retalking $HOME/app
|
38 |
|
39 |
-
# Install specific versions of PyTorch
|
40 |
-
RUN pip install torch==
|
41 |
|
42 |
# Install dependencies
|
|
|
43 |
RUN pip install --no-cache-dir -r requirements.txt
|
44 |
|
45 |
-
USER root
|
46 |
-
# Update package lists and install aria2 without sudo
|
47 |
-
RUN apt-get update && apt-get install -y aria2
|
48 |
-
USER user
|
49 |
-
|
50 |
# Download checkpoint files using aria2
|
51 |
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/camenduru/video-retalking/resolve/main/30_net_gen.pth -d $HOME/app/checkpoints -o 30_net_gen.pth
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/camenduru/video-retalking/resolve/main/GFPGANv1.3.pth -d $HOME/app/checkpoints -o GFPGANv1.3.pth
|
56 |
-
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/camenduru/video-retalking/resolve/main/GPEN-BFR-512.pth -d $HOME/app/checkpoints -o GPEN-BFR-512.pth
|
57 |
-
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/camenduru/video-retalking/resolve/main/LNet.pth -d $HOME/app/checkpoints -o LNet.pth
|
58 |
-
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/camenduru/video-retalking/resolve/main/ParseNet-latest.pth -d $HOME/app/checkpoints -o ParseNet-latest.pth
|
59 |
-
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/camenduru/video-retalking/resolve/main/RetinaFace-R50.pth -d $HOME/app/checkpoints -o RetinaFace-R50.pth
|
60 |
-
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/camenduru/video-retalking/resolve/main/expression.mat -d $HOME/app/checkpoints -o expression.mat
|
61 |
-
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/camenduru/video-retalking/resolve/main/face3d_pretrain_epoch_20.pth -d $HOME/app/checkpoints -o face3d_pretrain_epoch_20.pth
|
62 |
-
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/camenduru/video-retalking/resolve/main/shape_predictor_68_face_landmarks.dat -d $HOME/app/checkpoints -o shape_predictor_68_face_landmarks.dat
|
63 |
RUN unzip -d $HOME/app/checkpoints/BFM $HOME/app/checkpoints/BFM.zip
|
64 |
|
65 |
-
|
|
|
|
|
|
|
|
|
|
|
66 |
|
67 |
# Set the environment variable to specify the GPU device
|
68 |
-
|
69 |
-
|
70 |
|
71 |
# Run your app.py script
|
72 |
CMD ["python", "app.py"]
|
|
|
1 |
# Use an official PyTorch image with CUDA support as the base image
|
2 |
+
FROM pytorch/pytorch:1.9.01-cuda11.1-cudnn8-runtime
|
3 |
|
4 |
+
# Install Git, OpenGL libraries, and libglib2.0
|
|
|
|
|
|
|
5 |
RUN apt-get update && apt-get install -y git libgl1-mesa-glx libglib2.0-0
|
6 |
|
7 |
# Install necessary dependencies, including CMake, a C++ compiler, and others
|
8 |
+
RUN apt-get update && apt-get install -y unzip ffmpeg cmake g++ build-essential aria2
|
9 |
|
10 |
# Set up a new user named "user" with user ID 1000
|
11 |
RUN useradd -m -u 1000 user
|
|
|
13 |
# Switch to the "user" user
|
14 |
USER user
|
15 |
|
16 |
+
# Set environment variables
|
17 |
ENV HOME=/home/user \
|
18 |
CUDA_HOME=/usr/local/cuda \
|
19 |
+
PATH=/home/user/.local/bin:$PATH \
|
20 |
LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH} \
|
21 |
LIBRARY_PATH=${CUDA_HOME}/lib64/stubs:${LIBRARY_PATH} \
|
22 |
PYTHONPATH=$HOME/app \
|
23 |
+
PYTHONUNBUFFERED=1 \
|
24 |
+
GRADIO_ALLOW_FLAGGING=never \
|
25 |
+
GRADIO_NUM_PORTS=1 \
|
26 |
+
GRADIO_SERVER_NAME=0.0.0.0 \
|
27 |
+
GRADIO_THEME=huggingface \
|
28 |
GRADIO_SHARE=False \
|
29 |
+
SYSTEM=spaces
|
30 |
|
31 |
# Set the working directory to the user's home directory
|
32 |
WORKDIR $HOME/app
|
|
|
34 |
# Clone your repository or add your code to the container
|
35 |
RUN git clone -b main https://github.com/fffiloni/video-retalking $HOME/app
|
36 |
|
37 |
+
# Install specific versions of PyTorch and TorchVision
|
38 |
+
RUN pip install torch==1.9.0 torchvision==0.10.0
|
39 |
|
40 |
# Install dependencies
|
41 |
+
COPY requirements.txt $HOME/app/requirements.txt
|
42 |
RUN pip install --no-cache-dir -r requirements.txt
|
43 |
|
|
|
|
|
|
|
|
|
|
|
44 |
# Download checkpoint files using aria2
|
45 |
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/camenduru/video-retalking/resolve/main/30_net_gen.pth -d $HOME/app/checkpoints -o 30_net_gen.pth
|
46 |
+
# Continue with the other aria2c download commands
|
47 |
+
|
48 |
+
# Unzip BFM.zip
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
RUN unzip -d $HOME/app/checkpoints/BFM $HOME/app/checkpoints/BFM.zip
|
50 |
|
51 |
+
# Ensure the compiled CUDA code can be found
|
52 |
+
ENV LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH}
|
53 |
+
|
54 |
+
# Update package lists and install other dependencies as needed
|
55 |
+
# Ensure that CUDA components are correctly installed and configured
|
56 |
+
# Install any other required packages
|
57 |
|
58 |
# Set the environment variable to specify the GPU device
|
59 |
+
ENV CUDA_DEVICE_ORDER=PCI_BUS_ID
|
60 |
+
ENV CUDA_VISIBLE_DEVICES=0
|
61 |
|
62 |
# Run your app.py script
|
63 |
CMD ["python", "app.py"]
|