From a05b1ed55129da2c8e776f971f1b1c04482fee84 Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Sun, 30 May 2021 14:41:39 -0400 Subject: [PATCH 1/6] revert Wav2Lip using Python3.6 with a PPA hack --- Dockerfile | 24 +++++++++++++++++++++--- models/Wav2Lip/requirements.txt | 5 +---- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index ee65c51a95..35102f6c4e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,6 +28,8 @@ RUN apt-get update #RUN ffmpeg -version #RUN sleep 100 +# Notes on packages: +# * software-properties-common - needed for `apt-add-repository` RUN apt-get install -y \ build-essential \ curl \ @@ -48,6 +50,7 @@ RUN apt-get install -y \ libxext6 \ libxrender-dev \ netcat \ + software-properties-common \ python-dev \ python3-pip \ python3.8 \ @@ -60,6 +63,21 @@ RUN apt-get install -y \ vim \ wget + +# Wav2Lip needs Python3.6 +# NB: we install python3-virtualenv as `python3.6 -m venv` won't work anymore +RUN add-apt-repository ppa:deadsnakes/ppa +RUN apt-get update +RUN apt-get install -y python3.6 +RUN apt-get install -y python3-virtualenv +RUN apt-get install -y python3.6-venv +RUN apt-get install -y python3.6-dev +#RUN apt-get install python3-virtualenv + + +RUN python3.6 --version +RUN python3.8 --version + # We need ffmpeg version >= 4.2 (https://superuser.com/a/579110) # http://ubuntuhandbook.org/index.php/2020/06/install-ffmpeg-4-3-via-ppa-ubuntu-18-04-16-04/ @@ -76,9 +94,9 @@ FROM pybuild-base as pybuild-requirements COPY models/Wav2Lip ./models/Wav2Lip WORKDIR models/Wav2Lip -RUN python3.8 --version -RUN python3.8 -m venv python - +# NB: We need Python3.6 +RUN python3.6 -m venv python +#RUN virtualenv -p /usr/bin/python3.6 ... wait RUN . python/bin/activate \ && pip install --upgrade pip \ && pip install -r requirements.txt \ diff --git a/models/Wav2Lip/requirements.txt b/models/Wav2Lip/requirements.txt index 25bf66c50a..de89d8f04b 100644 --- a/models/Wav2Lip/requirements.txt +++ b/models/Wav2Lip/requirements.txt @@ -2,12 +2,9 @@ librosa==0.7.0 numba==0.48 numpy==1.17.1 opencv-contrib-python==4.2.0.34 +opencv-python==4.1.0.25 python-magic==0.4.22 tensorflow==1.12.0 torch==1.1.0 torchvision==0.3.0 tqdm==4.45.0 - -# NB(bt, 2021-05-30): After upgrading ubuntu, the old opencv package isn't available -#opencv-python==4.1.0.25 -opencv-python==4.1.2.30 From 8abe0eee6279bef3b9c3d5f0bd105edf063681a3 Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Sun, 30 May 2021 15:24:26 -0400 Subject: [PATCH 2/6] notes --- Dockerfile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Dockerfile b/Dockerfile index 35102f6c4e..9fb1c9cb24 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,11 @@ # ==================== Python Build Base ==================== +# Authenticating with GHCR locally: +# https://docs.github.com/en/packages/working-with-a-github-packages-registry/migrating-to-the-container-registry-from-the-docker-registry +# ``` +# export CR_PAT=YOUR_TOKEN +# echo $CR_PAT | docker login ghcr.io -u USERNAME --password-stdin +# ``` #FROM nvidia/cuda:10.1-devel-ubuntu18.04 as pybuild-base FROM nvidia/cuda:11.3.0-devel-ubuntu20.04 as pybuild-base From 3b5c0b70eb1c730f8029a8ab5ca4387d02b19539 Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Sun, 30 May 2021 15:30:04 -0400 Subject: [PATCH 3/6] add pciutils --- Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 9fb1c9cb24..dbee07533d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -36,6 +36,7 @@ RUN apt-get update # Notes on packages: # * software-properties-common - needed for `apt-add-repository` +# * pciutils - needed for `lspci | grep -i nvidia` RUN apt-get install -y \ build-essential \ curl \ @@ -56,7 +57,7 @@ RUN apt-get install -y \ libxext6 \ libxrender-dev \ netcat \ - software-properties-common \ + pciutils \ python-dev \ python3-pip \ python3.8 \ @@ -64,6 +65,7 @@ RUN apt-get install -y \ python3.8-venv\ redis-tools \ silversearcher-ag \ + software-properties-common \ sox \ tmux \ vim \ From 6201f5c49a9ac9de948b0c4ab5240efe26c913ad Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Sun, 30 May 2021 16:03:44 -0400 Subject: [PATCH 4/6] install nvidia drivers --- Dockerfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Dockerfile b/Dockerfile index dbee07533d..ca42ff60ba 100644 --- a/Dockerfile +++ b/Dockerfile @@ -29,6 +29,10 @@ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone RUN apt-get update #RUN apt-cache search python3.8 +# NB: Here we install nvidia drivers +# NB: Avoid keyboard prompt +RUN DEBIAN_FRONTEND=noninteractive apt-get install -y nvidia-384 --no-install-recommends + # ffmpeg version 4.2.4-1ubuntu0.1 Copyright (c) 2000-2020 the FFmpeg developers #RUN apt-get install -y ffmpeg #RUN ffmpeg -version From ccd9a69ad71fbee9b3c8068296d8751340fca29c Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Sun, 30 May 2021 16:43:35 -0400 Subject: [PATCH 5/6] build with cached base image (test) let's see if this goes faster --- Dockerfile | 176 +++++++++++++++++++++++++++-------------------------- 1 file changed, 89 insertions(+), 87 deletions(-) diff --git a/Dockerfile b/Dockerfile index ca42ff60ba..7fe26f7fa6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,94 +1,96 @@ # ==================== Python Build Base ==================== -# Authenticating with GHCR locally: -# https://docs.github.com/en/packages/working-with-a-github-packages-registry/migrating-to-the-container-registry-from-the-docker-registry -# ``` -# export CR_PAT=YOUR_TOKEN -# echo $CR_PAT | docker login ghcr.io -u USERNAME --password-stdin -# ``` +FROM ghcr.io/storytold/docker-base-images-nvidia-cuda-experimental:080f96bc7087 as pybuild-base -#FROM nvidia/cuda:10.1-devel-ubuntu18.04 as pybuild-base -FROM nvidia/cuda:11.3.0-devel-ubuntu20.04 as pybuild-base - -# tzdata install hangs without presetting the time zone -ENV TZ=UTC -RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone - -# NB(2021-05-30): This is the image that Tacotron 2's Dockerfile specifies. -# I have not tried this, but it might be necessary. -#FROM pytorch/pytorch:nightly-devel-cuda10.0-cudnn7 -#ENV PATH /usr/local/nvidia/bin:/usr/local/cuda/bin:${PATH} - -# NB: https://github.com/NVIDIA/nvidia-docker/issues/864#issuecomment-439848887 -# NB: We do not install ffmpeg, since the version is 3.8.* series and we need 4.2.* +## Authenticating with GHCR locally: +## https://docs.github.com/en/packages/working-with-a-github-packages-registry/migrating-to-the-container-registry-from-the-docker-registry +## ``` +## export CR_PAT=YOUR_TOKEN +## echo $CR_PAT | docker login ghcr.io -u USERNAME --password-stdin +## ``` # -# NB(2021-05-30): We need to install `cython3` for building modern Tacotron 2 -# dependencies (ie. protoc) on old Ubuntu -# RUN apt-get update \ -# && apt-get install -y \ -RUN apt-get update -#RUN apt-cache search python3.8 - -# NB: Here we install nvidia drivers -# NB: Avoid keyboard prompt -RUN DEBIAN_FRONTEND=noninteractive apt-get install -y nvidia-384 --no-install-recommends - -# ffmpeg version 4.2.4-1ubuntu0.1 Copyright (c) 2000-2020 the FFmpeg developers -#RUN apt-get install -y ffmpeg -#RUN ffmpeg -version -#RUN sleep 100 - -# Notes on packages: -# * software-properties-common - needed for `apt-add-repository` -# * pciutils - needed for `lspci | grep -i nvidia` -RUN apt-get install -y \ - build-essential \ - curl \ - cython3 \ - ffmpeg \ - g++-7 \ - gcc-7 \ - git \ - htop \ - imagemagick \ - libc++-7-dev \ - libffi-dev \ - libgcc-7-dev \ - libmagic1 \ - libsm6 \ - libsndfile1 \ - libssl-dev \ - libxext6 \ - libxrender-dev \ - netcat \ - pciutils \ - python-dev \ - python3-pip \ - python3.8 \ - python3.8-dev \ - python3.8-venv\ - redis-tools \ - silversearcher-ag \ - software-properties-common \ - sox \ - tmux \ - vim \ - wget - - -# Wav2Lip needs Python3.6 -# NB: we install python3-virtualenv as `python3.6 -m venv` won't work anymore -RUN add-apt-repository ppa:deadsnakes/ppa -RUN apt-get update -RUN apt-get install -y python3.6 -RUN apt-get install -y python3-virtualenv -RUN apt-get install -y python3.6-venv -RUN apt-get install -y python3.6-dev -#RUN apt-get install python3-virtualenv - - -RUN python3.6 --version -RUN python3.8 --version +##FROM nvidia/cuda:10.1-devel-ubuntu18.04 as pybuild-base +#FROM nvidia/cuda:11.3.0-devel-ubuntu20.04 as pybuild-base +# +## tzdata install hangs without presetting the time zone +#ENV TZ=UTC +#RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone +# +## NB(2021-05-30): This is the image that Tacotron 2's Dockerfile specifies. +## I have not tried this, but it might be necessary. +##FROM pytorch/pytorch:nightly-devel-cuda10.0-cudnn7 +##ENV PATH /usr/local/nvidia/bin:/usr/local/cuda/bin:${PATH} +# +## NB: https://github.com/NVIDIA/nvidia-docker/issues/864#issuecomment-439848887 +## NB: We do not install ffmpeg, since the version is 3.8.* series and we need 4.2.* +## +## NB(2021-05-30): We need to install `cython3` for building modern Tacotron 2 +## dependencies (ie. protoc) on old Ubuntu +## RUN apt-get update \ +## && apt-get install -y \ +#RUN apt-get update +##RUN apt-cache search python3.8 +# +## NB: Here we install nvidia drivers +## NB: Avoid keyboard prompt +#RUN DEBIAN_FRONTEND=noninteractive apt-get install -y nvidia-384 --no-install-recommends +# +## ffmpeg version 4.2.4-1ubuntu0.1 Copyright (c) 2000-2020 the FFmpeg developers +##RUN apt-get install -y ffmpeg +##RUN ffmpeg -version +##RUN sleep 100 +# +## Notes on packages: +## * software-properties-common - needed for `apt-add-repository` +## * pciutils - needed for `lspci | grep -i nvidia` +#RUN apt-get install -y \ +# build-essential \ +# curl \ +# cython3 \ +# ffmpeg \ +# g++-7 \ +# gcc-7 \ +# git \ +# htop \ +# imagemagick \ +# libc++-7-dev \ +# libffi-dev \ +# libgcc-7-dev \ +# libmagic1 \ +# libsm6 \ +# libsndfile1 \ +# libssl-dev \ +# libxext6 \ +# libxrender-dev \ +# netcat \ +# pciutils \ +# python-dev \ +# python3-pip \ +# python3.8 \ +# python3.8-dev \ +# python3.8-venv\ +# redis-tools \ +# silversearcher-ag \ +# software-properties-common \ +# sox \ +# tmux \ +# vim \ +# wget +# +# +## Wav2Lip needs Python3.6 +## NB: we install python3-virtualenv as `python3.6 -m venv` won't work anymore +#RUN add-apt-repository ppa:deadsnakes/ppa +#RUN apt-get update +#RUN apt-get install -y python3.6 +#RUN apt-get install -y python3-virtualenv +#RUN apt-get install -y python3.6-venv +#RUN apt-get install -y python3.6-dev +##RUN apt-get install python3-virtualenv +# +# +#RUN python3.6 --version +#RUN python3.8 --version # We need ffmpeg version >= 4.2 (https://superuser.com/a/579110) # http://ubuntuhandbook.org/index.php/2020/06/install-ffmpeg-4-3-via-ppa-ubuntu-18-04-16-04/ From 7bca17ad73be7935ce3ac80d574d659d342e8584 Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Sun, 30 May 2021 16:47:54 -0400 Subject: [PATCH 6/6] put tacotron in the correct place --- Dockerfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Dockerfile b/Dockerfile index 7fe26f7fa6..9bcf4f8150 100644 --- a/Dockerfile +++ b/Dockerfile @@ -105,6 +105,8 @@ FROM ghcr.io/storytold/docker-base-images-nvidia-cuda-experimental:080f96bc7087 FROM pybuild-base as pybuild-requirements +WORKDIR / + COPY models/Wav2Lip ./models/Wav2Lip WORKDIR models/Wav2Lip @@ -116,6 +118,8 @@ RUN . python/bin/activate \ && pip install -r requirements.txt \ && deactivate +WORKDIR / + COPY models/tacotron2 ./models/tacotron2 WORKDIR models/tacotron2