|
--- |
|
library_name: peft |
|
tags: |
|
- lora |
|
--- |
|
|
|
```py |
|
from diffusers import LCMScheduler, DiffusionPipeline |
|
import torch |
|
import PIL.Image |
|
import requests |
|
|
|
pipe = DiffusionPipeline.from_pretrained("segmind/SSD-1B", torch_dtype=torch.float16, variant="fp16") |
|
pipe.scheduler = LCMScheduler.from_config(pipe.scheduler.config) |
|
|
|
# load and fuse lcm lora |
|
pipe.load_lora_weights("latent-consistency/lcm-lora-ssd-1b") |
|
pipe.fuse_lora() |
|
|
|
pipe.to(device="cuda") |
|
|
|
prompt = "a red Porsche" |
|
|
|
torch.manual_seed(0) |
|
# guidance_scale=1.0 to disable CFG |
|
image = pipe(prompt=prompt, num_inference_steps=4, guidance_scale=1.0).images[0] |
|
``` |