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
| #!/usr/bin/env python3 | |
| from diffusers import DiffusionPipeline | |
| import torch | |
| path = "runwayml/stable-diffusion-v1-5" | |
| run_compile = False # Set True / False | |
| pipe = DiffusionPipeline.from_pretrained(path, torch_dtype=torch.float16) | |
| pipe = pipe.to("cuda:0") | |
| pipe.unet.to(memory_format=torch.channels_last) | |
| if run_compile: | |
| print("Run torch compile") | |
| pipe.unet = torch.compile(pipe.unet, mode="reduce-overhead", fullgraph=True) | |
| prompt = "ghibli style, a fantasy landscape with castles" | |
| for _ in range(3): | |
| images = pipe(prompt=prompt).images | |