pragnakalp commited on
Commit
77e775a
·
verified ·
1 Parent(s): 53018a6

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +58 -16
Dockerfile CHANGED
@@ -2,6 +2,7 @@ FROM ubuntu:latest
2
 
3
  WORKDIR /content
4
 
 
5
  RUN apt-get update && apt-get install -y \
6
  python3 \
7
  python3-pip \
@@ -22,48 +23,89 @@ RUN apt-get update && apt-get install -y \
22
  libgtk2.0-0 \
23
  jq \
24
  libraw1394-dev \
25
- libopenblas-dev
26
-
27
- RUN alias python=python3
 
28
 
29
- RUN apt-get install -y gnupg wget htop sudo git git-lfs software-properties-common build-essential cmake curl
30
- RUN apt-get install -y ffmpeg libavcodec-dev libavformat-dev libavdevice-dev libgl1 libgtk2.0-0 jq libraw1394-dev libopenblas-dev
 
 
 
31
  RUN apt-add-repository -y universe
32
 
 
 
 
 
 
 
 
 
 
 
 
33
  RUN pip install git+https://github.com/One-sixth/fairseq.git --break-system-packages
34
- # RUN pip3 install distutils "setuptools==44.0.0" --break-system-packages
35
  RUN pip3 install numpy==1.26.4 --break-system-packages
36
- RUN pip3 install pandas scipy matplotlib torch torchvision ffmpeg-python imageio[ffmpeg] tensorboardX huggingface-hub g2p_en opencv-python fairseq imageio torchaudio gradio gtts soundfile fairseq huggingface-hub g2p_en altair imageio-ffmpeg pocketsphinx dlib ffmpeg jq --break-system-packages
37
-
 
 
38
  RUN pip install cmake==3.24.1.1 --break-system-packages
39
 
40
- RUN git clone https://github.com/TencentARC/GFPGAN.git && cd GFPGAN && pip install basicsr --break-system-packages && pip install facexlib --break-system-packages && pip install -r requirements.txt --break-system-packages && python3 setup.py develop && pip install realesrgan --break-system-packages
 
 
 
 
 
 
 
 
 
 
41
  COPY degradations.py /usr/local/lib/python3.12/dist-packages/basicsr/data/degradations.py
42
- RUN git clone https://github.com/chi0tzp/PyVideoFramesExtractor && cd PyVideoFramesExtractor && pip install -r requirements.txt --break-system-packages
43
 
 
 
 
 
 
 
44
  RUN git lfs install
45
- RUN git clone https://huggingface.co/camenduru/pocketsphinx-20.04-t4 pocketsphinx && cd pocketsphinx && cmake -S . -B build && cmake --build build --target install
46
- RUN git clone https://huggingface.co/camenduru/one-shot-talking-face-20.04-t4 one-shot-talking-face && cd one-shot-talking-face && pip install -r requirements.txt --break-system-packages && chmod 755 OpenFace/FeatureExtraction
 
 
 
 
 
 
 
 
 
 
47
  COPY util.py /content/one-shot-talking-face/models/util.py
48
  RUN sed -i 's/.cuda()/ /' one-shot-talking-face/test_script.py
49
  RUN sed -i 's/.cuda()/ /' one-shot-talking-face/tools/interface.py
50
  RUN sed -i 's/.load(checkpoint_path)/.load(checkpoint_path,map_location=torch.device("cpu")) /' one-shot-talking-face/tools/interface.py
51
  RUN sed -i 's/.load(audio2pose)/.load(audio2pose,map_location=torch.device("cpu")) /' one-shot-talking-face/tools/interface.py
52
- RUN mkdir /content/out
53
 
 
 
54
  COPY app.py /content/app.py
55
 
56
-
57
  RUN adduser --disabled-password --gecos '' admin
58
  RUN adduser admin sudo
59
  RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
60
-
61
  RUN chown -R admin:admin /content
62
  RUN chmod -R 777 /content
63
  RUN chown -R admin:admin /home
64
  RUN chmod -R 777 /home
65
- USER admin
66
 
 
67
  EXPOSE 7860
68
 
69
  CMD ["python3", "app.py"]
 
2
 
3
  WORKDIR /content
4
 
5
+ # Install system dependencies
6
  RUN apt-get update && apt-get install -y \
7
  python3 \
8
  python3-pip \
 
23
  libgtk2.0-0 \
24
  jq \
25
  libraw1394-dev \
26
+ libopenblas-dev \
27
+ # Add these dependencies for dlib
28
+ libx11-dev \
29
+ libatlas-base-dev
30
 
31
+ # Set Python alias
32
+ RUN alias python=python3
33
+
34
+ # Install additional dependencies
35
+ RUN apt-get install -y ffmpeg
36
  RUN apt-add-repository -y universe
37
 
38
+ # Pre-compile and install dlib separately with optimizations
39
+ RUN git clone https://github.com/davisking/dlib.git && \
40
+ cd dlib && \
41
+ mkdir build && \
42
+ cd build && \
43
+ cmake .. -DDLIB_USE_CUDA=0 -DUSE_AVX_INSTRUCTIONS=1 && \
44
+ cmake --build . && \
45
+ cd .. && \
46
+ python3 setup.py install --no USE_AVX_INSTRUCTIONS --no-DLIB_USE_CUDA
47
+
48
+ # Install Python packages (excluding dlib since we installed it separately)
49
  RUN pip install git+https://github.com/One-sixth/fairseq.git --break-system-packages
 
50
  RUN pip3 install numpy==1.26.4 --break-system-packages
51
+ RUN pip3 install pandas scipy matplotlib torch torchvision ffmpeg-python imageio[ffmpeg] \
52
+ tensorboardX huggingface-hub g2p_en opencv-python fairseq imageio torchaudio gradio \
53
+ gtts soundfile fairseq huggingface-hub g2p_en altair imageio-ffmpeg pocketsphinx \
54
+ ffmpeg jq --break-system-packages
55
  RUN pip install cmake==3.24.1.1 --break-system-packages
56
 
57
+ # Rest of the Dockerfile remains the same
58
+ # Install GFPGAN
59
+ RUN git clone https://github.com/TencentARC/GFPGAN.git && \
60
+ cd GFPGAN && \
61
+ pip install basicsr --break-system-packages && \
62
+ pip install facexlib --break-system-packages && \
63
+ pip install -r requirements.txt --break-system-packages && \
64
+ python3 setup.py develop && \
65
+ pip install realesrgan --break-system-packages
66
+
67
+ # Copy degradations file
68
  COPY degradations.py /usr/local/lib/python3.12/dist-packages/basicsr/data/degradations.py
 
69
 
70
+ # Install PyVideoFramesExtractor
71
+ RUN git clone https://github.com/chi0tzp/PyVideoFramesExtractor && \
72
+ cd PyVideoFramesExtractor && \
73
+ pip install -r requirements.txt --break-system-packages
74
+
75
+ # Install Git LFS and Pocketsphinx
76
  RUN git lfs install
77
+ RUN git clone https://huggingface.co/camenduru/pocketsphinx-20.04-t4 pocketsphinx && \
78
+ cd pocketsphinx && \
79
+ cmake -S . -B build && \
80
+ cmake --build build --target install
81
+
82
+ # Install One-Shot Talking Face
83
+ RUN git clone https://huggingface.co/camenduru/one-shot-talking-face-20.04-t4 one-shot-talking-face && \
84
+ cd one-shot-talking-face && \
85
+ pip install -r requirements.txt --break-system-packages && \
86
+ chmod 755 OpenFace/FeatureExtraction
87
+
88
+ # Copy utility file and modify scripts
89
  COPY util.py /content/one-shot-talking-face/models/util.py
90
  RUN sed -i 's/.cuda()/ /' one-shot-talking-face/test_script.py
91
  RUN sed -i 's/.cuda()/ /' one-shot-talking-face/tools/interface.py
92
  RUN sed -i 's/.load(checkpoint_path)/.load(checkpoint_path,map_location=torch.device("cpu")) /' one-shot-talking-face/tools/interface.py
93
  RUN sed -i 's/.load(audio2pose)/.load(audio2pose,map_location=torch.device("cpu")) /' one-shot-talking-face/tools/interface.py
 
94
 
95
+ # Setup output directory
96
+ RUN mkdir /content/out
97
  COPY app.py /content/app.py
98
 
99
+ # Setup user and permissions
100
  RUN adduser --disabled-password --gecos '' admin
101
  RUN adduser admin sudo
102
  RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
 
103
  RUN chown -R admin:admin /content
104
  RUN chmod -R 777 /content
105
  RUN chown -R admin:admin /home
106
  RUN chmod -R 777 /home
 
107
 
108
+ USER admin
109
  EXPOSE 7860
110
 
111
  CMD ["python3", "app.py"]