|
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. |
|
|
|
It can generate decent quality images at only 4 inference steps. |
|
|
|
![image/png](https://cdn-uploads.huggingface.co/production/uploads/6424d3394191f56e07324282/fh-m_nfzZzRLKmMnBqFiX.png) |
|
|
|
|
|
Load with LCM https://huggingface.co/latent-consistency/lcm-lora-sdv1-5 |
|
|
|
Like this: |
|
|
|
``` |
|
import torch |
|
from diffusers import LCMScheduler, AutoPipelineForText2Image |
|
|
|
model_id = "Lykon/dreamshaper-7" |
|
adapter_id = "latent-consistency/lcm-lora-sdv1-5" |
|
|
|
pipe = AutoPipelineForText2Image.from_pretrained(model_id, torch_dtype=torch.float16, variant="fp16") |
|
pipe.scheduler = LCMScheduler.from_config(pipe.scheduler.config) |
|
pipe.to("cuda") |
|
|
|
# load and fuse lcm lora |
|
pipe.load_lora_weights(adapter_id) |
|
pipe.fuse_lora() |
|
|
|
# load and fuse my lcm-lora-hpsv2 lora |
|
pipe.load_lora_weights("adams-story/lcm-lora-hpsv2-rl") |
|
pipe.fuse_lora() |
|
|
|
prompt = "Self-portrait oil painting, a beautiful cyborg with golden hair, 8k" |
|
|
|
# disable guidance_scale by passing 0 |
|
image = pipe(prompt=prompt, num_inference_steps=4, guidance_scale=0).images[0] |
|
``` |