From b849350d135732b889608d9781a17ce04128e9aa Mon Sep 17 00:00:00 2001 From: David Marx Date: Fri, 28 Jan 2022 15:03:35 -0800 Subject: [PATCH 1/6] git clone pytti linked to specific branch and commit for fetching CLI components. refactored model downloading code/procedures. --- full-container/Dockerfile | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/full-container/Dockerfile b/full-container/Dockerfile index 98bb7ec..7d5207a 100644 --- a/full-container/Dockerfile +++ b/full-container/Dockerfile @@ -2,25 +2,26 @@ ARG OWNER=pyttitools ARG BASE_CONTAINER=$OWNER/pytti-base:test FROM $BASE_CONTAINER - - RUN git clone https://github.com/openai/CLIP.git && \ git clone https://github.com/CompVis/taming-transformers.git && \ - git clone --branch p5 https://github.com/sportsracer48/pytti.git && \ git clone https://github.com/shariqfarooq123/AdaBins.git && \ git clone https://github.com/zacjiang/GMA.git - #git clone --branch p5.1 https://github.com/dmarx/pytti.git + +RUN git clone --branch p5-cli https://github.com/pytti-tools/pytti-core.git pytti && \ + cd pytti && \ + git checkout fc414318 # this works RUN touch /opt/colab/GMA/core/__init__.py COPY download_models.sh . -RUN mkdir ./models && ./download_models.sh -RUN mkdir -p AdaBins/pretrained && \ - cp models/AdaBins_nyu.pt AdaBins/pretrained/ +RUN mkdir ./models +RUN mkdir -p AdaBins/pretrained +#RUN ./download_models.sh && \ +# cp models/AdaBins_nyu.pt AdaBins/pretrained/ -#COPY models/AdaBins_nyu.pt AdaBins/pretrained/ +COPY models/AdaBins_nyu.pt AdaBins/pretrained/ ENV PYTHONPATH=/opt/colab/GMA/core:./:./pytti:/opt/colab @@ -28,10 +29,10 @@ ENV PYTHONPATH=/opt/colab/GMA/core:./:./pytti:/opt/colab #RUN ${PIP} install clearml -COPY ./pytti_cli_w_clearml.py . +#COPY ./pytti_cli_w_clearml.py . #COPY clearml.conf /root/clearml.conf -RUN touch /root/clearml.conf -COPY ./config /opt/colab/config +#RUN touch /root/clearml.conf +#COPY ./config /opt/colab/config CMD jupyter notebook --port $COLAB_PORT --NotebookApp.port_retries=0 --ip 0.0.0.0 --no-browser --NotebookApp.token=UniqueNewYork --allow-root From 599ef9c0b01a798353994386f5ec4bb43461f7ae Mon Sep 17 00:00:00 2001 From: David Marx Date: Fri, 28 Jan 2022 15:42:55 -0800 Subject: [PATCH 2/6] pushed command to single line to ensure docker parses future changes correctly --- full-container/Dockerfile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/full-container/Dockerfile b/full-container/Dockerfile index 7d5207a..5097586 100644 --- a/full-container/Dockerfile +++ b/full-container/Dockerfile @@ -7,9 +7,7 @@ RUN git clone https://github.com/openai/CLIP.git && \ git clone https://github.com/shariqfarooq123/AdaBins.git && \ git clone https://github.com/zacjiang/GMA.git -RUN git clone --branch p5-cli https://github.com/pytti-tools/pytti-core.git pytti && \ - cd pytti && \ - git checkout fc414318 +RUN git clone --branch p5-cli https://github.com/pytti-tools/pytti-core.git pytti && cd pytti && git checkout fc414318 # this works RUN touch /opt/colab/GMA/core/__init__.py From 44b7f16bd2249dc0e95b4a55ef41f1327e936469 Mon Sep 17 00:00:00 2001 From: David Marx Date: Sun, 30 Jan 2022 12:33:07 -0800 Subject: [PATCH 3/6] updated gitignore --- .gitignore | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index e05d7c4..820f445 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,21 @@ clearml.conf -models/** +MISC.txt + *.pt .ipynb_checkpoints/** +**/.ipynb_checkpoints/** + *tmp +.vscode/** + +images_out/** +videos/** +runs/** +models/** +backup/** +outputs/** + +AdaBins/** +CLIP/** +GMA/** +taming-transformers/** \ No newline at end of file From 55c1b466938a97da8f2fa22102863ad0b52619b6 Mon Sep 17 00:00:00 2001 From: David Marx Date: Sun, 30 Jan 2022 12:34:34 -0800 Subject: [PATCH 4/6] Updated README: clearml removed, mount videos dir --- README.md | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index fa95303..c4a0ff6 100644 --- a/README.md +++ b/README.md @@ -1,22 +1,17 @@ # pytti-docker -Port of PYTTI notebook geared towards local execution. Integrated with ClearML for job logging, monitoring, and comparison. +Port of PYTTI notebook geared towards local execution. Contributions welcome. ## Requirements * docker -* ClearML - - either a local instance (requires docker-compose) or create a free account on the hosted service - - Will change this to not be a requirement soon. - - Also planning to add support for WandB, etc. ## Setup 1. Clone and CD into this project -2. Add your `clearml.conf` to the root directory -3. Build the container +2. Build the container ``` $ docker build -t pytti:test . ``` @@ -24,11 +19,17 @@ Contributions welcome. 4. Start the container - ``` $ mkdir /opt/colab/images_out ``` - ``` $ docker run --rm -it -p 8181:8181 --gpus all -v /opt/colab/images_out:/opt/colab/images_out pytti:test ``` + ``` +$ mkdir /opt/colab/images_out +$ docker run --rm -it \ + -p 8181:8181 \ + --gpus all\ + -v /opt/colab/images_out:/opt/colab/images_out \ + -v /opt/colab/videos:/opt/colab/videos + pytti:test +``` - - You should know have a jupyter server running at http://localhost:8181/lab?token=UniqueNewYork . (You should change that token for security) + You should now have a jupyter server running at http://localhost:8181/lab?token=UniqueNewYork . (You should change that token for security) ## Usage @@ -41,6 +42,8 @@ Additionally, the container contains a modified version of the notebook code whi 2. Open a terminal on the jupyter server 3. Run the script, passing the experiment defining config as an argument for hydra. - ``` $ python pytti_cli_w_clearml.py conf=demo ``` + ``` $ python pytti/workhorse.py conf=demo ``` - Because the config is managed by hydra, you can override experiment parameters by specifspecified them on the command line. + Because the config is managed by hydra, you can override experiment parameters by specifying them on the command line, e.g. + + ``` $ python pytti/workhorse.py conf=demo save_every=20 steps_per_scene=1000``` From c3d682a23d5f0cb10c5e1df04ff2553ee8467860 Mon Sep 17 00:00:00 2001 From: David Marx Date: Sun, 30 Jan 2022 12:37:33 -0800 Subject: [PATCH 5/6] cleaned up base dockerfile, using pytti-core/requirements.txt, moved pytti-core clone from full to base image --- base-container/Dockerfile | 105 ++++++++++++++------------------------ full-container/Dockerfile | 2 - 2 files changed, 38 insertions(+), 69 deletions(-) diff --git a/base-container/Dockerfile b/base-container/Dockerfile index a7b4388..244fcad 100644 --- a/base-container/Dockerfile +++ b/base-container/Dockerfile @@ -1,92 +1,63 @@ - -#ARG CUDA_VERSION=11.3 - FROM nvidia/cuda:11.3.1-cudnn8-runtime-ubuntu20.04 -# install Python +# CI/CD +ARG CI_BRANCH_NAME=p5-cli + +# Python ARG _PY_SUFFIX=3 ARG PYTHON=python${_PY_SUFFIX} ARG PIP=pip${_PY_SUFFIX} -RUN apt-get update && apt-get -y dist-upgrade +# Jupyter +ARG COLAB_PORT=8181 +EXPOSE ${COLAB_PORT} +ENV COLAB_PORT ${COLAB_PORT} -RUN apt-get install -y \ - ${PYTHON} \ - ${PYTHON}-pip +################# + +#RUN apt-get update && apt-get -y dist-upgrade +RUN apt-get update --fix-missing && apt-get -y dist-upgrade + +#RUN apt-get install -y \ +RUN DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC \ + apt-get install -y \ + ${PYTHON} \ + ${PYTHON}-pip \ + git \ + curl \ + tzdata \ + ffmpeg \ + python3-opencv RUN ${PIP} --no-cache-dir install --upgrade \ - pip \ - setuptools + pip RUN ln -s $(which ${PYTHON}) /usr/local/bin/python -########## - -RUN apt-get install -y \ - git \ - curl - RUN mkdir -p /opt/colab/images_out +RUN mkdir -p /opt/colab/videos WORKDIR /opt/colab -#COPY pytti_5_beta.ipynb . -RUN git clone https://github.com/pytti-tools/pytti-notebook.git -RUN cp pytti-notebook/pytti_5_beta.ipynb . - -#RUN pip install -r requirements.txt \ -RUN ${PIP} install jupyterlab==3.2.5 ipywidgets \ +RUN ${PIP} install --no-cache-dir jupyterlab==3.2.5 ipywidgets \ && jupyter nbextension enable --py widgetsnbextension -# https://pytorch.org/get-started/locally/ -RUN ${PIP} install \ - torch==1.10.1+cu113 \ - torchvision==0.11.2+cu113 \ - torchaudio==0.10.1+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html - -ARG COLAB_PORT=8181 -EXPOSE ${COLAB_PORT} -ENV COLAB_PORT ${COLAB_PORT} - -############# -# pytti requirements - -RUN ${PIP} install \ - tensorflow==2.7.0 \ - transformers==4.15.0 - -RUN ${PIP} install \ - gdown===4.2.0 \ - PyGLM==2.5.7 \ - ftfy==6.0.3 \ - regex \ - tqdm==4.62.3 \ - omegaconf==2.1.1 \ - pytorch-lightning==1.5.7 \ - kornia==0.6.2 \ - einops==0.3.2 \ - imageio-ffmpeg==0.4.5 \ - adjustText \ - exrex \ - bunch==1.0.1 \ - matplotlib-label-lines==0.4.3 \ - pandas==1.3.4 \ - imageio==2.13.5 \ - seaborn==0.11.2 \ - scikit-learn \ - loguru \ - hydra-core \ - setuptools==59.5.0 +RUN ${PIP} install --no-cache-dir --use-deprecated=html5lib \ + torch==1.10.2+cu113 \ + torchvision==0.11.3+cu113 \ + torchaudio==0.10.2+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html # suppress interactive tzdata configuration -RUN DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install tzdata +#RUN DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install tzdata # install cv2 -# experiencing issues all of a sudden. Hopefully --fix-missing resolves it? -RUN apt-get update --fix-missing -RUN apt-get install -y python3-opencv +#RUN apt-get update --fix-missing +#RUN apt-get install -y python3-opencv # for video in/out -RUN apt-get install -y ffmpeg - +#RUN apt-get install -y ffmpeg +RUN git clone --branch ${CI_BRANCH_NAME} https://github.com/pytti-tools/pytti-core.git pytti && cd pytti && git checkout da342e7 +RUN git clone --branch ${CI_BRANCH_NAME} https://github.com/pytti-tools/pytti-notebook.git && cd pytti-notebook && git checkout 09c1d32 +RUN cp pytti-notebook/pytti_5_beta.ipynb . +RUN ${PIP} install --no-cache-dir -r pytti/requirements.txt diff --git a/full-container/Dockerfile b/full-container/Dockerfile index 5097586..f0d172c 100644 --- a/full-container/Dockerfile +++ b/full-container/Dockerfile @@ -7,8 +7,6 @@ RUN git clone https://github.com/openai/CLIP.git && \ git clone https://github.com/shariqfarooq123/AdaBins.git && \ git clone https://github.com/zacjiang/GMA.git -RUN git clone --branch p5-cli https://github.com/pytti-tools/pytti-core.git pytti && cd pytti && git checkout fc414318 - # this works RUN touch /opt/colab/GMA/core/__init__.py From 0eb7b114fea3185a3cd04e82a3e0cdf4aab0a4b2 Mon Sep 17 00:00:00 2001 From: David Marx Date: Sun, 30 Jan 2022 15:00:10 -0800 Subject: [PATCH 6/6] exposed port for tensorboard in base container --- base-container/Dockerfile | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/base-container/Dockerfile b/base-container/Dockerfile index 244fcad..55b43d0 100644 --- a/base-container/Dockerfile +++ b/base-container/Dockerfile @@ -13,6 +13,11 @@ ARG COLAB_PORT=8181 EXPOSE ${COLAB_PORT} ENV COLAB_PORT ${COLAB_PORT} +# Tensorboard +ARG TENSORBOARD_PORT=6006 +EXPOSE ${TENSORBOARD_PORT} +ENV TENSORBOARD_PORT ${TENSORBOARD_PORT} + ################# #RUN apt-get update && apt-get -y dist-upgrade @@ -46,16 +51,6 @@ RUN ${PIP} install --no-cache-dir --use-deprecated=html5lib \ torchvision==0.11.3+cu113 \ torchaudio==0.10.2+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html -# suppress interactive tzdata configuration -#RUN DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install tzdata - -# install cv2 -#RUN apt-get update --fix-missing -#RUN apt-get install -y python3-opencv - -# for video in/out -#RUN apt-get install -y ffmpeg - RUN git clone --branch ${CI_BRANCH_NAME} https://github.com/pytti-tools/pytti-core.git pytti && cd pytti && git checkout da342e7 RUN git clone --branch ${CI_BRANCH_NAME} https://github.com/pytti-tools/pytti-notebook.git && cd pytti-notebook && git checkout 09c1d32 RUN cp pytti-notebook/pytti_5_beta.ipynb .