Diffusers
English
stable-diffusion
stable-diffusion-diffusers
inpainting
art
artistic
anime
absolute-realism
Instructions to use diffusers/tools with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use diffusers/tools with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("diffusers/tools", 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 fuse_unfuse.py from diffusers/tools: direct link, hf CLI and curl.
- Browser
- Download file 651 Bytes
-
https://huggingface.co/diffusers/tools/resolve/main/fuse_unfuse.py
- Command line
-
hf download hf://diffusers/tools/fuse_unfuse.py
-
curl -L -o fuse_unfuse.py https://huggingface.co/diffusers/tools/resolve/main/fuse_unfuse.py
651 Bytes
| #!/usr/bin/env python3 | |
| import torch | |
| from diffusers import StableDiffusionXLPipeline | |
| pipe = StableDiffusionXLPipeline.from_pretrained( | |
| "stabilityai/stable-diffusion-xl-base-1.0", | |
| torch_dtype=torch.float16, | |
| ).to("cuda") | |
| #Fuse/unfuse first LoRA | |
| pipe.load_lora_weights("joachimsallstrom/aether-cloud-lora-for-sdxl") | |
| pipe.fuse_lora() | |
| pipe.unload_lora_weights() | |
| pipe.unfuse_lora() | |
| #Now it would be expected that the the LoRA has been unfused and `pipe` in the its original state, however... | |
| #Fuse/unfuse second LoRA | |
| pipe.load_lora_weights("jbilcke-hf/sdxl-zelda64") | |
| pipe.fuse_lora() | |
| pipe.unload_lora_weights() | |
| pipe.unfuse_lora() #errors out | |