Diffusers
Safetensors
BigD233333 commited on
Commit
a5d8a9b
Β·
verified Β·
1 Parent(s): d2ddcb5

Add D2DF model card

Browse files
Files changed (4) hide show
  1. .gitattributes +1 -0
  2. LICENSE +190 -0
  3. README.md +150 -0
  4. docs/assets/teaser.png +3 -0
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* 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
 
 
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
36
+ docs/assets/teaser.png filter=lfs diff=lfs merge=lfs -text
LICENSE ADDED
@@ -0,0 +1,190 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or Derivative
95
+ Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work, excluding
103
+ those notices that do not pertain to any part of the Derivative
104
+ Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works.
111
+
112
+ You may add Your own copyright statement to Your modifications and
113
+ may provide additional or different license terms and conditions
114
+ for use, reproduction, or distribution of Your modifications, or
115
+ for any such Derivative Works as a whole, provided Your use,
116
+ reproduction, and distribution of the Work otherwise complies with
117
+ the conditions stated in this License.
118
+
119
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
120
+ any Contribution intentionally submitted for inclusion in the Work
121
+ by You to the Licensor shall be under the terms and conditions of
122
+ this License, without any additional terms or conditions.
123
+ Notwithstanding the above, nothing herein shall supersede or modify
124
+ the terms of any separate license agreement you may have executed
125
+ with Licensor regarding such Contributions.
126
+
127
+ 6. Trademarks. This License does not grant permission to use the trade
128
+ names, trademarks, service marks, or product names of the Licensor,
129
+ except as required for reasonable and customary use in describing the
130
+ origin of the Work and reproducing the content of the NOTICE file.
131
+
132
+ 7. Disclaimer of Warranty. Unless required by applicable law or
133
+ agreed to in writing, Licensor provides the Work (and each
134
+ Contributor provides its Contributions) on an "AS IS" BASIS,
135
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
136
+ implied, including, without limitation, any warranties or conditions
137
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
138
+ PARTICULAR PURPOSE. You are solely responsible for determining the
139
+ appropriateness of using or redistributing the Work and assume any
140
+ risks associated with Your exercise of permissions under this License.
141
+
142
+ 8. Limitation of Liability. In no event and under no legal theory,
143
+ whether in tort (including negligence), contract, or otherwise,
144
+ unless required by applicable law (such as deliberate and grossly
145
+ negligent acts) or agreed to in writing, shall any Contributor be
146
+ liable to You for damages, including any direct, indirect, special,
147
+ incidental, or consequential damages of any character arising as a
148
+ result of this License or out of the use or inability to use the
149
+ Work (including but not limited to damages for loss of goodwill,
150
+ work stoppage, computer failure or malfunction, or any and all
151
+ other commercial damages or losses), even if such Contributor
152
+ has been advised of the possibility of such damages.
153
+
154
+ 9. Accepting Warranty or Additional Liability. While redistributing
155
+ the Work or Derivative Works thereof, You may choose to offer,
156
+ and charge a fee for, acceptance of support, warranty, indemnity,
157
+ or other liability obligations and/or rights consistent with this
158
+ License. However, in accepting such obligations, You may act only
159
+ on Your own behalf and on Your sole responsibility, not on behalf
160
+ of any other Contributor, and only if You agree to indemnify,
161
+ defend, and hold each Contributor harmless for any liability
162
+ incurred by, or claims asserted against, such Contributor by reason
163
+ of your accepting any such warranty or additional liability.
164
+
165
+ END OF TERMS AND CONDITIONS
166
+
167
+ APPENDIX: How to apply the Apache License to your work.
168
+
169
+ To apply the Apache License to your work, attach the following
170
+ boilerplate notice, with the fields enclosed by brackets "[]"
171
+ replaced with your own identifying information. (Don't include
172
+ the brackets!) The text should be enclosed in the appropriate
173
+ comment syntax for the file format. We also recommend that a
174
+ file or class name and description of purpose be included on the
175
+ same "printed page" as the copyright notice for easier
176
+ identification within third-party archives.
177
+
178
+ Copyright [yyyy] [name of copyright owner]
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
README.md ADDED
@@ -0,0 +1,150 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div align="center">
2
+
3
+ # From Draft to Draft-Free: One-Step Video Object Removal via Privileged Distillation and Fast Planting
4
+
5
+ **Zizhao Chen, Ping Wei<sup>†</sup>, Guang Dai, Jingdong Wang, Mengmeng Wang<sup>†</sup>**
6
+
7
+ Xi'an Jiaotong University &nbsp;Β·&nbsp; SGIT AI Lab &nbsp;Β·&nbsp;
8
+ Zhejiang University of Technology &nbsp;Β·&nbsp; Baidu
9
+
10
+ <sup>†</sup> Corresponding authors
11
+
12
+ <a href="https://bigd233.github.io/D2DF/"><img src="https://img.shields.io/badge/Project-Page-4d45b8?logo=googlechrome&logoColor=white" alt="Project Page"></a>
13
+ <a href="https://bigd233.github.io/D2DF/paper.pdf"><img src="https://img.shields.io/badge/arXiv-Paper-b31b1b?logo=arxiv&logoColor=white" alt="arXiv Paper"></a>
14
+ <a href="https://huggingface.co/BigD233333/D2DF"><img src="https://img.shields.io/badge/%F0%9F%A4%97-Hugging_Face-FFD21E" alt="Hugging Face"></a>
15
+
16
+ </div>
17
+
18
+ <p align="center">
19
+ <img src="docs/assets/teaser.png" alt="Overview of the D2DF framework" width="100%">
20
+ </p>
21
+
22
+ **D2DF** is a three-stage framework for one-step video object removal. It first
23
+ distills a multi-step draft-guided diffusion teacher into **D2DF-DG**, a one-step
24
+ draft refiner, through **Prior-Privileged Consistency Distillation (PPCD)**. It then
25
+ uses the lightweight **Self-Guided Fast Planting (SGFP)** module to construct
26
+ pseudo-drafts in latent space, producing **D2DF-DF**, a fully draft-free one-step
27
+ generator.
28
+
29
+ This repository provides standalone inference code for both D2DF-DF and D2DF-DG
30
+ using the official Hugging Face `diffusers` and `transformers` packages.
31
+
32
+ ## Installation
33
+
34
+ ```bash
35
+ git clone https://github.com/bigD233/D2DF.git
36
+ cd D2DF
37
+ pip install -r requirements.txt
38
+ ```
39
+
40
+ We recommend Python 3.11 and an NVIDIA GPU with CUDA support. The released
41
+ inference code was tested with PyTorch 2.8, CUDA 12.8, `diffusers >= 0.32`, and
42
+ `transformers >= 4.44`.
43
+
44
+ ## Model Weights
45
+
46
+ Download the base **CogVideoX-5B-I2V** model from its
47
+ [official Hugging Face repository](https://huggingface.co/zai-org/CogVideoX-5b-I2V).
48
+
49
+ Download the **D2DF-DF** and **D2DF-DG** checkpoints from our
50
+ [D2DF Hugging Face repository](https://huggingface.co/BigD233333/D2DF). After
51
+ extracting the downloaded archives, pass the corresponding directories to
52
+ `--transformer_path`.
53
+
54
+ The included `prompt_embeds.pt` stores the pre-computed embedding for the prompt
55
+ `"background"`, so the T5 encoder does not need to be loaded during normal
56
+ inference.
57
+
58
+ ## Input Format
59
+
60
+ Prepare the input as directories of numbered image files:
61
+
62
+ ```text
63
+ inputs/
64
+ β”œβ”€β”€ imgs/
65
+ β”‚ β”œβ”€β”€ 00000.jpg
66
+ β”‚ β”œβ”€β”€ 00001.jpg
67
+ β”‚ └── ...
68
+ β”œβ”€β”€ mask/
69
+ β”‚ β”œβ”€β”€ 00000.png
70
+ β”‚ β”œβ”€β”€ 00001.png
71
+ β”‚ └── ...
72
+ └── drafts/ # required only by D2DF-DG
73
+ β”œβ”€β”€ 00000.jpg
74
+ β”œβ”€β”€ 00001.jpg
75
+ └── ...
76
+ ```
77
+
78
+ - The GitHub repository includes this ready-to-run 25-frame example under `inputs/`.
79
+ - Frames, masks, and drafts are read in filename order.
80
+ - Mask pixels belonging to the removal target should have value `255` by default.
81
+ - Inputs are resized to the requested output resolution.
82
+ - The default setting uses 25 frames at 480 x 720 resolution.
83
+
84
+ ## Inference
85
+
86
+ ### D2DF-DF: Draft-Free One-Step Removal
87
+
88
+ No external draft is required:
89
+
90
+ ```bash
91
+ python infer.py \
92
+ --mode df \
93
+ --base_model_path <PATH_TO_COGVIDEOX_5B_I2V> \
94
+ --transformer_path <PATH_TO_D2DF_DF> \
95
+ --frames_dir inputs/imgs \
96
+ --mask_dir inputs/mask \
97
+ --output_dir outputs/I-210910_I09032_T04_df \
98
+ --num_frames 25 \
99
+ --height 480 \
100
+ --width 720
101
+ ```
102
+
103
+ ### D2DF-DG: Draft-Guided One-Step Refinement
104
+
105
+ Supply a draft produced by a video object removal method such as ProPainter:
106
+
107
+ ```bash
108
+ python infer.py \
109
+ --mode dg \
110
+ --base_model_path <PATH_TO_COGVIDEOX_5B_I2V> \
111
+ --transformer_path <PATH_TO_D2DF_DG> \
112
+ --frames_dir inputs/imgs \
113
+ --mask_dir inputs/mask \
114
+ --draft_dir inputs/drafts \
115
+ --output_dir outputs/I-210910_I09032_T04_dg \
116
+ --num_frames 25 \
117
+ --height 480 \
118
+ --width 720
119
+ ```
120
+
121
+ The default configuration performs one denoising step with
122
+ `guidance_scale=1.0`. The output directory contains an MP4 video and a GIF
123
+ preview. Add `--save_frames` to also save individual PNG frames.
124
+
125
+ ## Citation
126
+
127
+ ```bibtex
128
+ @misc{chen2026d2df,
129
+ title={From Draft to Draft-Free: One-Step Video Object Removal via Privileged Distillation and Fast Planting},
130
+ author={Zizhao Chen and Ping Wei and Guang Dai and Jingdong Wang and Mengmeng Wang},
131
+ year={2026}
132
+ }
133
+ ```
134
+
135
+ ## Acknowledgements
136
+
137
+ Our implementation is built upon
138
+ [CogVideoX](https://github.com/THUDM/CogVideo),
139
+ [Hugging Face Diffusers](https://github.com/huggingface/diffusers), and
140
+ [ProPainter](https://github.com/sczhou/ProPainter). We sincerely thank the
141
+ contributors of these projects for their excellent work.
142
+
143
+ ## License
144
+
145
+ This repository is released under the [Apache License 2.0](LICENSE).
146
+
147
+ ## Contact
148
+
149
+ For questions about this work, please contact
150
+ [Zizhao Chen](mailto:bigd_chen@stu.xjtu.edu.cn).
docs/assets/teaser.png ADDED

Git LFS Details

  • SHA256: 45e0f8cec9c3bb267128d21511674fbc0be4be5621b6a93ee26664b6dd47156e
  • Pointer size: 132 Bytes
  • Size of remote file: 1.57 MB