radames commited on
Commit
02d376c
1 Parent(s): cb4985a

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +33 -4
README.md CHANGED
@@ -3,16 +3,45 @@ library_name: diffusers
3
  pipeline_tag: text-to-image
4
  inference: true
5
  base_model: stabilityai/sd-turbo
6
- tags:
7
- - lora
8
  ---
 
 
 
9
 
10
  Base Model: https://huggingface.co/stabilityai/stable-diffusion-2-1
11
 
12
- Without DPO Lora
13
  ![image/png](https://cdn-uploads.huggingface.co/production/uploads/6064e095abd8d3692e3e2ed6/3o1UBMgrBTT5SFfgYFmaq.png)
14
 
15
  With DPO Lora
16
  ![image/png](https://cdn-uploads.huggingface.co/production/uploads/6064e095abd8d3692e3e2ed6/chu29lik7TVGEyVddWyqb.png)
17
 
18
- 3e2ed6/orNwUVnt_fgv1BcfAAkLD.png)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  pipeline_tag: text-to-image
4
  inference: true
5
  base_model: stabilityai/sd-turbo
 
 
6
  ---
7
+ # DPO LoRA Stable Diffusion v2-1
8
+ Model trained with LoRA implementation of Diffusion DPO Read more [here](https://github.com/huggingface/diffusers/tree/main/examples/research_projects/diffusion_dpo)
9
+
10
 
11
  Base Model: https://huggingface.co/stabilityai/stable-diffusion-2-1
12
 
13
+ Without DPO Lora
14
  ![image/png](https://cdn-uploads.huggingface.co/production/uploads/6064e095abd8d3692e3e2ed6/3o1UBMgrBTT5SFfgYFmaq.png)
15
 
16
  With DPO Lora
17
  ![image/png](https://cdn-uploads.huggingface.co/production/uploads/6064e095abd8d3692e3e2ed6/chu29lik7TVGEyVddWyqb.png)
18
 
19
+ ## Running
20
+
21
+ ```python
22
+ from diffusers import DiffusionPipeline
23
+ from diffusers.utils import make_image_grid
24
+ import torch
25
+
26
+ pipe = DiffusionPipeline.from_pretrained(
27
+ # "stabilityai/stable-diffusion-2-1", # or SD-2.1
28
+ "stabilityai/sd-turbo", # or SD-TURBO
29
+
30
+ torch_dtype=torch.float16, variant="fp16"
31
+ )
32
+ pipe.load_lora_weights("radames/dpo-lora-sd2.1", adapter_name="dpo-lora-sd21", weight_name="pytorch_lora_weights-10000.safetensors")
33
+ pipe.to("cuda");
34
+ prompt = "portrait headshot professional of elon musk"
35
+ negative_prompt = "3d render, cartoon, drawing, art, low light"
36
+ images = pipe(
37
+ prompt=prompt,
38
+ negative_prompt=negative_prompt,
39
+ width=512,
40
+ height=512,
41
+ num_inference_steps=2,
42
+ guidance_scale=1.0,
43
+ num_images_per_prompt=4
44
+ ).images
45
+ make_image_grid(images, 1, 4)
46
+
47
+ ```