jacklishufan commited on
Commit
7ee83b5
·
verified ·
1 Parent(s): 2c46cc7

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +58 -0
README.md ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ datasets:
3
+ - yuvalkirstain/pickapic_v2
4
+ library_name: diffusers
5
+ ---
6
+ # Diffusion-KTO: Aligning Diffusion Models by Optimizing Human Utility
7
+ <p align="center">
8
+ <img src="https://github.com/jacklishufan/diffusion-kto/blob/main/assets/teaser.png?raw=true", width=60%> <br>
9
+ </p>
10
+
11
+
12
+ This model is fine-tuned from stable-diffusion-xl-base-1.0 on offline human preference data pickapic_v2 using KTO.
13
+
14
+
15
+ ### Usage
16
+ ```
17
+ import torch
18
+ from diffusers import AutoencoderKL, UNet2DConditionModel, DiffusionPipeline
19
+ vae_path = model_name = "runwayml/stable-diffusion-v1-5"
20
+ device = 'cuda'
21
+ weight_dtype = torch.float16
22
+ vae = AutoencoderKL.from_pretrained(
23
+ vae_path,
24
+ subfolder="vae",
25
+ )
26
+ unet = UNet2DConditionModel.from_pretrained(
27
+ "jacklishufan/diffusion-kto", subfolder="unet",
28
+ )
29
+ pipeline = DiffusionPipeline.from_pretrained(
30
+ model_name,
31
+ vae=vae,
32
+ unet=unet,
33
+ device=device,
34
+ ).to(device).to(weight_dtype)
35
+
36
+
37
+ result = pipeline(
38
+ prompt="Self-portrait oil painting, a beautiful cyborg with golden hair, 8k",
39
+ num_inference_steps=50,
40
+ guidance_scale=7.0
41
+ )
42
+ img = result[0][0]
43
+ ```
44
+ ### Code
45
+
46
+ The code is available [here](https://github.com/jacklishufan/diffusion-kto)
47
+
48
+ ### Citation
49
+ ```
50
+ @misc{li2024aligning,
51
+ title={Aligning Diffusion Models by Optimizing Human Utility},
52
+ author={Shufan Li and Konstantinos Kallidromitis and Akash Gokul and Yusuke Kato and Kazuki Kozuka},
53
+ year={2024},
54
+ eprint={2404.04465},
55
+ archivePrefix={arXiv},
56
+ primaryClass={cs.CV}
57
+ }
58
+ ```