lcm-lora-sdxl / README.md
multimodalart's picture
Update README.md
23c96ee
|
raw
history blame
No virus
777 Bytes
---
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]
```