ashllay ezlee258258 commited on
Commit
b51d77d
·
verified ·
0 Parent(s):

Duplicate from ezlee258258/Inversion-DPO

Browse files

Co-authored-by: Yize Li <[email protected]>

.gitattributes ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz filter=lfs diff=lfs merge=lfs -text
33
+ *.zip filter=lfs diff=lfs merge=lfs -text
34
+ *.zst filter=lfs diff=lfs merge=lfs -text
35
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: stabilityai/stable-diffusion-xl-base-1.0
3
+ library_name: diffusers
4
+ license: apache-2.0
5
+ pipeline_tag: text-to-image
6
+ tags:
7
+ - stable-diffusion-xl
8
+ - stable-diffusion
9
+ - diffusers
10
+ - inversion
11
+ - dpo
12
+ - fine-tuned
13
+ ---
14
+
15
+ # Inversion-DPO
16
+
17
+ Official Inversion-DPO weights fine-tuned from Stable Diffusion XL. Only the trained UNet module is provided.
18
+
19
+ **Paper**: [Inversion-DPO: Precise and Efficient Post-Training for Diffusion Models](https://huggingface.co/papers/2507.11554)
20
+
21
+ **Code Repository**: https://github.com/MIGHTYEZ/Inversion-DPO
22
+
23
+ ## Model Description
24
+
25
+ This repository contains the fine-tuned UNet weights from the Inversion-DPO method, built upon Stable Diffusion XL. The model has been trained using Direct Preference Optimization (DPO) techniques combined with inversion methods to improve generation quality and alignment.
26
+
27
+ ## Quick Start
28
+
29
+ ```python
30
+ from diffusers import StableDiffusionXLPipeline, UNet2DConditionModel
31
+ import torch
32
+
33
+ # Load the fine-tuned UNet
34
+ unet = UNet2DConditionModel.from_pretrained(
35
+ "ezlee258258/Inversion-DPO",
36
+ subfolder="unet"
37
+ )
38
+
39
+ # Load the pipeline with the fine-tuned UNet
40
+ pipe = StableDiffusionXLPipeline.from_pretrained(
41
+ "stabilityai/stable-diffusion-xl-base-1.0",
42
+ unet=unet
43
+ )
44
+ pipe = pipe.to("cuda")
45
+
46
+ # Generate images
47
+ prompt = "A beautiful landscape with mountains and lakes"
48
+ image = pipe(prompt).images[0]
49
+ image.save("output.png")
50
+ ```
51
+
52
+ ## Citation
53
+
54
+ If you use this model in your research, please cite our work:
55
+
56
+ ```bibtex
57
+ @misc{li2025inversiondpo,
58
+ title={Inversion-DPO: Precise and Efficient Post-Training for Diffusion Models},
59
+ author={Zejian Li and Yize Li and Chenye Meng and Zhongni Liu and Yang Ling and Shengyuan Zhang and Guang Yang and Changyuan Yang and Zhiyuan Yang and Lingyun Sun},
60
+ year={2025},
61
+ eprint={2507.11554},
62
+ archivePrefix={arXiv},
63
+ primaryClass={cs.CV}
64
+ }
65
+ ```
66
+
67
+ ## Acknowledgments
68
+
69
+ Built upon [Stable Diffusion XL](https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0) by Stability AI.
70
+
71
+ ## Contact
72
+
73
+ For questions and support, please visit our [GitHub repository](https://github.com/MIGHTYEZ/Inversion-DPO).
unet/config.json ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_class_name": "UNet2DConditionModel",
3
+ "_diffusers_version": "0.30.0",
4
+ "_name_or_path": "comin/IterComp",
5
+ "act_fn": "silu",
6
+ "addition_embed_type": "text_time",
7
+ "addition_embed_type_num_heads": 64,
8
+ "addition_time_embed_dim": 256,
9
+ "attention_head_dim": [
10
+ 5,
11
+ 10,
12
+ 20
13
+ ],
14
+ "attention_type": "default",
15
+ "block_out_channels": [
16
+ 320,
17
+ 640,
18
+ 1280
19
+ ],
20
+ "center_input_sample": false,
21
+ "class_embed_type": null,
22
+ "class_embeddings_concat": false,
23
+ "conv_in_kernel": 3,
24
+ "conv_out_kernel": 3,
25
+ "cross_attention_dim": 2048,
26
+ "cross_attention_norm": null,
27
+ "down_block_types": [
28
+ "DownBlock2D",
29
+ "CrossAttnDownBlock2D",
30
+ "CrossAttnDownBlock2D"
31
+ ],
32
+ "downsample_padding": 1,
33
+ "dropout": 0.0,
34
+ "dual_cross_attention": false,
35
+ "encoder_hid_dim": null,
36
+ "encoder_hid_dim_type": null,
37
+ "flip_sin_to_cos": true,
38
+ "freq_shift": 0,
39
+ "in_channels": 4,
40
+ "layers_per_block": 2,
41
+ "mid_block_only_cross_attention": null,
42
+ "mid_block_scale_factor": 1,
43
+ "mid_block_type": "UNetMidBlock2DCrossAttn",
44
+ "norm_eps": 1e-05,
45
+ "norm_num_groups": 32,
46
+ "num_attention_heads": null,
47
+ "num_class_embeds": null,
48
+ "only_cross_attention": false,
49
+ "out_channels": 4,
50
+ "projection_class_embeddings_input_dim": 2816,
51
+ "resnet_out_scale_factor": 1.0,
52
+ "resnet_skip_time_act": false,
53
+ "resnet_time_scale_shift": "default",
54
+ "reverse_transformer_layers_per_block": null,
55
+ "sample_size": 128,
56
+ "time_cond_proj_dim": null,
57
+ "time_embedding_act_fn": null,
58
+ "time_embedding_dim": null,
59
+ "time_embedding_type": "positional",
60
+ "timestep_post_act": null,
61
+ "transformer_layers_per_block": [
62
+ 1,
63
+ 2,
64
+ 10
65
+ ],
66
+ "up_block_types": [
67
+ "CrossAttnUpBlock2D",
68
+ "CrossAttnUpBlock2D",
69
+ "UpBlock2D"
70
+ ],
71
+ "upcast_attention": null,
72
+ "use_linear_projection": true
73
+ }
unet/diffusion_pytorch_model-00001-of-00002.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:950210e4fc3472952f4623d0f0e094f6042894580aa34fef397935e67eb6e167
3
+ size 9988139160
unet/diffusion_pytorch_model-00002-of-00002.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:782ab256cbfcb2541a6b7b96129bdbc5e1455dad18af32fe03568301e2084f03
3
+ size 281938304
unet/diffusion_pytorch_model.safetensors.index.json ADDED
The diff for this file is too large to render. See raw diff