diff --git a/examples/images/diffusion/README.md b/examples/images/diffusion/README.md index 8583f3be2..00ee79ad5 100644 --- a/examples/images/diffusion/README.md +++ b/examples/images/diffusion/README.md @@ -24,7 +24,10 @@ this model uses a frozen CLIP ViT-L/14 text encoder to condition the model on te

-## Requirements +## Installation + +### Optional #1: install from source +#### Step 1: Requirements A suitable [conda](https://conda.io/) environment named `ldm` can be created and activated with: @@ -42,7 +45,7 @@ pip install transformers==4.19.2 diffusers invisible-watermark pip install -e . ``` -### install lightning +##### Step 2: install lightning ``` git clone https://github.com/1SAA/lightning.git @@ -52,7 +55,7 @@ export PACKAGE_NAME=pytorch pip install . ``` -### Install [Colossal-AI v0.1.12](https://colossalai.org/download/) From Our Official Website +##### Step 3:Install [Colossal-AI v0.1.12](https://colossalai.org/download/) From Our Official Website ``` pip install colossalai==0.1.12+torch1.12cu11.3 -f https://release.colossalai.org @@ -60,6 +63,13 @@ pip install colossalai==0.1.12+torch1.12cu11.3 -f https://release.colossalai.org > The specified version is due to the interface incompatibility caused by the latest update of [Lightning](https://github.com/Lightning-AI/lightning), which will be fixed in the near future. +### Optional #2: install from dockerfile + +``` +cd docker +docker build -t hpcaitech/diffusion:0.2.0 . +``` + ## Download the model checkpoint from pretrained ### stable-diffusion-v1-4 diff --git a/examples/images/diffusion/docker/Dockerfile b/examples/images/diffusion/docker/Dockerfile new file mode 100644 index 000000000..17cc8bc8b --- /dev/null +++ b/examples/images/diffusion/docker/Dockerfile @@ -0,0 +1,41 @@ +FROM hpcaitech/pytorch-cuda:1.12.0-11.3.0 + +# install torch +# RUN conda install pytorch torchvision torchaudio cudatoolkit=11.3 -c pytorch +RUN apt-get update +RUN apt-get install ffmpeg libsm6 libxext6 -y + +# install apex +RUN git clone https://github.com/NVIDIA/apex && \ + cd apex && \ + pip install -v --disable-pip-version-check --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" --global-option="--fast_layer_norm" ./ + +# install colossalai +# RUN git clone https://github.com/hpcaitech/ColossalAI.git \ +# && cd ./ColossalAI \ +# && pip install -v --no-cache-dir . + +RUN pip install colossalai==0.1.12+torch1.12cu11.3 -f https://release.colossalai.org + + +# install our lightning, it will be merged to Lightning official repo. +RUN git clone https://github.com/1SAA/lightning.git && \ + cd lightning && \ + git checkout strategy/colossalai && \ + export PACKAGE_NAME=pytorch && \ + pip install --no-cache-dir . + +# install titans +RUN pip install --no-cache-dir titans + +RUN git clone https://github.com/hpcaitech/ColossalAI.git && \ + cd ./ColossalAI/examples/images/diffusion && \ + pip install -r requirements.txt && \ + pip install --no-cache-dir transformers==4.19.2 diffusers invisible-watermark + +# install tensornvme +# RUN conda install cmake && \ +# git clone https://github.com/hpcaitech/TensorNVMe.git && \ +# cd TensorNVMe && \ +# pip install -r requirements.txt && \ +# pip install -v --no-cache-dir . diff --git a/examples/images/diffusion/requirements.txt b/examples/images/diffusion/requirements.txt index 5a83b2aa3..333f32d6e 100644 --- a/examples/images/diffusion/requirements.txt +++ b/examples/images/diffusion/requirements.txt @@ -1,5 +1,5 @@ albumentations==1.3.0 -opencv-python +opencv-python==4.6.0 pudb==2019.2 prefetch_generator imageio==2.9.0