File size: 587 Bytes
aff2dff 2468a9b aff2dff |
1 2 3 4 5 6 7 8 9 10 11 12 13 |
```py
from diffusers import UNet2DConditionModel, DiffusionPipeline, LCMScheduler
unet = UNet2DConditionModel.from_pretrained("latent-consistency/lcm-sdxl", torch_dtype=torch.float16, variant="fp16")
pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0", unet=unet, torch_dtype=torch.float16, variant="fp16")
pipe.scheduler = LCMScheduler.from_config(sd_pipe.scheduler.config)
pipe.set_progress_bar_config(disable=None)
prompt = "a red car standing on the side of the street"
image = pipe(prompt, num_inference_steps=4, guidance_scale=8.0).images[0]
``` |