Views
No views yet
segmind/SSD-1B 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 peftsegmind/SSD-1B. Next, the scheduler needs to be changed to LCMScheduler and we can reduce the number of inference steps to just 2 to 8 steps.1from diffusers import UNet2DConditionModel, DiffusionPipeline, LCMScheduler
2import torch
3
4unet = UNet2DConditionModel.from_pretrained("latent-consistency/lcm-ssd-1b", torch_dtype=torch.float16, variant="fp16")
5pipe = DiffusionPipeline.from_pretrained("segmind/SSD-1B", unet=unet, torch_dtype=torch.float16, variant="fp16")
6
7pipe.scheduler = LCMScheduler.from_config(pipe.scheduler.config)
8pipe.to("cuda")
9
10prompt = "a close-up picture of an old man standing in the rain"
11
12image = pipe(prompt, num_inference_steps=4, guidance_scale=1.0).images[0]