Edit model card

DPO LoRA Stable Diffusion v2-1

Model trained with LoRA implementation of Diffusion DPO Read more here

Base Model: https://huggingface.co/stabilityai/stable-diffusion-2-1

Running with 🧨 diffusers library


from diffusers import DiffusionPipeline
from diffusers.utils import make_image_grid
import torch

pipe = DiffusionPipeline.from_pretrained(
    "stabilityai/sd-turbo",  # SD Turbo is a destilled version of Stable Diffusion 2.1
    # "stabilityai/stable-diffusion-2-1", # for the original stable diffusion 2.1 model
    torch_dtype=torch.float16, variant="fp16"
)
pipe.to("cuda")
pipe.load_lora_weights("radames/sd-21-DPO-LoRA", adapter_name="dpo-lora-sd21")
pipe.set_adapters(["dpo-lora-sd21"], adapter_weights=[1.0]) # you can play with adapter_weights to increase the effect of the LoRA model
seed = 123123
prompt = "portrait headshot professional of elon musk"
negative_prompt = "3d render, cartoon, drawing, art, low light"
generator = torch.Generator().manual_seed(seed)
images = pipe(
    prompt=prompt,
    negative_prompt=negative_prompt,
    width=512,
    height=512,
    num_inference_steps=2,
    generator=generator,
    guidance_scale=1.0,
    num_images_per_prompt=4
).images
make_image_grid(images, 1, 4)

Guidance Scale vs LoRA weights

image/jpeg

Examples

Left Withoud DPO right with DPO LoRA

Downloads last month
586
Inference Examples
This model does not have enough activity to be deployed to Inference API (serverless) yet. Increase its social visibility and check back later, or deploy to Inference Endpoints (dedicated) instead.

Model tree for radames/sd-21-DPO-LoRA

Finetuned
(159)
this model

Spaces using radames/sd-21-DPO-LoRA 2

Collection including radames/sd-21-DPO-LoRA