adams-story
commited on
Commit
•
f1d44bc
1
Parent(s):
4f66849
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
This is a LORA for stable diffusion 1.5, that improves the generation quality at 4 steps. It uses direct backpropogation and HPSV2 reward scoring.
|
2 |
+
|
3 |
+
It can generate decent quality images at only 4 inference steps.
|
4 |
+
|
5 |
+
![image/png](https://cdn-uploads.huggingface.co/production/uploads/6424d3394191f56e07324282/fh-m_nfzZzRLKmMnBqFiX.png)
|
6 |
+
|
7 |
+
|
8 |
+
Load with LCM https://huggingface.co/latent-consistency/lcm-lora-sdv1-5
|
9 |
+
|
10 |
+
Like this:
|
11 |
+
|
12 |
+
```
|
13 |
+
import torch
|
14 |
+
from diffusers import LCMScheduler, AutoPipelineForText2Image
|
15 |
+
|
16 |
+
model_id = "Lykon/dreamshaper-7"
|
17 |
+
adapter_id = "latent-consistency/lcm-lora-sdv1-5"
|
18 |
+
|
19 |
+
pipe = AutoPipelineForText2Image.from_pretrained(model_id, torch_dtype=torch.float16, variant="fp16")
|
20 |
+
pipe.scheduler = LCMScheduler.from_config(pipe.scheduler.config)
|
21 |
+
pipe.to("cuda")
|
22 |
+
|
23 |
+
# load and fuse lcm lora
|
24 |
+
pipe.load_lora_weights(adapter_id)
|
25 |
+
pipe.fuse_lora()
|
26 |
+
|
27 |
+
# load and fuse my lcm-lora-hpsv2 lora
|
28 |
+
pipe.load_lora_weights("adams-story/lcm-lora-hpsv2-rl")
|
29 |
+
pipe.fuse_lora()
|
30 |
+
|
31 |
+
prompt = "Self-portrait oil painting, a beautiful cyborg with golden hair, 8k"
|
32 |
+
|
33 |
+
# disable guidance_scale by passing 0
|
34 |
+
image = pipe(prompt=prompt, num_inference_steps=4, guidance_scale=0).images[0]
|
35 |
+
```
|