harubaru / waifu-diffusion

stable diffusion finetuned on weeb stuff
GNU Affero General Public License v3.0
1.94k stars 177 forks source link

Apply xformers in diffusers_trainer.py #33

Closed laksjdjf closed 1 year ago

laksjdjf commented 1 year ago

apply xformers to reduce VRAM usage and improve performance.

GPU=A6000×1, batch size=2, resolution=768, step=1310 W B Chart 2022_11_9 10_23_51

harubaru commented 1 year ago

Are there any extra dependencies required for this change?

laksjdjf commented 1 year ago

Are there any extra dependencies required for this change?

it needs to install xformers library. https://github.com/facebookresearch/xformers

I did below in Paperspace gradient. it takes an hour.

git clone https://github.com/facebookresearch/xformers.git
cd xformers
git submodule update --init --recursive
pip install -r requirements.txt
python setup.py bdist_wheel
pip install dist/xformers-0.0.14.dev0-cp39-cp39-linux_x86_64.whl
laksjdjf commented 1 year ago

memory_efficient_attention is a new feature in diffusers 0.7 https://github.com/huggingface/diffusers/releases/tag/v0.7.0

harubaru commented 1 year ago

OK looks good, thanks!