From f3461dac3a7e6824d8c11b52d289928f4277a6a5 Mon Sep 17 00:00:00 2001 From: Blake Mallory Date: Tue, 26 Jul 2022 23:46:49 -0400 Subject: [PATCH 1/3] added Docker support --- Dockerfile | 17 +++++++++++++++++ build_image.sh | 2 ++ run_image.sh | 2 ++ 3 files changed, 21 insertions(+) create mode 100644 Dockerfile create mode 100755 build_image.sh create mode 100755 run_image.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..1b95eca --- /dev/null +++ b/Dockerfile @@ -0,0 +1,17 @@ +FROM nvidia/cuda:11.3.1-cudnn8-devel-ubuntu20.04 + +ARG DEBIAN_FRONTEND=noninteractive +ENV TZ=Europe/London + +RUN apt-get update && apt-get upgrade -y +RUN apt install git -y \ +&& apt install python3 -y \ +&& apt install python3-pip -y \ +&& apt install git -y \ +&& apt install python-is-python3 -y \ +&& apt install python3-tk -y \ +&& apt install ffmpeg libsm6 libxext6 -y + +RUN pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu113 \ +&& pip install opencv-python + diff --git a/build_image.sh b/build_image.sh new file mode 100755 index 0000000..8f3ef3d --- /dev/null +++ b/build_image.sh @@ -0,0 +1,2 @@ +#!/bin/sh +docker build -t cog . \ No newline at end of file diff --git a/run_image.sh b/run_image.sh new file mode 100755 index 0000000..04a0d5e --- /dev/null +++ b/run_image.sh @@ -0,0 +1,2 @@ +#!/bin/sh +docker run --rm --name cog -it --gpus all -v "${PWD}":/workspace cog \ No newline at end of file From 30fcd4f9ff0c53306bc399605c131c8b6b6701e5 Mon Sep 17 00:00:00 2001 From: Blake Mallory Date: Wed, 27 Jul 2022 00:24:52 -0400 Subject: [PATCH 2/3] updated docker file and added script to instsall needed package post image --- Dockerfile | 11 ++++++++++- install_image_local_attention.sh | 3 +++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100755 install_image_local_attention.sh diff --git a/Dockerfile b/Dockerfile index 1b95eca..239f832 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,6 +3,9 @@ FROM nvidia/cuda:11.3.1-cudnn8-devel-ubuntu20.04 ARG DEBIAN_FRONTEND=noninteractive ENV TZ=Europe/London +SHELL ["/bin/bash", "-c"] + + RUN apt-get update && apt-get upgrade -y RUN apt install git -y \ && apt install python3 -y \ @@ -10,8 +13,14 @@ RUN apt install git -y \ && apt install git -y \ && apt install python-is-python3 -y \ && apt install python3-tk -y \ -&& apt install ffmpeg libsm6 libxext6 -y +&& apt install ffmpeg libsm6 libxext6 -y \ +&& apt install git -y + + +WORKDIR /workspace RUN pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu113 \ && pip install opencv-python + +RUN pip install SwissArmyTransformer>=0.2.9 icetk gifmaker diff --git a/install_image_local_attention.sh b/install_image_local_attention.sh new file mode 100755 index 0000000..df26da0 --- /dev/null +++ b/install_image_local_attention.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +pip install git+https://github.com/Sleepychord/Image-Local-Attention \ No newline at end of file From 11877f6173a446d4c8285e49761d7d9a5246ce3a Mon Sep 17 00:00:00 2001 From: Blake <39721523+mallorbc@users.noreply.github.com> Date: Wed, 27 Jul 2022 00:28:22 -0400 Subject: [PATCH 3/3] Updated README to add Docker --- README.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 94c467c..8989f43 100644 --- a/README.md +++ b/README.md @@ -55,10 +55,19 @@ A 4-second clip of 32 frames is shown below. * LocalAttention: Make sure you have CUDA installed and compile the local attention kernel. ```shell -git clone https://github.com/Sleepychord/Image-Local-Attention -cd Image-Local-Attention && python setup.py install +pip install git+https://github.com/Sleepychord/Image-Local-Attention ``` +## Docker +Alternatively you can use Docker to handle all dependencies. + +1. Run ```./build_image.sh``` +2. Run ```./run_image.sh``` +3. Run ```./install_image_local_attention``` + +Optionally, after that you can recommit the image to avoid having to install image local attention again. + + ### Download Our code will automatically download or detect the models into the path defined by environment variable `SAT_HOME`. You can also manually download [CogVideo-Stage1](https://lfs.aminer.cn/misc/cogvideo/cogvideo-stage1.zip) and [CogVideo-Stage2](https://lfs.aminer.cn/misc/cogvideo/cogvideo-stage2.zip) and place them under SAT_HOME (with folders named `cogvideo-stage1` and `cogvideo-stage2`)