Views
No views yet
stable-diffusion-xl-base-1.0 that allows
to reduce the number of inference steps to only between 2 - 8 steps.peft, accelerate and transformers.
audio dataset from the Hugging Face Hub:1pip install --upgrade pip
2pip install --upgrade diffusers transformers accelerate peftstabilityai/stable-diffusion-xl-base-1.0. Next, the scheduler needs to be changed to LCMScheduler and we can reduce the number of inference steps to just 2 to 8 steps.
Please make sure to either disable guidance_scale or use values between 1.0 and 2.0.1from diffusers import UNet2DConditionModel, DiffusionPipeline, LCMScheduler
2
3unet = UNet2DConditionModel.from_pretrained("latent-consistency/lcm-sdxl", torch_dtype=torch.float16, variant="fp16")
4pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0", unet=unet, torch_dtype=torch.float16, variant="fp16")
5
6pipe.scheduler = LCMScheduler.from_config(sd_pipe.scheduler.config)
7pipe.to("cuda")
8
9prompt = "a close-up picture of an old man standing in the rain"
10
11image = pipe(prompt, num_inference_steps=4, guidance_scale=8.0).images[0]