File size: 777 Bytes
76b45c8
 
8e2a773
 
76b45c8
 
8e2a773
 
 
76b45c8
8e2a773
 
76b45c8
8e2a773
 
 
76b45c8
23c96ee
8e2a773
76b45c8
8e2a773
76b45c8
8e2a773
76b45c8
8e2a773
 
 
 
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
28
---
library_name: peft
tags:
- lora
---

```py
from diffusers import LCMScheduler, StableDiffusionXLPipeline
import torch

pipe = StableDiffusionXLPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=torch.float16)
pipe.scheduler = LCMScheduler.from_config(pipe.scheduler.config)

# load and fuse lcm lora
pipe.load_lora_weights("latent-consistency/lcm-lora-sdxl")
pipe.fuse_lora()

# NOTE, you can also optionally load other LoRAs into the model
pipe.load_lora_weights("TheLastBen/Papercut_SDXL")

pipe.to(device="cuda")

prompt = "papercut a fox"  # you can replace 'a fox' by other objects, scenes

torch.manual_seed(0)
# set `guidance_scale=1.0` to disable CFG
image = pipe(prompt=prompt, num_inference_steps=4, guidance_scale=1.0).images[0]
```