Update README.md
Browse files
README.md
CHANGED
|
@@ -20,6 +20,42 @@ widget:
|
|
| 20 |
Downscale 8 times to get pixel perfect images (use Nearest Neighbors)
|
| 21 |
Use a fixed VAE to avoid artifacts (0.9 or fp16 fix)
|
| 22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
### Tips:
|
| 24 |
Don't use refiner
|
| 25 |
|
|
|
|
| 20 |
Downscale 8 times to get pixel perfect images (use Nearest Neighbors)
|
| 21 |
Use a fixed VAE to avoid artifacts (0.9 or fp16 fix)
|
| 22 |
|
| 23 |
+
### Need more performance?
|
| 24 |
+
Use it with a LCM Lora!
|
| 25 |
+
|
| 26 |
+
Use 8 steps and guidance scale of 1.5
|
| 27 |
+
|
| 28 |
+
```python
|
| 29 |
+
from diffusers import DiffusionPipeline, LCMScheduler
|
| 30 |
+
import torch
|
| 31 |
+
|
| 32 |
+
model_id = "stabilityai/stable-diffusion-xl-base-1.0"
|
| 33 |
+
lcm_lora_id = "latent-consistency/lcm-lora-sdxl"
|
| 34 |
+
pipe = DiffusionPipeline.from_pretrained(model_id, variant="fp16")
|
| 35 |
+
pipe.scheduler = LCMScheduler.from_config(pipe.scheduler.config)
|
| 36 |
+
|
| 37 |
+
pipe.load_lora_weights(lcm_lora_id, adapter_name="lora")
|
| 38 |
+
pipe.load_lora_weights("./pixel-art-xl.safetensors", adapter_name="pixel")
|
| 39 |
+
|
| 40 |
+
pipe.set_adapters(["lora", "pixel"], adapter_weights=[1.0, 1.2])
|
| 41 |
+
pipe.to(device="cuda", dtype=torch.float16)
|
| 42 |
+
|
| 43 |
+
prompt = "pixel, a cute corgi"
|
| 44 |
+
negative_prompt = "3d render, realistic"
|
| 45 |
+
|
| 46 |
+
num_images = 9
|
| 47 |
+
|
| 48 |
+
for i in range(num_images):
|
| 49 |
+
img = pipe(
|
| 50 |
+
prompt=prompt,
|
| 51 |
+
negative_prompt=negative_prompt,
|
| 52 |
+
num_inference_steps=8,
|
| 53 |
+
guidance_scale=1.5,
|
| 54 |
+
).images[0]
|
| 55 |
+
|
| 56 |
+
img.save(f"lcm_lora_{i}.png")
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
### Tips:
|
| 60 |
Don't use refiner
|
| 61 |
|