--- library_name: diffusers pipeline_tag: text-to-image inference: true base_model: stabilityai/sd-turbo --- # DPO LoRA Stable Diffusion v2-1 Model trained with LoRA implementation of Diffusion DPO Read more [here](https://github.com/huggingface/diffusers/tree/main/examples/research_projects/diffusion_dpo) Base Model: https://huggingface.co/stabilityai/stable-diffusion-2-1 Without DPO Lora ![image/png](https://cdn-uploads.huggingface.co/production/uploads/6064e095abd8d3692e3e2ed6/3o1UBMgrBTT5SFfgYFmaq.png) With DPO Lora ![image/png](https://cdn-uploads.huggingface.co/production/uploads/6064e095abd8d3692e3e2ed6/chu29lik7TVGEyVddWyqb.png) ## Running ```python from diffusers import DiffusionPipeline from diffusers.utils import make_image_grid import torch pipe = DiffusionPipeline.from_pretrained( # "stabilityai/stable-diffusion-2-1", # or SD-2.1 "stabilityai/sd-turbo", # or SD-TURBO torch_dtype=torch.float16, variant="fp16" ) pipe.load_lora_weights("radames/dpo-lora-sd2.1", adapter_name="dpo-lora-sd21", weight_name="pytorch_lora_weights-10000.safetensors") pipe.to("cuda"); prompt = "portrait headshot professional of elon musk" negative_prompt = "3d render, cartoon, drawing, art, low light" images = pipe( prompt=prompt, negative_prompt=negative_prompt, width=512, height=512, num_inference_steps=2, guidance_scale=1.0, num_images_per_prompt=4 ).images make_image_grid(images, 1, 4) ```