diffsynth 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- diffsynth-1.0.0/LICENSE +201 -0
- diffsynth-1.0.0/PKG-INFO +10 -0
- diffsynth-1.0.0/README.md +120 -0
- diffsynth-1.0.0/diffsynth/__init__.py +6 -0
- diffsynth-1.0.0/diffsynth/configs/__init__.py +0 -0
- diffsynth-1.0.0/diffsynth/configs/model_config.py +243 -0
- diffsynth-1.0.0/diffsynth/controlnets/__init__.py +2 -0
- diffsynth-1.0.0/diffsynth/controlnets/controlnet_unit.py +53 -0
- diffsynth-1.0.0/diffsynth/controlnets/processors.py +51 -0
- diffsynth-1.0.0/diffsynth/data/__init__.py +1 -0
- diffsynth-1.0.0/diffsynth/data/simple_text_image.py +35 -0
- diffsynth-1.0.0/diffsynth/data/video.py +148 -0
- diffsynth-1.0.0/diffsynth/extensions/ESRGAN/__init__.py +118 -0
- diffsynth-1.0.0/diffsynth/extensions/FastBlend/__init__.py +63 -0
- diffsynth-1.0.0/diffsynth/extensions/FastBlend/api.py +397 -0
- diffsynth-1.0.0/diffsynth/extensions/FastBlend/cupy_kernels.py +119 -0
- diffsynth-1.0.0/diffsynth/extensions/FastBlend/data.py +146 -0
- diffsynth-1.0.0/diffsynth/extensions/FastBlend/patch_match.py +298 -0
- diffsynth-1.0.0/diffsynth/extensions/FastBlend/runners/__init__.py +4 -0
- diffsynth-1.0.0/diffsynth/extensions/FastBlend/runners/accurate.py +35 -0
- diffsynth-1.0.0/diffsynth/extensions/FastBlend/runners/balanced.py +46 -0
- diffsynth-1.0.0/diffsynth/extensions/FastBlend/runners/fast.py +141 -0
- diffsynth-1.0.0/diffsynth/extensions/FastBlend/runners/interpolation.py +121 -0
- diffsynth-1.0.0/diffsynth/extensions/RIFE/__init__.py +242 -0
- diffsynth-1.0.0/diffsynth/extensions/__init__.py +0 -0
- diffsynth-1.0.0/diffsynth/models/__init__.py +1 -0
- diffsynth-1.0.0/diffsynth/models/attention.py +89 -0
- diffsynth-1.0.0/diffsynth/models/downloader.py +66 -0
- diffsynth-1.0.0/diffsynth/models/hunyuan_dit.py +451 -0
- diffsynth-1.0.0/diffsynth/models/hunyuan_dit_text_encoder.py +163 -0
- diffsynth-1.0.0/diffsynth/models/kolors_text_encoder.py +1363 -0
- diffsynth-1.0.0/diffsynth/models/lora.py +195 -0
- diffsynth-1.0.0/diffsynth/models/model_manager.py +536 -0
- diffsynth-1.0.0/diffsynth/models/sd3_dit.py +798 -0
- diffsynth-1.0.0/diffsynth/models/sd3_text_encoder.py +1107 -0
- diffsynth-1.0.0/diffsynth/models/sd3_vae_decoder.py +81 -0
- diffsynth-1.0.0/diffsynth/models/sd3_vae_encoder.py +95 -0
- diffsynth-1.0.0/diffsynth/models/sd_controlnet.py +588 -0
- diffsynth-1.0.0/diffsynth/models/sd_ipadapter.py +57 -0
- diffsynth-1.0.0/diffsynth/models/sd_motion.py +199 -0
- diffsynth-1.0.0/diffsynth/models/sd_text_encoder.py +321 -0
- diffsynth-1.0.0/diffsynth/models/sd_unet.py +1108 -0
- diffsynth-1.0.0/diffsynth/models/sd_vae_decoder.py +336 -0
- diffsynth-1.0.0/diffsynth/models/sd_vae_encoder.py +282 -0
- diffsynth-1.0.0/diffsynth/models/sdxl_ipadapter.py +122 -0
- diffsynth-1.0.0/diffsynth/models/sdxl_motion.py +104 -0
- diffsynth-1.0.0/diffsynth/models/sdxl_text_encoder.py +759 -0
- diffsynth-1.0.0/diffsynth/models/sdxl_unet.py +1899 -0
- diffsynth-1.0.0/diffsynth/models/sdxl_vae_decoder.py +24 -0
- diffsynth-1.0.0/diffsynth/models/sdxl_vae_encoder.py +24 -0
- diffsynth-1.0.0/diffsynth/models/svd_image_encoder.py +505 -0
- diffsynth-1.0.0/diffsynth/models/svd_unet.py +2004 -0
- diffsynth-1.0.0/diffsynth/models/svd_vae_decoder.py +578 -0
- diffsynth-1.0.0/diffsynth/models/svd_vae_encoder.py +139 -0
- diffsynth-1.0.0/diffsynth/models/tiler.py +106 -0
- diffsynth-1.0.0/diffsynth/pipelines/__init__.py +9 -0
- diffsynth-1.0.0/diffsynth/pipelines/base.py +34 -0
- diffsynth-1.0.0/diffsynth/pipelines/dancer.py +178 -0
- diffsynth-1.0.0/diffsynth/pipelines/hunyuan_image.py +274 -0
- diffsynth-1.0.0/diffsynth/pipelines/pipeline_runner.py +105 -0
- diffsynth-1.0.0/diffsynth/pipelines/sd3_image.py +132 -0
- diffsynth-1.0.0/diffsynth/pipelines/sd_image.py +173 -0
- diffsynth-1.0.0/diffsynth/pipelines/sd_video.py +266 -0
- diffsynth-1.0.0/diffsynth/pipelines/sdxl_image.py +191 -0
- diffsynth-1.0.0/diffsynth/pipelines/sdxl_video.py +223 -0
- diffsynth-1.0.0/diffsynth/pipelines/svd_video.py +297 -0
- diffsynth-1.0.0/diffsynth/processors/FastBlend.py +142 -0
- diffsynth-1.0.0/diffsynth/processors/PILEditor.py +28 -0
- diffsynth-1.0.0/diffsynth/processors/RIFE.py +77 -0
- diffsynth-1.0.0/diffsynth/processors/__init__.py +0 -0
- diffsynth-1.0.0/diffsynth/processors/base.py +6 -0
- diffsynth-1.0.0/diffsynth/processors/sequencial_processor.py +41 -0
- diffsynth-1.0.0/diffsynth/prompters/__init__.py +6 -0
- diffsynth-1.0.0/diffsynth/prompters/base_prompter.py +57 -0
- diffsynth-1.0.0/diffsynth/prompters/hunyuan_dit_prompter.py +69 -0
- diffsynth-1.0.0/diffsynth/prompters/kolors_prompter.py +353 -0
- diffsynth-1.0.0/diffsynth/prompters/prompt_refiners.py +77 -0
- diffsynth-1.0.0/diffsynth/prompters/sd3_prompter.py +92 -0
- diffsynth-1.0.0/diffsynth/prompters/sd_prompter.py +73 -0
- diffsynth-1.0.0/diffsynth/prompters/sdxl_prompter.py +61 -0
- diffsynth-1.0.0/diffsynth/schedulers/__init__.py +3 -0
- diffsynth-1.0.0/diffsynth/schedulers/continuous_ode.py +59 -0
- diffsynth-1.0.0/diffsynth/schedulers/ddim.py +79 -0
- diffsynth-1.0.0/diffsynth/schedulers/flow_match.py +51 -0
- diffsynth-1.0.0/diffsynth/tokenizer_configs/__init__.py +0 -0
- diffsynth-1.0.0/diffsynth/tokenizer_configs/hunyuan_dit/tokenizer/special_tokens_map.json +7 -0
- diffsynth-1.0.0/diffsynth/tokenizer_configs/hunyuan_dit/tokenizer/tokenizer_config.json +16 -0
- diffsynth-1.0.0/diffsynth/tokenizer_configs/hunyuan_dit/tokenizer/vocab.txt +47020 -0
- diffsynth-1.0.0/diffsynth/tokenizer_configs/hunyuan_dit/tokenizer/vocab_org.txt +21128 -0
- diffsynth-1.0.0/diffsynth/tokenizer_configs/hunyuan_dit/tokenizer_t5/config.json +28 -0
- diffsynth-1.0.0/diffsynth/tokenizer_configs/hunyuan_dit/tokenizer_t5/special_tokens_map.json +1 -0
- diffsynth-1.0.0/diffsynth/tokenizer_configs/hunyuan_dit/tokenizer_t5/spiece.model +0 -0
- diffsynth-1.0.0/diffsynth/tokenizer_configs/hunyuan_dit/tokenizer_t5/tokenizer_config.json +1 -0
- diffsynth-1.0.0/diffsynth/tokenizer_configs/kolors/tokenizer/tokenizer.model +0 -0
- diffsynth-1.0.0/diffsynth/tokenizer_configs/kolors/tokenizer/tokenizer_config.json +12 -0
- diffsynth-1.0.0/diffsynth/tokenizer_configs/kolors/tokenizer/vocab.txt +0 -0
- diffsynth-1.0.0/diffsynth/tokenizer_configs/stable_diffusion/tokenizer/merges.txt +48895 -0
- diffsynth-1.0.0/diffsynth/tokenizer_configs/stable_diffusion/tokenizer/special_tokens_map.json +24 -0
- diffsynth-1.0.0/diffsynth/tokenizer_configs/stable_diffusion/tokenizer/tokenizer_config.json +34 -0
- diffsynth-1.0.0/diffsynth/tokenizer_configs/stable_diffusion/tokenizer/vocab.json +49410 -0
- diffsynth-1.0.0/diffsynth/tokenizer_configs/stable_diffusion_3/tokenizer_1/merges.txt +48895 -0
- diffsynth-1.0.0/diffsynth/tokenizer_configs/stable_diffusion_3/tokenizer_1/special_tokens_map.json +30 -0
- diffsynth-1.0.0/diffsynth/tokenizer_configs/stable_diffusion_3/tokenizer_1/tokenizer_config.json +30 -0
- diffsynth-1.0.0/diffsynth/tokenizer_configs/stable_diffusion_3/tokenizer_1/vocab.json +49410 -0
- diffsynth-1.0.0/diffsynth/tokenizer_configs/stable_diffusion_3/tokenizer_2/merges.txt +48895 -0
- diffsynth-1.0.0/diffsynth/tokenizer_configs/stable_diffusion_3/tokenizer_2/special_tokens_map.json +30 -0
- diffsynth-1.0.0/diffsynth/tokenizer_configs/stable_diffusion_3/tokenizer_2/tokenizer_config.json +38 -0
- diffsynth-1.0.0/diffsynth/tokenizer_configs/stable_diffusion_3/tokenizer_2/vocab.json +49410 -0
- diffsynth-1.0.0/diffsynth/tokenizer_configs/stable_diffusion_3/tokenizer_3/special_tokens_map.json +125 -0
- diffsynth-1.0.0/diffsynth/tokenizer_configs/stable_diffusion_3/tokenizer_3/spiece.model +0 -0
- diffsynth-1.0.0/diffsynth/tokenizer_configs/stable_diffusion_3/tokenizer_3/tokenizer.json +129428 -0
- diffsynth-1.0.0/diffsynth/tokenizer_configs/stable_diffusion_3/tokenizer_3/tokenizer_config.json +940 -0
- diffsynth-1.0.0/diffsynth/tokenizer_configs/stable_diffusion_xl/tokenizer_2/merges.txt +40213 -0
- diffsynth-1.0.0/diffsynth/tokenizer_configs/stable_diffusion_xl/tokenizer_2/special_tokens_map.json +24 -0
- diffsynth-1.0.0/diffsynth/tokenizer_configs/stable_diffusion_xl/tokenizer_2/tokenizer_config.json +38 -0
- diffsynth-1.0.0/diffsynth/tokenizer_configs/stable_diffusion_xl/tokenizer_2/vocab.json +49411 -0
- diffsynth-1.0.0/diffsynth/trainers/__init__.py +0 -0
- diffsynth-1.0.0/diffsynth/trainers/text_to_image.py +253 -0
- diffsynth-1.0.0/diffsynth.egg-info/PKG-INFO +10 -0
- diffsynth-1.0.0/diffsynth.egg-info/SOURCES.txt +123 -0
- diffsynth-1.0.0/diffsynth.egg-info/dependency_links.txt +1 -0
- diffsynth-1.0.0/diffsynth.egg-info/requires.txt +12 -0
- diffsynth-1.0.0/diffsynth.egg-info/top_level.txt +1 -0
- diffsynth-1.0.0/setup.cfg +4 -0
- diffsynth-1.0.0/setup.py +30 -0
diffsynth-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
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
|
|
95
|
+
Derivative 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,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative 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, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [2023] [Zhongjie Duan]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
diffsynth-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: diffsynth
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Enjoy the magic of Diffusion models!
|
|
5
|
+
Author: Artiprocher
|
|
6
|
+
Classifier: Programming Language :: Python :: 3
|
|
7
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
8
|
+
Classifier: Operating System :: OS Independent
|
|
9
|
+
Requires-Python: >=3.6
|
|
10
|
+
License-File: LICENSE
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# DiffSynth Studio
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<a href="https://trendshift.io/repositories/10946" target="_blank"><img src="https://trendshift.io/api/badge/repositories/10946" alt="modelscope%2FDiffSynth-Studio | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
## Introduction
|
|
8
|
+
|
|
9
|
+
DiffSynth Studio is a Diffusion engine. We have restructured architectures including Text Encoder, UNet, VAE, among others, maintaining compatibility with models from the open-source community while enhancing computational performance. We provide many interesting features. Enjoy the magic of Diffusion models!
|
|
10
|
+
|
|
11
|
+
Until now, DiffSynth Studio has supported the following models:
|
|
12
|
+
|
|
13
|
+
* [ExVideo](https://huggingface.co/ECNU-CILab/ExVideo-SVD-128f-v1)
|
|
14
|
+
* [Kolors](https://huggingface.co/Kwai-Kolors/Kolors)
|
|
15
|
+
* [Stable Diffusion 3](https://huggingface.co/stabilityai/stable-diffusion-3-medium)
|
|
16
|
+
* [Stable Video Diffusion](https://huggingface.co/stabilityai/stable-video-diffusion-img2vid-xt)
|
|
17
|
+
* [Hunyuan-DiT](https://github.com/Tencent/HunyuanDiT)
|
|
18
|
+
* [RIFE](https://github.com/hzwer/ECCV2022-RIFE)
|
|
19
|
+
* [ESRGAN](https://github.com/xinntao/ESRGAN)
|
|
20
|
+
* [Ip-Adapter](https://github.com/tencent-ailab/IP-Adapter)
|
|
21
|
+
* [AnimateDiff](https://github.com/guoyww/animatediff/)
|
|
22
|
+
* [ControlNet](https://github.com/lllyasviel/ControlNet)
|
|
23
|
+
* [Stable Diffusion XL](https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0)
|
|
24
|
+
* [Stable Diffusion](https://huggingface.co/runwayml/stable-diffusion-v1-5)
|
|
25
|
+
|
|
26
|
+
## News
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
- **June 21, 2024.** 🔥🔥🔥 We propose ExVideo, a post-tuning technique aimed at enhancing the capability of video generation models. We have extended Stable Video Diffusion to achieve the generation of long videos up to 128 frames.
|
|
30
|
+
- [Project Page](https://ecnu-cilab.github.io/ExVideoProjectPage/)
|
|
31
|
+
- Source code is released in this repo. See [`examples/ExVideo`](./examples/ExVideo/).
|
|
32
|
+
- Models are released on [HuggingFace](https://huggingface.co/ECNU-CILab/ExVideo-SVD-128f-v1) and [ModelScope](https://modelscope.cn/models/ECNU-CILab/ExVideo-SVD-128f-v1).
|
|
33
|
+
- Technical report is released on [arXiv](https://arxiv.org/abs/2406.14130).
|
|
34
|
+
- You can try ExVideo in this [Demo](https://huggingface.co/spaces/modelscope/ExVideo-SVD-128f-v1)!
|
|
35
|
+
|
|
36
|
+
- **June 13, 2024.** DiffSynth Studio is transferred to ModelScope. The developers have transitioned from "I" to "we". Of course, I will still participate in development and maintenance.
|
|
37
|
+
|
|
38
|
+
- **Jan 29, 2024.** We propose Diffutoon, a fantastic solution for toon shading.
|
|
39
|
+
- [Project Page](https://ecnu-cilab.github.io/DiffutoonProjectPage/)
|
|
40
|
+
- The source codes are released in this project.
|
|
41
|
+
- The technical report (IJCAI 2024) is released on [arXiv](https://arxiv.org/abs/2401.16224).
|
|
42
|
+
|
|
43
|
+
- **Dec 8, 2023.** We decide to develop a new Project, aiming to release the potential of diffusion models, especially in video synthesis. The development of this project is started.
|
|
44
|
+
|
|
45
|
+
- **Nov 15, 2023.** We propose FastBlend, a powerful video deflickering algorithm.
|
|
46
|
+
- The sd-webui extension is released on [GitHub](https://github.com/Artiprocher/sd-webui-fastblend).
|
|
47
|
+
- Demo videos are shown on Bilibili, including three tasks.
|
|
48
|
+
- [Video deflickering](https://www.bilibili.com/video/BV1d94y1W7PE)
|
|
49
|
+
- [Video interpolation](https://www.bilibili.com/video/BV1Lw411m71p)
|
|
50
|
+
- [Image-driven video rendering](https://www.bilibili.com/video/BV1RB4y1Z7LF)
|
|
51
|
+
- The technical report is released on [arXiv](https://arxiv.org/abs/2311.09265).
|
|
52
|
+
- An unofficial ComfyUI extension developed by other users is released on [GitHub](https://github.com/AInseven/ComfyUI-fastblend).
|
|
53
|
+
|
|
54
|
+
- **Oct 1, 2023.** We release an early version of this project, namely FastSDXL. A try for building a diffusion engine.
|
|
55
|
+
- The source codes are released on [GitHub](https://github.com/Artiprocher/FastSDXL).
|
|
56
|
+
- FastSDXL includes a trainable OLSS scheduler for efficiency improvement.
|
|
57
|
+
- The original repo of OLSS is [here](https://github.com/alibaba/EasyNLP/tree/master/diffusion/olss_scheduler).
|
|
58
|
+
- The technical report (CIKM 2023) is released on [arXiv](https://arxiv.org/abs/2305.14677).
|
|
59
|
+
- A demo video is shown on [Bilibili](https://www.bilibili.com/video/BV1w8411y7uj).
|
|
60
|
+
- Since OLSS requires additional training, we don't implement it in this project.
|
|
61
|
+
|
|
62
|
+
- **Aug 29, 2023.** We propose DiffSynth, a video synthesis framework.
|
|
63
|
+
- [Project Page](https://ecnu-cilab.github.io/DiffSynth.github.io/).
|
|
64
|
+
- The source codes are released in [EasyNLP](https://github.com/alibaba/EasyNLP/tree/master/diffusion/DiffSynth).
|
|
65
|
+
- The technical report (ECML PKDD 2024) is released on [arXiv](https://arxiv.org/abs/2308.03463).
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
## Installation
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
git clone https://github.com/modelscope/DiffSynth-Studio.git
|
|
72
|
+
cd DiffSynth-Studio
|
|
73
|
+
pip install -e .
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Usage (in Python code)
|
|
77
|
+
|
|
78
|
+
The Python examples are in [`examples`](./examples/). We provide an overview here.
|
|
79
|
+
|
|
80
|
+
### Long Video Synthesis
|
|
81
|
+
|
|
82
|
+
We trained an extended video synthesis model, which can generate 128 frames. [`examples/ExVideo`](./examples/ExVideo/)
|
|
83
|
+
|
|
84
|
+
https://github.com/modelscope/DiffSynth-Studio/assets/35051019/d97f6aa9-8064-4b5b-9d49-ed6001bb9acc
|
|
85
|
+
|
|
86
|
+
### Image Synthesis
|
|
87
|
+
|
|
88
|
+
Generate high-resolution images, by breaking the limitation of diffusion models! [`examples/image_synthesis`](./examples/image_synthesis/).
|
|
89
|
+
|
|
90
|
+
LoRA fine-tuning is supported in [`examples/train`](./examples/train/).
|
|
91
|
+
|
|
92
|
+
|Model|Example|
|
|
93
|
+
|-|-|
|
|
94
|
+
|Stable Diffusion||
|
|
95
|
+
|Stable Diffusion XL||
|
|
96
|
+
|Stable Diffusion 3||
|
|
97
|
+
|Kolors||
|
|
98
|
+
|Hunyuan-DiT||
|
|
99
|
+
|
|
100
|
+
### Toon Shading
|
|
101
|
+
|
|
102
|
+
Render realistic videos in a flatten style and enable video editing features. [`examples/Diffutoon`](./examples/Diffutoon/)
|
|
103
|
+
|
|
104
|
+
https://github.com/Artiprocher/DiffSynth-Studio/assets/35051019/b54c05c5-d747-4709-be5e-b39af82404dd
|
|
105
|
+
|
|
106
|
+
https://github.com/Artiprocher/DiffSynth-Studio/assets/35051019/20528af5-5100-474a-8cdc-440b9efdd86c
|
|
107
|
+
|
|
108
|
+
### Video Stylization
|
|
109
|
+
|
|
110
|
+
Video stylization without video models. [`examples/diffsynth`](./examples/diffsynth/)
|
|
111
|
+
|
|
112
|
+
https://github.com/Artiprocher/DiffSynth-Studio/assets/35051019/59fb2f7b-8de0-4481-b79f-0c3a7361a1ea
|
|
113
|
+
|
|
114
|
+
## Usage (in WebUI)
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
python -m streamlit run DiffSynth_Studio.py
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
https://github.com/Artiprocher/DiffSynth-Studio/assets/35051019/93085557-73f3-4eee-a205-9829591ef954
|
|
File without changes
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
from typing_extensions import Literal, TypeAlias
|
|
2
|
+
|
|
3
|
+
from ..models.sd_text_encoder import SDTextEncoder
|
|
4
|
+
from ..models.sd_unet import SDUNet
|
|
5
|
+
from ..models.sd_vae_encoder import SDVAEEncoder
|
|
6
|
+
from ..models.sd_vae_decoder import SDVAEDecoder
|
|
7
|
+
|
|
8
|
+
from ..models.sdxl_text_encoder import SDXLTextEncoder, SDXLTextEncoder2
|
|
9
|
+
from ..models.sdxl_unet import SDXLUNet
|
|
10
|
+
from ..models.sdxl_vae_decoder import SDXLVAEDecoder
|
|
11
|
+
from ..models.sdxl_vae_encoder import SDXLVAEEncoder
|
|
12
|
+
|
|
13
|
+
from ..models.sd3_text_encoder import SD3TextEncoder1, SD3TextEncoder2, SD3TextEncoder3
|
|
14
|
+
from ..models.sd3_dit import SD3DiT
|
|
15
|
+
from ..models.sd3_vae_decoder import SD3VAEDecoder
|
|
16
|
+
from ..models.sd3_vae_encoder import SD3VAEEncoder
|
|
17
|
+
|
|
18
|
+
from ..models.sd_controlnet import SDControlNet
|
|
19
|
+
|
|
20
|
+
from ..models.sd_motion import SDMotionModel
|
|
21
|
+
from ..models.sdxl_motion import SDXLMotionModel
|
|
22
|
+
|
|
23
|
+
from ..models.svd_image_encoder import SVDImageEncoder
|
|
24
|
+
from ..models.svd_unet import SVDUNet
|
|
25
|
+
from ..models.svd_vae_decoder import SVDVAEDecoder
|
|
26
|
+
from ..models.svd_vae_encoder import SVDVAEEncoder
|
|
27
|
+
|
|
28
|
+
from ..models.sd_ipadapter import SDIpAdapter, IpAdapterCLIPImageEmbedder
|
|
29
|
+
from ..models.sdxl_ipadapter import SDXLIpAdapter, IpAdapterXLCLIPImageEmbedder
|
|
30
|
+
|
|
31
|
+
from ..models.hunyuan_dit_text_encoder import HunyuanDiTCLIPTextEncoder, HunyuanDiTT5TextEncoder
|
|
32
|
+
from ..models.hunyuan_dit import HunyuanDiT
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
model_loader_configs = [
|
|
37
|
+
# These configs are provided for detecting model type automatically.
|
|
38
|
+
# The format is (state_dict_keys_hash, state_dict_keys_hash_with_shape, model_names, model_classes, model_resource)
|
|
39
|
+
(None, "091b0e30e77c76626b3ba62acdf95343", ["sd_controlnet"], [SDControlNet], "civitai"),
|
|
40
|
+
(None, "4a6c8306a27d916dea81263c8c88f450", ["hunyuan_dit_clip_text_encoder"], [HunyuanDiTCLIPTextEncoder], "civitai"),
|
|
41
|
+
(None, "f4aec400fe394297961218c768004521", ["hunyuan_dit"], [HunyuanDiT], "civitai"),
|
|
42
|
+
(None, "9e6e58043a5a2e332803ed42f6ee7181", ["hunyuan_dit_t5_text_encoder"], [HunyuanDiTT5TextEncoder], "civitai"),
|
|
43
|
+
(None, "13115dd45a6e1c39860f91ab073b8a78", ["sdxl_vae_encoder", "sdxl_vae_decoder"], [SDXLVAEEncoder, SDXLVAEDecoder], "diffusers"),
|
|
44
|
+
(None, "d78aa6797382a6d455362358a3295ea9", ["sd_ipadapter_clip_image_encoder"], [IpAdapterCLIPImageEmbedder], "diffusers"),
|
|
45
|
+
(None, "e291636cc15e803186b47404262ef812", ["sd_ipadapter"], [SDIpAdapter], "civitai"),
|
|
46
|
+
(None, "399c81f2f8de8d1843d0127a00f3c224", ["sdxl_ipadapter_clip_image_encoder"], [IpAdapterXLCLIPImageEmbedder], "diffusers"),
|
|
47
|
+
(None, "a64eac9aa0db4b9602213bc0131281c7", ["sdxl_ipadapter"], [SDXLIpAdapter], "civitai"),
|
|
48
|
+
(None, "52817e4fdd89df154f02749ca6f692ac", ["sdxl_unet"], [SDXLUNet], "diffusers"),
|
|
49
|
+
(None, "03343c606f16d834d6411d0902b53636", ["sd_text_encoder", "sd_unet", "sd_vae_decoder", "sd_vae_encoder"], [SDTextEncoder, SDUNet, SDVAEDecoder, SDVAEEncoder], "civitai"),
|
|
50
|
+
(None, "d4ba77a7ece070679b4a987f58f201e9", ["sd_text_encoder"], [SDTextEncoder], "civitai"),
|
|
51
|
+
(None, "d0c89e55c5a57cf3981def0cb1c9e65a", ["sd_vae_decoder", "sd_vae_encoder"], [SDVAEDecoder, SDVAEEncoder], "civitai"),
|
|
52
|
+
(None, "3926bf373b39a67eeafd7901478a47a7", ["sd_unet"], [SDUNet], "civitai"),
|
|
53
|
+
(None, "1e0c39ec176b9007c05f76d52b554a4d", ["sd3_text_encoder_1", "sd3_text_encoder_2", "sd3_dit", "sd3_vae_encoder", "sd3_vae_decoder"], [SD3TextEncoder1, SD3TextEncoder2, SD3DiT, SD3VAEEncoder, SD3VAEDecoder], "civitai"),
|
|
54
|
+
(None, "d9e0290829ba8d98e28e1a2b1407db4a", ["sd3_text_encoder_1", "sd3_text_encoder_2", "sd3_text_encoder_3", "sd3_dit", "sd3_vae_encoder", "sd3_vae_decoder"], [SD3TextEncoder1, SD3TextEncoder2, SD3TextEncoder3, SD3DiT, SD3VAEEncoder, SD3VAEDecoder], "civitai"),
|
|
55
|
+
(None, "5072d0b24e406b49507abe861cf97691", ["sd3_text_encoder_3"], [SD3TextEncoder3], "civitai"),
|
|
56
|
+
(None, "4cf64a799d04260df438c6f33c9a047e", ["sdxl_text_encoder", "sdxl_text_encoder_2", "sdxl_unet", "sdxl_vae_decoder", "sdxl_vae_encoder"], [SDXLTextEncoder, SDXLTextEncoder2, SDXLUNet, SDXLVAEDecoder, SDXLVAEEncoder], "civitai"),
|
|
57
|
+
(None, "d9b008a867c498ab12ad24042eff8e3f", ["sdxl_text_encoder", "sdxl_text_encoder_2", "sdxl_unet", "sdxl_vae_decoder", "sdxl_vae_encoder"], [SDXLTextEncoder, SDXLTextEncoder2, SDXLUNet, SDXLVAEDecoder, SDXLVAEEncoder], "civitai"), # SDXL-Turbo
|
|
58
|
+
(None, "025bb7452e531a3853d951d77c63f032", ["sdxl_text_encoder", "sdxl_text_encoder_2"], [SDXLTextEncoder, SDXLTextEncoder2], "civitai"),
|
|
59
|
+
(None, "298997b403a4245c04102c9f36aac348", ["sdxl_unet"], [SDXLUNet], "civitai"),
|
|
60
|
+
(None, "2a07abce74b4bdc696b76254ab474da6", ["svd_image_encoder", "svd_unet", "svd_vae_decoder", "svd_vae_encoder"], [SVDImageEncoder, SVDUNet, SVDVAEDecoder, SVDVAEEncoder], "civitai"),
|
|
61
|
+
(None, "c96a285a6888465f87de22a984d049fb", ["sd_motion_modules"], [SDMotionModel], "civitai"),
|
|
62
|
+
(None, "72907b92caed19bdb2adb89aa4063fe2", ["sdxl_motion_modules"], [SDXLMotionModel], "civitai"),
|
|
63
|
+
]
|
|
64
|
+
huggingface_model_loader_configs = [
|
|
65
|
+
# These configs are provided for detecting model type automatically.
|
|
66
|
+
# The format is (architecture_in_huggingface_config, huggingface_lib, model_name)
|
|
67
|
+
("ChatGLMModel", "diffsynth.models.kolors_text_encoder", "kolors_text_encoder"),
|
|
68
|
+
("MarianMTModel", "transformers.models.marian.modeling_marian", "translator"),
|
|
69
|
+
("BloomForCausalLM", "transformers.models.bloom.modeling_bloom", "beautiful_prompt"),
|
|
70
|
+
]
|
|
71
|
+
patch_model_loader_configs = [
|
|
72
|
+
# These configs are provided for detecting model type automatically.
|
|
73
|
+
# The format is (state_dict_keys_hash_with_shape, model_name, model_class, extra_kwargs)
|
|
74
|
+
("9a4ab6869ac9b7d6e31f9854e397c867", ["svd_unet"], [SVDUNet], {"add_positional_conv": 128}),
|
|
75
|
+
]
|
|
76
|
+
|
|
77
|
+
preset_models_on_huggingface = {
|
|
78
|
+
"HunyuanDiT": [
|
|
79
|
+
("Tencent-Hunyuan/HunyuanDiT", "t2i/clip_text_encoder/pytorch_model.bin", "models/HunyuanDiT/t2i/clip_text_encoder"),
|
|
80
|
+
("Tencent-Hunyuan/HunyuanDiT", "t2i/mt5/pytorch_model.bin", "models/HunyuanDiT/t2i/mt5"),
|
|
81
|
+
("Tencent-Hunyuan/HunyuanDiT", "t2i/model/pytorch_model_ema.pt", "models/HunyuanDiT/t2i/model"),
|
|
82
|
+
("Tencent-Hunyuan/HunyuanDiT", "t2i/sdxl-vae-fp16-fix/diffusion_pytorch_model.bin", "models/HunyuanDiT/t2i/sdxl-vae-fp16-fix"),
|
|
83
|
+
],
|
|
84
|
+
"stable-video-diffusion-img2vid-xt": [
|
|
85
|
+
("stabilityai/stable-video-diffusion-img2vid-xt", "svd_xt.safetensors", "models/stable_video_diffusion"),
|
|
86
|
+
],
|
|
87
|
+
"ExVideo-SVD-128f-v1": [
|
|
88
|
+
("ECNU-CILab/ExVideo-SVD-128f-v1", "model.fp16.safetensors", "models/stable_video_diffusion"),
|
|
89
|
+
],
|
|
90
|
+
}
|
|
91
|
+
preset_models_on_modelscope = {
|
|
92
|
+
# Hunyuan DiT
|
|
93
|
+
"HunyuanDiT": [
|
|
94
|
+
("modelscope/HunyuanDiT", "t2i/clip_text_encoder/pytorch_model.bin", "models/HunyuanDiT/t2i/clip_text_encoder"),
|
|
95
|
+
("modelscope/HunyuanDiT", "t2i/mt5/pytorch_model.bin", "models/HunyuanDiT/t2i/mt5"),
|
|
96
|
+
("modelscope/HunyuanDiT", "t2i/model/pytorch_model_ema.pt", "models/HunyuanDiT/t2i/model"),
|
|
97
|
+
("modelscope/HunyuanDiT", "t2i/sdxl-vae-fp16-fix/diffusion_pytorch_model.bin", "models/HunyuanDiT/t2i/sdxl-vae-fp16-fix"),
|
|
98
|
+
],
|
|
99
|
+
# Stable Video Diffusion
|
|
100
|
+
"stable-video-diffusion-img2vid-xt": [
|
|
101
|
+
("AI-ModelScope/stable-video-diffusion-img2vid-xt", "svd_xt.safetensors", "models/stable_video_diffusion"),
|
|
102
|
+
],
|
|
103
|
+
# ExVideo
|
|
104
|
+
"ExVideo-SVD-128f-v1": [
|
|
105
|
+
("ECNU-CILab/ExVideo-SVD-128f-v1", "model.fp16.safetensors", "models/stable_video_diffusion"),
|
|
106
|
+
],
|
|
107
|
+
# Stable Diffusion
|
|
108
|
+
"StableDiffusion_v15": [
|
|
109
|
+
("AI-ModelScope/stable-diffusion-v1-5", "v1-5-pruned-emaonly.safetensors", "models/stable_diffusion"),
|
|
110
|
+
],
|
|
111
|
+
"DreamShaper_8": [
|
|
112
|
+
("sd_lora/dreamshaper_8", "dreamshaper_8.safetensors", "models/stable_diffusion"),
|
|
113
|
+
],
|
|
114
|
+
"AingDiffusion_v12": [
|
|
115
|
+
("sd_lora/aingdiffusion_v12", "aingdiffusion_v12.safetensors", "models/stable_diffusion"),
|
|
116
|
+
],
|
|
117
|
+
"Flat2DAnimerge_v45Sharp": [
|
|
118
|
+
("sd_lora/Flat-2D-Animerge", "flat2DAnimerge_v45Sharp.safetensors", "models/stable_diffusion"),
|
|
119
|
+
],
|
|
120
|
+
# Textual Inversion
|
|
121
|
+
"TextualInversion_VeryBadImageNegative_v1.3": [
|
|
122
|
+
("sd_lora/verybadimagenegative_v1.3", "verybadimagenegative_v1.3.pt", "models/textual_inversion"),
|
|
123
|
+
],
|
|
124
|
+
# Stable Diffusion XL
|
|
125
|
+
"StableDiffusionXL_v1": [
|
|
126
|
+
("AI-ModelScope/stable-diffusion-xl-base-1.0", "sd_xl_base_1.0.safetensors", "models/stable_diffusion_xl"),
|
|
127
|
+
],
|
|
128
|
+
"BluePencilXL_v200": [
|
|
129
|
+
("sd_lora/bluePencilXL_v200", "bluePencilXL_v200.safetensors", "models/stable_diffusion_xl"),
|
|
130
|
+
],
|
|
131
|
+
"StableDiffusionXL_Turbo": [
|
|
132
|
+
("AI-ModelScope/sdxl-turbo", "sd_xl_turbo_1.0_fp16.safetensors", "models/stable_diffusion_xl_turbo"),
|
|
133
|
+
],
|
|
134
|
+
# Stable Diffusion 3
|
|
135
|
+
"StableDiffusion3": [
|
|
136
|
+
("AI-ModelScope/stable-diffusion-3-medium", "sd3_medium_incl_clips_t5xxlfp16.safetensors", "models/stable_diffusion_3"),
|
|
137
|
+
],
|
|
138
|
+
"StableDiffusion3_without_T5": [
|
|
139
|
+
("AI-ModelScope/stable-diffusion-3-medium", "sd3_medium_incl_clips.safetensors", "models/stable_diffusion_3"),
|
|
140
|
+
],
|
|
141
|
+
# ControlNet
|
|
142
|
+
"ControlNet_v11f1p_sd15_depth": [
|
|
143
|
+
("AI-ModelScope/ControlNet-v1-1", "control_v11f1p_sd15_depth.pth", "models/ControlNet"),
|
|
144
|
+
("sd_lora/Annotators", "dpt_hybrid-midas-501f0c75.pt", "models/Annotators")
|
|
145
|
+
],
|
|
146
|
+
"ControlNet_v11p_sd15_softedge": [
|
|
147
|
+
("AI-ModelScope/ControlNet-v1-1", "control_v11p_sd15_softedge.pth", "models/ControlNet"),
|
|
148
|
+
("sd_lora/Annotators", "ControlNetHED.pth", "models/Annotators")
|
|
149
|
+
],
|
|
150
|
+
"ControlNet_v11f1e_sd15_tile": [
|
|
151
|
+
("AI-ModelScope/ControlNet-v1-1", "control_v11f1e_sd15_tile.pth", "models/ControlNet")
|
|
152
|
+
],
|
|
153
|
+
"ControlNet_v11p_sd15_lineart": [
|
|
154
|
+
("AI-ModelScope/ControlNet-v1-1", "control_v11p_sd15_lineart.pth", "models/ControlNet"),
|
|
155
|
+
("sd_lora/Annotators", "sk_model.pth", "models/Annotators"),
|
|
156
|
+
("sd_lora/Annotators", "sk_model2.pth", "models/Annotators")
|
|
157
|
+
],
|
|
158
|
+
# AnimateDiff
|
|
159
|
+
"AnimateDiff_v2": [
|
|
160
|
+
("Shanghai_AI_Laboratory/animatediff", "mm_sd_v15_v2.ckpt", "models/AnimateDiff"),
|
|
161
|
+
],
|
|
162
|
+
"AnimateDiff_xl_beta": [
|
|
163
|
+
("Shanghai_AI_Laboratory/animatediff", "mm_sdxl_v10_beta.ckpt", "models/AnimateDiff"),
|
|
164
|
+
],
|
|
165
|
+
# RIFE
|
|
166
|
+
"RIFE": [
|
|
167
|
+
("Damo_XR_Lab/cv_rife_video-frame-interpolation", "flownet.pkl", "models/RIFE"),
|
|
168
|
+
],
|
|
169
|
+
# Beautiful Prompt
|
|
170
|
+
"BeautifulPrompt": [
|
|
171
|
+
("AI-ModelScope/pai-bloom-1b1-text2prompt-sd", "config.json", "models/BeautifulPrompt/pai-bloom-1b1-text2prompt-sd"),
|
|
172
|
+
("AI-ModelScope/pai-bloom-1b1-text2prompt-sd", "generation_config.json", "models/BeautifulPrompt/pai-bloom-1b1-text2prompt-sd"),
|
|
173
|
+
("AI-ModelScope/pai-bloom-1b1-text2prompt-sd", "model.safetensors", "models/BeautifulPrompt/pai-bloom-1b1-text2prompt-sd"),
|
|
174
|
+
("AI-ModelScope/pai-bloom-1b1-text2prompt-sd", "special_tokens_map.json", "models/BeautifulPrompt/pai-bloom-1b1-text2prompt-sd"),
|
|
175
|
+
("AI-ModelScope/pai-bloom-1b1-text2prompt-sd", "tokenizer.json", "models/BeautifulPrompt/pai-bloom-1b1-text2prompt-sd"),
|
|
176
|
+
("AI-ModelScope/pai-bloom-1b1-text2prompt-sd", "tokenizer_config.json", "models/BeautifulPrompt/pai-bloom-1b1-text2prompt-sd"),
|
|
177
|
+
],
|
|
178
|
+
# Translator
|
|
179
|
+
"opus-mt-zh-en": [
|
|
180
|
+
("moxying/opus-mt-zh-en", "config.json", "models/translator/opus-mt-zh-en"),
|
|
181
|
+
("moxying/opus-mt-zh-en", "generation_config.json", "models/translator/opus-mt-zh-en"),
|
|
182
|
+
("moxying/opus-mt-zh-en", "metadata.json", "models/translator/opus-mt-zh-en"),
|
|
183
|
+
("moxying/opus-mt-zh-en", "pytorch_model.bin", "models/translator/opus-mt-zh-en"),
|
|
184
|
+
("moxying/opus-mt-zh-en", "source.spm", "models/translator/opus-mt-zh-en"),
|
|
185
|
+
("moxying/opus-mt-zh-en", "target.spm", "models/translator/opus-mt-zh-en"),
|
|
186
|
+
("moxying/opus-mt-zh-en", "tokenizer_config.json", "models/translator/opus-mt-zh-en"),
|
|
187
|
+
("moxying/opus-mt-zh-en", "vocab.json", "models/translator/opus-mt-zh-en"),
|
|
188
|
+
],
|
|
189
|
+
# IP-Adapter
|
|
190
|
+
"IP-Adapter-SD": [
|
|
191
|
+
("AI-ModelScope/IP-Adapter", "models/image_encoder/model.safetensors", "models/IpAdapter/stable_diffusion/image_encoder"),
|
|
192
|
+
("AI-ModelScope/IP-Adapter", "models/ip-adapter_sd15.bin", "models/IpAdapter/stable_diffusion"),
|
|
193
|
+
],
|
|
194
|
+
"IP-Adapter-SDXL": [
|
|
195
|
+
("AI-ModelScope/IP-Adapter", "sdxl_models/image_encoder/model.safetensors", "models/IpAdapter/stable_diffusion_xl/image_encoder"),
|
|
196
|
+
("AI-ModelScope/IP-Adapter", "sdxl_models/ip-adapter_sdxl.bin", "models/IpAdapter/stable_diffusion_xl"),
|
|
197
|
+
],
|
|
198
|
+
# Kolors
|
|
199
|
+
"Kolors": [
|
|
200
|
+
("Kwai-Kolors/Kolors", "text_encoder/config.json", "models/kolors/Kolors/text_encoder"),
|
|
201
|
+
("Kwai-Kolors/Kolors", "text_encoder/pytorch_model.bin.index.json", "models/kolors/Kolors/text_encoder"),
|
|
202
|
+
("Kwai-Kolors/Kolors", "text_encoder/pytorch_model-00001-of-00007.bin", "models/kolors/Kolors/text_encoder"),
|
|
203
|
+
("Kwai-Kolors/Kolors", "text_encoder/pytorch_model-00002-of-00007.bin", "models/kolors/Kolors/text_encoder"),
|
|
204
|
+
("Kwai-Kolors/Kolors", "text_encoder/pytorch_model-00003-of-00007.bin", "models/kolors/Kolors/text_encoder"),
|
|
205
|
+
("Kwai-Kolors/Kolors", "text_encoder/pytorch_model-00004-of-00007.bin", "models/kolors/Kolors/text_encoder"),
|
|
206
|
+
("Kwai-Kolors/Kolors", "text_encoder/pytorch_model-00005-of-00007.bin", "models/kolors/Kolors/text_encoder"),
|
|
207
|
+
("Kwai-Kolors/Kolors", "text_encoder/pytorch_model-00006-of-00007.bin", "models/kolors/Kolors/text_encoder"),
|
|
208
|
+
("Kwai-Kolors/Kolors", "text_encoder/pytorch_model-00007-of-00007.bin", "models/kolors/Kolors/text_encoder"),
|
|
209
|
+
("Kwai-Kolors/Kolors", "unet/diffusion_pytorch_model.safetensors", "models/kolors/Kolors/unet"),
|
|
210
|
+
("Kwai-Kolors/Kolors", "vae/diffusion_pytorch_model.safetensors", "models/kolors/Kolors/vae"),
|
|
211
|
+
],
|
|
212
|
+
"SDXL-vae-fp16-fix": [
|
|
213
|
+
("AI-ModelScope/sdxl-vae-fp16-fix", "diffusion_pytorch_model.safetensors", "models/sdxl-vae-fp16-fix")
|
|
214
|
+
],
|
|
215
|
+
}
|
|
216
|
+
Preset_model_id: TypeAlias = Literal[
|
|
217
|
+
"HunyuanDiT",
|
|
218
|
+
"stable-video-diffusion-img2vid-xt",
|
|
219
|
+
"ExVideo-SVD-128f-v1",
|
|
220
|
+
"StableDiffusion_v15",
|
|
221
|
+
"DreamShaper_8",
|
|
222
|
+
"AingDiffusion_v12",
|
|
223
|
+
"Flat2DAnimerge_v45Sharp",
|
|
224
|
+
"TextualInversion_VeryBadImageNegative_v1.3",
|
|
225
|
+
"StableDiffusionXL_v1",
|
|
226
|
+
"BluePencilXL_v200",
|
|
227
|
+
"StableDiffusionXL_Turbo",
|
|
228
|
+
"ControlNet_v11f1p_sd15_depth",
|
|
229
|
+
"ControlNet_v11p_sd15_softedge",
|
|
230
|
+
"ControlNet_v11f1e_sd15_tile",
|
|
231
|
+
"ControlNet_v11p_sd15_lineart",
|
|
232
|
+
"AnimateDiff_v2",
|
|
233
|
+
"AnimateDiff_xl_beta",
|
|
234
|
+
"RIFE",
|
|
235
|
+
"BeautifulPrompt",
|
|
236
|
+
"opus-mt-zh-en",
|
|
237
|
+
"IP-Adapter-SD",
|
|
238
|
+
"IP-Adapter-SDXL",
|
|
239
|
+
"StableDiffusion3",
|
|
240
|
+
"StableDiffusion3_without_T5",
|
|
241
|
+
"Kolors",
|
|
242
|
+
"SDXL-vae-fp16-fix",
|
|
243
|
+
]
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import torch
|
|
2
|
+
import numpy as np
|
|
3
|
+
from .processors import Processor_id
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class ControlNetConfigUnit:
|
|
7
|
+
def __init__(self, processor_id: Processor_id, model_path, scale=1.0):
|
|
8
|
+
self.processor_id = processor_id
|
|
9
|
+
self.model_path = model_path
|
|
10
|
+
self.scale = scale
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class ControlNetUnit:
|
|
14
|
+
def __init__(self, processor, model, scale=1.0):
|
|
15
|
+
self.processor = processor
|
|
16
|
+
self.model = model
|
|
17
|
+
self.scale = scale
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class MultiControlNetManager:
|
|
21
|
+
def __init__(self, controlnet_units=[]):
|
|
22
|
+
self.processors = [unit.processor for unit in controlnet_units]
|
|
23
|
+
self.models = [unit.model for unit in controlnet_units]
|
|
24
|
+
self.scales = [unit.scale for unit in controlnet_units]
|
|
25
|
+
|
|
26
|
+
def process_image(self, image, processor_id=None):
|
|
27
|
+
if processor_id is None:
|
|
28
|
+
processed_image = [processor(image) for processor in self.processors]
|
|
29
|
+
else:
|
|
30
|
+
processed_image = [self.processors[processor_id](image)]
|
|
31
|
+
processed_image = torch.concat([
|
|
32
|
+
torch.Tensor(np.array(image_, dtype=np.float32) / 255).permute(2, 0, 1).unsqueeze(0)
|
|
33
|
+
for image_ in processed_image
|
|
34
|
+
], dim=0)
|
|
35
|
+
return processed_image
|
|
36
|
+
|
|
37
|
+
def __call__(
|
|
38
|
+
self,
|
|
39
|
+
sample, timestep, encoder_hidden_states, conditionings,
|
|
40
|
+
tiled=False, tile_size=64, tile_stride=32
|
|
41
|
+
):
|
|
42
|
+
res_stack = None
|
|
43
|
+
for conditioning, model, scale in zip(conditionings, self.models, self.scales):
|
|
44
|
+
res_stack_ = model(
|
|
45
|
+
sample, timestep, encoder_hidden_states, conditioning,
|
|
46
|
+
tiled=tiled, tile_size=tile_size, tile_stride=tile_stride
|
|
47
|
+
)
|
|
48
|
+
res_stack_ = [res * scale for res in res_stack_]
|
|
49
|
+
if res_stack is None:
|
|
50
|
+
res_stack = res_stack_
|
|
51
|
+
else:
|
|
52
|
+
res_stack = [i + j for i, j in zip(res_stack, res_stack_)]
|
|
53
|
+
return res_stack
|