[example] diffusion install from docker (#2239)

* [builder] builder for scaled_upper_triang_masked_softmax

* add missing files

* fix a bug

* polish code

* [example] diffusion install from docker
pull/2242/head^2
Jiarui Fang 2022-12-30 16:25:24 +08:00 committed by GitHub
parent 57929a6210
commit 50cdf5430e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 55 additions and 4 deletions

View File

@ -24,7 +24,10 @@ this model uses a frozen CLIP ViT-L/14 text encoder to condition the model on te
<img src="https://raw.githubusercontent.com/hpcaitech/public_assets/main/colossalai/img/diffusion_demo.png" width=800/>
</p>
## 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

View File

@ -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 .

View File

@ -1,5 +1,5 @@
albumentations==1.3.0
opencv-python
opencv-python==4.6.0
pudb==2019.2
prefetch_generator
imageio==2.9.0