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 load_replicate.py from diffusers/tools: direct link, hf CLI and curl.
- Browser
- Download file 759 Bytes
-
https://huggingface.co/diffusers/tools/resolve/56fb00ebc5c47f27005c482f3b835cf9aad7616b/load_replicate.py
- Command line
-
hf download hf://diffusers/tools@56fb00ebc5c47f27005c482f3b835cf9aad7616b/load_replicate.py
-
curl -L -o load_replicate.py https://huggingface.co/diffusers/tools/resolve/56fb00ebc5c47f27005c482f3b835cf9aad7616b/load_replicate.py
759 Bytes
| #!/usr/bin/env python3 | |
| #!/usr/bin/env python3 | |
| from diffusers import StableDiffusionXLPipeline, AutoencoderKL | |
| import torch | |
| path = "stabilityai/stable-diffusion-xl-base-1.0" | |
| vae_path = "madebyollin/sdxl-vae-fp16-fix" | |
| # vae = AutoencoderKL.from_pretrained(vae_path, torch_dtype=torch.float16) | |
| # pipe = StableDiffusionXLPipeline.from_pretrained(path, torch_dtype=torch.float16, vae=vae, variant="fp16", use_safetensors=True, local_files_only=True, add_watermarker=False) | |
| pipe = StableDiffusionXLPipeline.from_pretrained(path, torch_dtype=torch.float16, variant="fp16", use_safetensors=True) | |
| pipe.to("cuda") | |
| prompt = "An astronaut riding a green horse on Mars" | |
| steps = 20 | |
| for _ in range(5): | |
| image = pipe(prompt=prompt, num_inference_steps=steps).images[0] | |