diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..239f832 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,26 @@ +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 \ +&& 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 \ +&& 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/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`) 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/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 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