stable-diffusion stable-diffusion-diffusers text-to-image diffusers lora civitai a1111

This repository contains a LoRA model downloaded from CivitAI.

You can load this checkpoint in 🧨 diffusers and perform like so:

import torch
from diffusers import StableDiffusionPipeline, DPMSolverMultistepScheduler

pipeline = StableDiffusionPipeline.from_pretrained(
    "gsdf/Counterfeit-V2.5", torch_dtype=torch.float16, safety_checker=None
).to("cuda")
pipeline.scheduler = DPMSolverMultistepScheduler.from_config(
    pipeline.scheduler.config, use_karras_sigmas=True
)

pipeline.load_lora_weights(
    "sayakpaul/civitai-light-shadow-lora", weight_name="light_and_shadow.safetensors"
)
prompt = "masterpiece, best quality, 1girl, at dusk"
negative_prompt = ("(low quality, worst quality:1.4), (bad anatomy), (inaccurate limb:1.2), "
                   "bad composition, inaccurate eyes, extra digit, fewer digits, (extra arms:1.2), large breasts")

image = pipeline(prompt=prompt, 
    negative_prompt=negative_prompt, 
    width=512, 
    height=768, 
    num_inference_steps=15, 
    generator=torch.manual_seed(0)
).images[0]
image.save("image.png")

Below is a comparison between the LoRA and the non-LoRA results:

<div align="center"> <img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/lora_non_lora_comparison.png" width=850/> </div>

If you're interested to know how the CivitAI interoperability support was enabled in Diffusers, please follow this PR.