Views
No views yet
segmind/SSD-1B that allows
to reduce the number of inference steps to only between 2 - 8 steps.| Model | Params / M |
|---|---|
| lcm-lora-sdv1-5 | 67.5 |
| lcm-lora-ssd-1b | 105 |
| lcm-lora-sdxl | 197M |
peft, accelerate and transformers.
audio dataset from the Hugging Face Hub:1pip install --upgrade pip
2pip install --upgrade diffusers transformers accelerate peftsegmind/SSD-1B first. 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.1import torch
2from diffusers import LCMScheduler, AutoPipelineForText2Image
3
4model_id = "segmind/SSD-1B"
5adapter_id = "latent-consistency/lcm-lora-ssd-1b"
6
7pipe = AutoPipelineForText2Image.from_pretrained(model_id, torch_dtype=torch.float16, variant="fp16")
8pipe.scheduler = LCMScheduler.from_config(pipe.scheduler.config)
9pipe.to("cuda")
10
11# load and fuse lcm lora
12pipe.load_lora_weights(adapter_id)
13pipe.fuse_lora()
14
15
16prompt = "Self-portrait oil painting, a beautiful cyborg with golden hair, 8k"
17
18# disable guidance_scale by passing 0
19image = pipe(prompt=prompt, num_inference_steps=4, guidance_scale=0).images[0]