lcm-lora-sdv1-5 / README.md
patrickvonplaten's picture
Update README.md
10442db
|
raw
history blame
No virus
647 Bytes
metadata
library_name: peft
tags:
  - lora
from diffusers import LCMScheduler, DiffusionPipeline
import torch
import PIL.Image
import requests

pipe = DiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5", 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-sdv1-5")
pipe.fuse_lora()

pipe.to(device="cuda")

prompt = "a red Porsche"

torch.manual_seed(0)

# make sure to use `guidance_scale=1.0` to disable CFG
image = pipe(prompt=prompt, num_inference_steps=4, guidance_scale=1.0).images[0]