Instructions to use latent-consistency/lcm-sdxl with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use latent-consistency/lcm-sdxl with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("latent-consistency/lcm-sdxl", torch_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
- Local Apps Settings
- Draw Things
- DiffusionBee
Commit ·
2468a9b
1
Parent(s): a31168f
Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from diffusers import UNet2DConditionModel, DiffusionPipeline, LCMScheduler
|
| 2 |
+
|
| 3 |
+
unet = UNet2DConditionModel.from_pretrained("latent-consistency/lcm-sdxl", torch_dtype=torch.float16, variant="fp16")
|
| 4 |
+
pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0", unet=unet, torch_dtype=torch.float16, variant="fp16")
|
| 5 |
+
|
| 6 |
+
pipe.scheduler = LCMScheduler.from_config(sd_pipe.scheduler.config)
|
| 7 |
+
pipe.set_progress_bar_config(disable=None)
|
| 8 |
+
|
| 9 |
+
prompt = "a red car standing on the side of the street"
|
| 10 |
+
|
| 11 |
+
image = pipe(prompt, num_inference_steps=4, guidance_scale=8.0).images[0]
|