Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -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/**
29 changes: 16 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,35 @@
# 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 . ```

This automates installing packages for PYTTI and downloading pre-trained models.

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

Expand All @@ -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```
112 changes: 39 additions & 73 deletions base-container/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,92 +1,58 @@

#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}

# Tensorboard
ARG TENSORBOARD_PORT=6006
EXPOSE ${TENSORBOARD_PORT}
ENV TENSORBOARD_PORT ${TENSORBOARD_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

# suppress interactive tzdata configuration
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

# for video in/out
RUN apt-get install -y ffmpeg

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

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
19 changes: 8 additions & 11 deletions full-container/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,33 @@ 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

# 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

#############


#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