Instructions to use AbdulElahGwaith/diffusers with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use AbdulElahGwaith/diffusers with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("AbdulElahGwaith/diffusers", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
|
Download docs/source/zh/optimization/xformers.md from AbdulElahGwaith/diffusers: direct link, hf CLI and curl.
- Browser
- Download file 1.42 kB
-
https://huggingface.co/AbdulElahGwaith/diffusers/resolve/main/docs/source/zh/optimization/xformers.md
- Command line
-
hf download hf://AbdulElahGwaith/diffusers/docs/source/zh/optimization/xformers.md
-
curl -L -o xformers.md https://huggingface.co/AbdulElahGwaith/diffusers/resolve/main/docs/source/zh/optimization/xformers.md
1.42 kB
xFormers
我们推荐在推理和训练过程中使用xFormers。在我们的测试中,其对注意力模块的优化能同时提升运行速度并降低内存消耗。
通过pip安装xFormers:
pip install xformers
xFormers的
pip安装包需要最新版本的PyTorch。如需使用旧版PyTorch,建议从源码安装xFormers。
安装完成后,您可调用enable_xformers_memory_efficient_attention()来实现更快的推理速度和更低的内存占用,具体用法参见此章节。
根据此问题反馈,xFormers
v0.0.16版本在某些GPU上无法用于训练(微调或DreamBooth)。如遇此问题,请按照该issue评论区指引安装开发版本。