Text-to-Image
Diffusers
lora
File size: 611 Bytes
4d610a7
 
c25e490
 
4d610a7
 
c25e490
 
 
 
 
4d610a7
c25e490
 
4d610a7
c25e490
 
 
4d610a7
c25e490
4d610a7
c25e490
4d610a7
c25e490
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
---
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]
```