RioShiina commited on
Commit
c4ba3a5
·
verified ·
1 Parent(s): bf02f2c

Upload folder using huggingface_hub

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. LICENSE +674 -0
  2. README.md +1 -1
  3. app.py +14 -47
  4. chain_injectors/anima_controlnet_lllite_injector.py +48 -0
  5. chain_injectors/controlnet_injector.py +11 -0
  6. chain_injectors/flux1_ipadapter_injector.py +46 -0
  7. chain_injectors/ipadapter_injector.py +106 -0
  8. chain_injectors/newbie_lora_injector.py +63 -0
  9. chain_injectors/reference_latent_injector.py +157 -0
  10. chain_injectors/sd3_ipadapter_injector.py +66 -0
  11. chain_injectors/style_injector.py +71 -0
  12. chain_injectors/vae_injector.py +30 -0
  13. comfy_integration/nodes.py +5 -0
  14. comfy_integration/setup.py +44 -13
  15. core/generation_logic.py +0 -15
  16. core/model_manager.py +5 -21
  17. core/pipelines/sd_image_pipeline.py +231 -72
  18. core/pipelines/workflow_recipes/_partials/_base_sampler_sd.yaml +36 -0
  19. core/pipelines/workflow_recipes/_partials/conditioning/anima.yaml +58 -0
  20. core/pipelines/workflow_recipes/_partials/conditioning/chroma1-radiance.yaml +59 -0
  21. core/pipelines/workflow_recipes/_partials/conditioning/chroma1.yaml +61 -0
  22. core/pipelines/workflow_recipes/_partials/conditioning/ernie-image.yaml +54 -0
  23. core/pipelines/workflow_recipes/_partials/conditioning/flux1.yaml +64 -0
  24. core/pipelines/workflow_recipes/_partials/conditioning/flux2-kv.yaml +104 -0
  25. core/pipelines/workflow_recipes/_partials/conditioning/flux2.yaml +96 -0
  26. core/pipelines/workflow_recipes/_partials/conditioning/hidream.yaml +53 -0
  27. core/pipelines/workflow_recipes/_partials/conditioning/hunyuanimage.yaml +42 -0
  28. core/pipelines/workflow_recipes/_partials/conditioning/longcat-image.yaml +83 -0
  29. core/pipelines/workflow_recipes/_partials/conditioning/lumina.yaml +57 -0
  30. core/pipelines/workflow_recipes/_partials/conditioning/newbie-image.yaml +65 -0
  31. core/pipelines/workflow_recipes/_partials/conditioning/omnigen2.yaml +59 -0
  32. core/pipelines/workflow_recipes/_partials/conditioning/ovis-image.yaml +50 -0
  33. core/pipelines/workflow_recipes/_partials/conditioning/qwen-image.yaml +80 -0
  34. core/pipelines/workflow_recipes/_partials/conditioning/sd15.yaml +69 -0
  35. core/pipelines/workflow_recipes/_partials/conditioning/sd35.yaml +58 -0
  36. core/pipelines/workflow_recipes/_partials/conditioning/sdxl.yaml +63 -0
  37. core/pipelines/workflow_recipes/_partials/conditioning/z-image.yaml +1 -14
  38. core/pipelines/workflow_recipes/_partials/input/hires_fix.yaml +4 -3
  39. core/pipelines/workflow_recipes/_partials/input/img2img.yaml +3 -2
  40. core/pipelines/workflow_recipes/_partials/input/inpaint.yaml +6 -8
  41. core/pipelines/workflow_recipes/_partials/input/outpaint.yaml +14 -11
  42. core/pipelines/workflow_recipes/_partials/input/txt2img.yaml +2 -8
  43. core/pipelines/workflow_recipes/_partials/input/txt2img_chroma_radiance_latent.yaml +11 -0
  44. core/pipelines/workflow_recipes/_partials/input/txt2img_flux2_latent.yaml +11 -0
  45. core/pipelines/workflow_recipes/_partials/input/txt2img_hunyuan_latent.yaml +11 -0
  46. core/pipelines/workflow_recipes/_partials/input/txt2img_latent.yaml +11 -0
  47. core/pipelines/workflow_recipes/_partials/input/txt2img_sd3_latent.yaml +11 -0
  48. core/pipelines/workflow_recipes/sd_unified_recipe.yaml +2 -2
  49. core/settings.py +113 -31
  50. requirements.txt +10 -9
LICENSE ADDED
@@ -0,0 +1,674 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+ Preamble
9
+
10
+ The GNU General Public License is a free, copyleft license for
11
+ software and other kinds of works.
12
+
13
+ The licenses for most software and other practical works are designed
14
+ to take away your freedom to share and change the works. By contrast,
15
+ the GNU General Public License is intended to guarantee your freedom to
16
+ share and change all versions of a program--to make sure it remains free
17
+ software for all its users. We, the Free Software Foundation, use the
18
+ GNU General Public License for most of our software; it applies also to
19
+ any other work released this way by its authors. You can apply it to
20
+ your programs, too.
21
+
22
+ When we speak of free software, we are referring to freedom, not
23
+ price. Our General Public Licenses are designed to make sure that you
24
+ have the freedom to distribute copies of free software (and charge for
25
+ them if you wish), that you receive source code or can get it if you
26
+ want it, that you can change the software or use pieces of it in new
27
+ free programs, and that you know you can do these things.
28
+
29
+ To protect your rights, we need to prevent others from denying you
30
+ these rights or asking you to surrender the rights. Therefore, you have
31
+ certain responsibilities if you distribute copies of the software, or if
32
+ you modify it: responsibilities to respect the freedom of others.
33
+
34
+ For example, if you distribute copies of such a program, whether
35
+ gratis or for a fee, you must pass on to the recipients the same
36
+ freedoms that you received. You must make sure that they, too, receive
37
+ or can get the source code. And you must show them these terms so they
38
+ know their rights.
39
+
40
+ Developers that use the GNU GPL protect your rights with two steps:
41
+ (1) assert copyright on the software, and (2) offer you this License
42
+ giving you legal permission to copy, distribute and/or modify it.
43
+
44
+ For the developers' and authors' protection, the GPL clearly explains
45
+ that there is no warranty for this free software. For both users' and
46
+ authors' sake, the GPL requires that modified versions be marked as
47
+ changed, so that their problems will not be attributed erroneously to
48
+ authors of previous versions.
49
+
50
+ Some devices are designed to deny users access to install or run
51
+ modified versions of the software inside them, although the manufacturer
52
+ can do so. This is fundamentally incompatible with the aim of
53
+ protecting users' freedom to change the software. The systematic
54
+ pattern of such abuse occurs in the area of products for individuals to
55
+ use, which is precisely where it is most unacceptable. Therefore, we
56
+ have designed this version of the GPL to prohibit the practice for those
57
+ products. If such problems arise substantially in other domains, we
58
+ stand ready to extend this provision to those domains in future versions
59
+ of the GPL, as needed to protect the freedom of users.
60
+
61
+ Finally, every program is threatened constantly by software patents.
62
+ States should not allow patents to restrict development and use of
63
+ software on general-purpose computers, but in those that do, we wish to
64
+ avoid the special danger that patents applied to a free program could
65
+ make it effectively proprietary. To prevent this, the GPL assures that
66
+ patents cannot be used to render the program non-free.
67
+
68
+ The precise terms and conditions for copying, distribution and
69
+ modification follow.
70
+
71
+ TERMS AND CONDITIONS
72
+
73
+ 0. Definitions.
74
+
75
+ "This License" refers to version 3 of the GNU General Public License.
76
+
77
+ "Copyright" also means copyright-like laws that apply to other kinds of
78
+ works, such as semiconductor masks.
79
+
80
+ "The Program" refers to any copyrightable work licensed under this
81
+ License. Each licensee is addressed as "you". "Licensees" and
82
+ "recipients" may be individuals or organizations.
83
+
84
+ To "modify" a work means to copy from or adapt all or part of the work
85
+ in a fashion requiring copyright permission, other than the making of an
86
+ exact copy. The resulting work is called a "modified version" of the
87
+ earlier work or a work "based on" the earlier work.
88
+
89
+ A "covered work" means either the unmodified Program or a work based
90
+ on the Program.
91
+
92
+ To "propagate" a work means to do anything with it that, without
93
+ permission, would make you directly or secondarily liable for
94
+ infringement under applicable copyright law, except executing it on a
95
+ computer or modifying a private copy. Propagation includes copying,
96
+ distribution (with or without modification), making available to the
97
+ public, and in some countries other activities as well.
98
+
99
+ To "convey" a work means any kind of propagation that enables other
100
+ parties to make or receive copies. Mere interaction with a user through
101
+ a computer network, with no transfer of a copy, is not conveying.
102
+
103
+ An interactive user interface displays "Appropriate Legal Notices"
104
+ to the extent that it includes a convenient and prominently visible
105
+ feature that (1) displays an appropriate copyright notice, and (2)
106
+ tells the user that there is no warranty for the work (except to the
107
+ extent that warranties are provided), that licensees may convey the
108
+ work under this License, and how to view a copy of this License. If
109
+ the interface presents a list of user commands or options, such as a
110
+ menu, a prominent item in the list meets this criterion.
111
+
112
+ 1. Source Code.
113
+
114
+ The "source code" for a work means the preferred form of the work
115
+ for making modifications to it. "Object code" means any non-source
116
+ form of a work.
117
+
118
+ A "Standard Interface" means an interface that either is an official
119
+ standard defined by a recognized standards body, or, in the case of
120
+ interfaces specified for a particular programming language, one that
121
+ is widely used among developers working in that language.
122
+
123
+ The "System Libraries" of an executable work include anything, other
124
+ than the work as a whole, that (a) is included in the normal form of
125
+ packaging a Major Component, but which is not part of that Major
126
+ Component, and (b) serves only to enable use of the work with that
127
+ Major Component, or to implement a Standard Interface for which an
128
+ implementation is available to the public in source code form. A
129
+ "Major Component", in this context, means a major essential component
130
+ (kernel, window system, and so on) of the specific operating system
131
+ (if any) on which the executable work runs, or a compiler used to
132
+ produce the work, or an object code interpreter used to run it.
133
+
134
+ The "Corresponding Source" for a work in object code form means all
135
+ the source code needed to generate, install, and (for an executable
136
+ work) run the object code and to modify the work, including scripts to
137
+ control those activities. However, it does not include the work's
138
+ System Libraries, or general-purpose tools or generally available free
139
+ programs which are used unmodified in performing those activities but
140
+ which are not part of the work. For example, Corresponding Source
141
+ includes interface definition files associated with source files for
142
+ the work, and the source code for shared libraries and dynamically
143
+ linked subprograms that the work is specifically designed to require,
144
+ such as by intimate data communication or control flow between those
145
+ subprograms and other parts of the work.
146
+
147
+ The Corresponding Source need not include anything that users
148
+ can regenerate automatically from other parts of the Corresponding
149
+ Source.
150
+
151
+ The Corresponding Source for a work in source code form is that
152
+ same work.
153
+
154
+ 2. Basic Permissions.
155
+
156
+ All rights granted under this License are granted for the term of
157
+ copyright on the Program, and are irrevocable provided the stated
158
+ conditions are met. This License explicitly affirms your unlimited
159
+ permission to run the unmodified Program. The output from running a
160
+ covered work is covered by this License only if the output, given its
161
+ content, constitutes a covered work. This License acknowledges your
162
+ rights of fair use or other equivalent, as provided by copyright law.
163
+
164
+ You may make, run and propagate covered works that you do not
165
+ convey, without conditions so long as your license otherwise remains
166
+ in force. You may convey covered works to others for the sole purpose
167
+ of having them make modifications exclusively for you, or provide you
168
+ with facilities for running those works, provided that you comply with
169
+ the terms of this License in conveying all material for which you do
170
+ not control copyright. Those thus making or running the covered works
171
+ for you must do so exclusively on your behalf, under your direction
172
+ and control, on terms that prohibit them from making any copies of
173
+ your copyrighted material outside their relationship with you.
174
+
175
+ Conveying under any other circumstances is permitted solely under
176
+ the conditions stated below. Sublicensing is not allowed; section 10
177
+ makes it unnecessary.
178
+
179
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180
+
181
+ No covered work shall be deemed part of an effective technological
182
+ measure under any applicable law fulfilling obligations under article
183
+ 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184
+ similar laws prohibiting or restricting circumvention of such
185
+ measures.
186
+
187
+ When you convey a covered work, you waive any legal power to forbid
188
+ circumvention of technological measures to the extent such circumvention
189
+ is effected by exercising rights under this License with respect to
190
+ the covered work, and you disclaim any intention to limit operation or
191
+ modification of the work as a means of enforcing, against the work's
192
+ users, your or third parties' legal rights to forbid circumvention of
193
+ technological measures.
194
+
195
+ 4. Conveying Verbatim Copies.
196
+
197
+ You may convey verbatim copies of the Program's source code as you
198
+ receive it, in any medium, provided that you conspicuously and
199
+ appropriately publish on each copy an appropriate copyright notice;
200
+ keep intact all notices stating that this License and any
201
+ non-permissive terms added in accord with section 7 apply to the code;
202
+ keep intact all notices of the absence of any warranty; and give all
203
+ recipients a copy of this License along with the Program.
204
+
205
+ You may charge any price or no price for each copy that you convey,
206
+ and you may offer support or warranty protection for a fee.
207
+
208
+ 5. Conveying Modified Source Versions.
209
+
210
+ You may convey a work based on the Program, or the modifications to
211
+ produce it from the Program, in the form of source code under the
212
+ terms of section 4, provided that you also meet all of these conditions:
213
+
214
+ a) The work must carry prominent notices stating that you modified
215
+ it, and giving a relevant date.
216
+
217
+ b) The work must carry prominent notices stating that it is
218
+ released under this License and any conditions added under section
219
+ 7. This requirement modifies the requirement in section 4 to
220
+ "keep intact all notices".
221
+
222
+ c) You must license the entire work, as a whole, under this
223
+ License to anyone who comes into possession of a copy. This
224
+ License will therefore apply, along with any applicable section 7
225
+ additional terms, to the whole of the work, and all its parts,
226
+ regardless of how they are packaged. This License gives no
227
+ permission to license the work in any other way, but it does not
228
+ invalidate such permission if you have separately received it.
229
+
230
+ d) If the work has interactive user interfaces, each must display
231
+ Appropriate Legal Notices; however, if the Program has interactive
232
+ interfaces that do not display Appropriate Legal Notices, your
233
+ work need not make them do so.
234
+
235
+ A compilation of a covered work with other separate and independent
236
+ works, which are not by their nature extensions of the covered work,
237
+ and which are not combined with it such as to form a larger program,
238
+ in or on a volume of a storage or distribution medium, is called an
239
+ "aggregate" if the compilation and its resulting copyright are not
240
+ used to limit the access or legal rights of the compilation's users
241
+ beyond what the individual works permit. Inclusion of a covered work
242
+ in an aggregate does not cause this License to apply to the other
243
+ parts of the aggregate.
244
+
245
+ 6. Conveying Non-Source Forms.
246
+
247
+ You may convey a covered work in object code form under the terms
248
+ of sections 4 and 5, provided that you also convey the
249
+ machine-readable Corresponding Source under the terms of this License,
250
+ in one of these ways:
251
+
252
+ a) Convey the object code in, or embodied in, a physical product
253
+ (including a physical distribution medium), accompanied by the
254
+ Corresponding Source fixed on a durable physical medium
255
+ customarily used for software interchange.
256
+
257
+ b) Convey the object code in, or embodied in, a physical product
258
+ (including a physical distribution medium), accompanied by a
259
+ written offer, valid for at least three years and valid for as
260
+ long as you offer spare parts or customer support for that product
261
+ model, to give anyone who possesses the object code either (1) a
262
+ copy of the Corresponding Source for all the software in the
263
+ product that is covered by this License, on a durable physical
264
+ medium customarily used for software interchange, for a price no
265
+ more than your reasonable cost of physically performing this
266
+ conveying of source, or (2) access to copy the
267
+ Corresponding Source from a network server at no charge.
268
+
269
+ c) Convey individual copies of the object code with a copy of the
270
+ written offer to provide the Corresponding Source. This
271
+ alternative is allowed only occasionally and noncommercially, and
272
+ only if you received the object code with such an offer, in accord
273
+ with subsection 6b.
274
+
275
+ d) Convey the object code by offering access from a designated
276
+ place (gratis or for a charge), and offer equivalent access to the
277
+ Corresponding Source in the same way through the same place at no
278
+ further charge. You need not require recipients to copy the
279
+ Corresponding Source along with the object code. If the place to
280
+ copy the object code is a network server, the Corresponding Source
281
+ may be on a different server (operated by you or a third party)
282
+ that supports equivalent copying facilities, provided you maintain
283
+ clear directions next to the object code saying where to find the
284
+ Corresponding Source. Regardless of what server hosts the
285
+ Corresponding Source, you remain obligated to ensure that it is
286
+ available for as long as needed to satisfy these requirements.
287
+
288
+ e) Convey the object code using peer-to-peer transmission, provided
289
+ you inform other peers where the object code and Corresponding
290
+ Source of the work are being offered to the general public at no
291
+ charge under subsection 6d.
292
+
293
+ A separable portion of the object code, whose source code is excluded
294
+ from the Corresponding Source as a System Library, need not be
295
+ included in conveying the object code work.
296
+
297
+ A "User Product" is either (1) a "consumer product", which means any
298
+ tangible personal property which is normally used for personal, family,
299
+ or household purposes, or (2) anything designed or sold for incorporation
300
+ into a dwelling. In determining whether a product is a consumer product,
301
+ doubtful cases shall be resolved in favor of coverage. For a particular
302
+ product received by a particular user, "normally used" refers to a
303
+ typical or common use of that class of product, regardless of the status
304
+ of the particular user or of the way in which the particular user
305
+ actually uses, or expects or is expected to use, the product. A product
306
+ is a consumer product regardless of whether the product has substantial
307
+ commercial, industrial or non-consumer uses, unless such uses represent
308
+ the only significant mode of use of the product.
309
+
310
+ "Installation Information" for a User Product means any methods,
311
+ procedures, authorization keys, or other information required to install
312
+ and execute modified versions of a covered work in that User Product from
313
+ a modified version of its Corresponding Source. The information must
314
+ suffice to ensure that the continued functioning of the modified object
315
+ code is in no case prevented or interfered with solely because
316
+ modification has been made.
317
+
318
+ If you convey an object code work under this section in, or with, or
319
+ specifically for use in, a User Product, and the conveying occurs as
320
+ part of a transaction in which the right of possession and use of the
321
+ User Product is transferred to the recipient in perpetuity or for a
322
+ fixed term (regardless of how the transaction is characterized), the
323
+ Corresponding Source conveyed under this section must be accompanied
324
+ by the Installation Information. But this requirement does not apply
325
+ if neither you nor any third party retains the ability to install
326
+ modified object code on the User Product (for example, the work has
327
+ been installed in ROM).
328
+
329
+ The requirement to provide Installation Information does not include a
330
+ requirement to continue to provide support service, warranty, or updates
331
+ for a work that has been modified or installed by the recipient, or for
332
+ the User Product in which it has been modified or installed. Access to a
333
+ network may be denied when the modification itself materially and
334
+ adversely affects the operation of the network or violates the rules and
335
+ protocols for communication across the network.
336
+
337
+ Corresponding Source conveyed, and Installation Information provided,
338
+ in accord with this section must be in a format that is publicly
339
+ documented (and with an implementation available to the public in
340
+ source code form), and must require no special password or key for
341
+ unpacking, reading or copying.
342
+
343
+ 7. Additional Terms.
344
+
345
+ "Additional permissions" are terms that supplement the terms of this
346
+ License by making exceptions from one or more of its conditions.
347
+ Additional permissions that are applicable to the entire Program shall
348
+ be treated as though they were included in this License, to the extent
349
+ that they are valid under applicable law. If additional permissions
350
+ apply only to part of the Program, that part may be used separately
351
+ under those permissions, but the entire Program remains governed by
352
+ this License without regard to the additional permissions.
353
+
354
+ When you convey a copy of a covered work, you may at your option
355
+ remove any additional permissions from that copy, or from any part of
356
+ it. (Additional permissions may be written to require their own
357
+ removal in certain cases when you modify the work.) You may place
358
+ additional permissions on material, added by you to a covered work,
359
+ for which you have or can give appropriate copyright permission.
360
+
361
+ Notwithstanding any other provision of this License, for material you
362
+ add to a covered work, you may (if authorized by the copyright holders of
363
+ that material) supplement the terms of this License with terms:
364
+
365
+ a) Disclaiming warranty or limiting liability differently from the
366
+ terms of sections 15 and 16 of this License; or
367
+
368
+ b) Requiring preservation of specified reasonable legal notices or
369
+ author attributions in that material or in the Appropriate Legal
370
+ Notices displayed by works containing it; or
371
+
372
+ c) Prohibiting misrepresentation of the origin of that material, or
373
+ requiring that modified versions of such material be marked in
374
+ reasonable ways as different from the original version; or
375
+
376
+ d) Limiting the use for publicity purposes of names of licensors or
377
+ authors of the material; or
378
+
379
+ e) Declining to grant rights under trademark law for use of some
380
+ trade names, trademarks, or service marks; or
381
+
382
+ f) Requiring indemnification of licensors and authors of that
383
+ material by anyone who conveys the material (or modified versions of
384
+ it) with contractual assumptions of liability to the recipient, for
385
+ any liability that these contractual assumptions directly impose on
386
+ those licensors and authors.
387
+
388
+ All other non-permissive additional terms are considered "further
389
+ restrictions" within the meaning of section 10. If the Program as you
390
+ received it, or any part of it, contains a notice stating that it is
391
+ governed by this License along with a term that is a further
392
+ restriction, you may remove that term. If a license document contains
393
+ a further restriction but permits relicensing or conveying under this
394
+ License, you may add to a covered work material governed by the terms
395
+ of that license document, provided that the further restriction does
396
+ not survive such relicensing or conveying.
397
+
398
+ If you add terms to a covered work in accord with this section, you
399
+ must place, in the relevant source files, a statement of the
400
+ additional terms that apply to those files, or a notice indicating
401
+ where to find the applicable terms.
402
+
403
+ Additional terms, permissive or non-permissive, may be stated in the
404
+ form of a separately written license, or stated as exceptions;
405
+ the above requirements apply either way.
406
+
407
+ 8. Termination.
408
+
409
+ You may not propagate or modify a covered work except as expressly
410
+ provided under this License. Any attempt otherwise to propagate or
411
+ modify it is void, and will automatically terminate your rights under
412
+ this License (including any patent licenses granted under the third
413
+ paragraph of section 11).
414
+
415
+ However, if you cease all violation of this License, then your
416
+ license from a particular copyright holder is reinstated (a)
417
+ provisionally, unless and until the copyright holder explicitly and
418
+ finally terminates your license, and (b) permanently, if the copyright
419
+ holder fails to notify you of the violation by some reasonable means
420
+ prior to 60 days after the cessation.
421
+
422
+ Moreover, your license from a particular copyright holder is
423
+ reinstated permanently if the copyright holder notifies you of the
424
+ violation by some reasonable means, this is the first time you have
425
+ received notice of violation of this License (for any work) from that
426
+ copyright holder, and you cure the violation prior to 30 days after
427
+ your receipt of the notice.
428
+
429
+ Termination of your rights under this section does not terminate the
430
+ licenses of parties who have received copies or rights from you under
431
+ this License. If your rights have been terminated and not permanently
432
+ reinstated, you do not qualify to receive new licenses for the same
433
+ material under section 10.
434
+
435
+ 9. Acceptance Not Required for Having Copies.
436
+
437
+ You are not required to accept this License in order to receive or
438
+ run a copy of the Program. Ancillary propagation of a covered work
439
+ occurring solely as a consequence of using peer-to-peer transmission
440
+ to receive a copy likewise does not require acceptance. However,
441
+ nothing other than this License grants you permission to propagate or
442
+ modify any covered work. These actions infringe copyright if you do
443
+ not accept this License. Therefore, by modifying or propagating a
444
+ covered work, you indicate your acceptance of this License to do so.
445
+
446
+ 10. Automatic Licensing of Downstream Recipients.
447
+
448
+ Each time you convey a covered work, the recipient automatically
449
+ receives a license from the original licensors, to run, modify and
450
+ propagate that work, subject to this License. You are not responsible
451
+ for enforcing compliance by third parties with this License.
452
+
453
+ An "entity transaction" is a transaction transferring control of an
454
+ organization, or substantially all assets of one, or subdividing an
455
+ organization, or merging organizations. If propagation of a covered
456
+ work results from an entity transaction, each party to that
457
+ transaction who receives a copy of the work also receives whatever
458
+ licenses to the work the party's predecessor in interest had or could
459
+ give under the previous paragraph, plus a right to possession of the
460
+ Corresponding Source of the work from the predecessor in interest, if
461
+ the predecessor has it or can get it with reasonable efforts.
462
+
463
+ You may not impose any further restrictions on the exercise of the
464
+ rights granted or affirmed under this License. For example, you may
465
+ not impose a license fee, royalty, or other charge for exercise of
466
+ rights granted under this License, and you may not initiate litigation
467
+ (including a cross-claim or counterclaim in a lawsuit) alleging that
468
+ any patent claim is infringed by making, using, selling, offering for
469
+ sale, or importing the Program or any portion of it.
470
+
471
+ 11. Patents.
472
+
473
+ A "contributor" is a copyright holder who authorizes use under this
474
+ License of the Program or a work on which the Program is based. The
475
+ work thus licensed is called the contributor's "contributor version".
476
+
477
+ A contributor's "essential patent claims" are all patent claims
478
+ owned or controlled by the contributor, whether already acquired or
479
+ hereafter acquired, that would be infringed by some manner, permitted
480
+ by this License, of making, using, or selling its contributor version,
481
+ but do not include claims that would be infringed only as a
482
+ consequence of further modification of the contributor version. For
483
+ purposes of this definition, "control" includes the right to grant
484
+ patent sublicenses in a manner consistent with the requirements of
485
+ this License.
486
+
487
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
488
+ patent license under the contributor's essential patent claims, to
489
+ make, use, sell, offer for sale, import and otherwise run, modify and
490
+ propagate the contents of its contributor version.
491
+
492
+ In the following three paragraphs, a "patent license" is any express
493
+ agreement or commitment, however denominated, not to enforce a patent
494
+ (such as an express permission to practice a patent or covenant not to
495
+ sue for patent infringement). To "grant" such a patent license to a
496
+ party means to make such an agreement or commitment not to enforce a
497
+ patent against the party.
498
+
499
+ If you convey a covered work, knowingly relying on a patent license,
500
+ and the Corresponding Source of the work is not available for anyone
501
+ to copy, free of charge and under the terms of this License, through a
502
+ publicly available network server or other readily accessible means,
503
+ then you must either (1) cause the Corresponding Source to be so
504
+ available, or (2) arrange to deprive yourself of the benefit of the
505
+ patent license for this particular work, or (3) arrange, in a manner
506
+ consistent with the requirements of this License, to extend the patent
507
+ license to downstream recipients. "Knowingly relying" means you have
508
+ actual knowledge that, but for the patent license, your conveying the
509
+ covered work in a country, or your recipient's use of the covered work
510
+ in a country, would infringe one or more identifiable patents in that
511
+ country that you have reason to believe are valid.
512
+
513
+ If, pursuant to or in connection with a single transaction or
514
+ arrangement, you convey, or propagate by procuring conveyance of, a
515
+ covered work, and grant a patent license to some of the parties
516
+ receiving the covered work authorizing them to use, propagate, modify
517
+ or convey a specific copy of the covered work, then the patent license
518
+ you grant is automatically extended to all recipients of the covered
519
+ work and works based on it.
520
+
521
+ A patent license is "discriminatory" if it does not include within
522
+ the scope of its coverage, prohibits the exercise of, or is
523
+ conditioned on the non-exercise of one or more of the rights that are
524
+ specifically granted under this License. You may not convey a covered
525
+ work if you are a party to an arrangement with a third party that is
526
+ in the business of distributing software, under which you make payment
527
+ to the third party based on the extent of your activity of conveying
528
+ the work, and under which the third party grants, to any of the
529
+ parties who would receive the covered work from you, a discriminatory
530
+ patent license (a) in connection with copies of the covered work
531
+ conveyed by you (or copies made from those copies), or (b) primarily
532
+ for and in connection with specific products or compilations that
533
+ contain the covered work, unless you entered into that arrangement,
534
+ or that patent license was granted, prior to 28 March 2007.
535
+
536
+ Nothing in this License shall be construed as excluding or limiting
537
+ any implied license or other defenses to infringement that may
538
+ otherwise be available to you under applicable patent law.
539
+
540
+ 12. No Surrender of Others' Freedom.
541
+
542
+ If conditions are imposed on you (whether by court order, agreement or
543
+ otherwise) that contradict the conditions of this License, they do not
544
+ excuse you from the conditions of this License. If you cannot convey a
545
+ covered work so as to satisfy simultaneously your obligations under this
546
+ License and any other pertinent obligations, then as a consequence you may
547
+ not convey it at all. For example, if you agree to terms that obligate you
548
+ to collect a royalty for further conveying from those to whom you convey
549
+ the Program, the only way you could satisfy both those terms and this
550
+ License would be to refrain entirely from conveying the Program.
551
+
552
+ 13. Use with the GNU Affero General Public License.
553
+
554
+ Notwithstanding any other provision of this License, you have
555
+ permission to link or combine any covered work with a work licensed
556
+ under version 3 of the GNU Affero General Public License into a single
557
+ combined work, and to convey the resulting work. The terms of this
558
+ License will continue to apply to the part which is the covered work,
559
+ but the special requirements of the GNU Affero General Public License,
560
+ section 13, concerning interaction through a network will apply to the
561
+ combination as such.
562
+
563
+ 14. Revised Versions of this License.
564
+
565
+ The Free Software Foundation may publish revised and/or new versions of
566
+ the GNU General Public License from time to time. Such new versions will
567
+ be similar in spirit to the present version, but may differ in detail to
568
+ address new problems or concerns.
569
+
570
+ Each version is given a distinguishing version number. If the
571
+ Program specifies that a certain numbered version of the GNU General
572
+ Public License "or any later version" applies to it, you have the
573
+ option of following the terms and conditions either of that numbered
574
+ version or of any later version published by the Free Software
575
+ Foundation. If the Program does not specify a version number of the
576
+ GNU General Public License, you may choose any version ever published
577
+ by the Free Software Foundation.
578
+
579
+ If the Program specifies that a proxy can decide which future
580
+ versions of the GNU General Public License can be used, that proxy's
581
+ public statement of acceptance of a version permanently authorizes you
582
+ to choose that version for the Program.
583
+
584
+ Later license versions may give you additional or different
585
+ permissions. However, no additional obligations are imposed on any
586
+ author or copyright holder as a result of your choosing to follow a
587
+ later version.
588
+
589
+ 15. Disclaimer of Warranty.
590
+
591
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592
+ APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593
+ HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594
+ OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596
+ PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597
+ IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598
+ ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599
+
600
+ 16. Limitation of Liability.
601
+
602
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604
+ THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605
+ GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606
+ USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607
+ DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608
+ PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609
+ EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610
+ SUCH DAMAGES.
611
+
612
+ 17. Interpretation of Sections 15 and 16.
613
+
614
+ If the disclaimer of warranty and limitation of liability provided
615
+ above cannot be given local legal effect according to their terms,
616
+ reviewing courts shall apply local law that most closely approximates
617
+ an absolute waiver of all civil liability in connection with the
618
+ Program, unless a warranty or assumption of liability accompanies a
619
+ copy of the Program in return for a fee.
620
+
621
+ END OF TERMS AND CONDITIONS
622
+
623
+ How to Apply These Terms to Your New Programs
624
+
625
+ If you develop a new program, and you want it to be of the greatest
626
+ possible use to the public, the best way to achieve this is to make it
627
+ free software which everyone can redistribute and change under these terms.
628
+
629
+ To do so, attach the following notices to the program. It is safest
630
+ to attach them to the start of each source file to most effectively
631
+ state the exclusion of warranty; and each file should have at least
632
+ the "copyright" line and a pointer to where the full notice is found.
633
+
634
+ <one line to give the program's name and a brief idea of what it does.>
635
+ Copyright (C) <year> <name of author>
636
+
637
+ This program is free software: you can redistribute it and/or modify
638
+ it under the terms of the GNU General Public License as published by
639
+ the Free Software Foundation, either version 3 of the License, or
640
+ (at your option) any later version.
641
+
642
+ This program is distributed in the hope that it will be useful,
643
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
644
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645
+ GNU General Public License for more details.
646
+
647
+ You should have received a copy of the GNU General Public License
648
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
649
+
650
+ Also add information on how to contact you by electronic and paper mail.
651
+
652
+ If the program does terminal interaction, make it output a short
653
+ notice like this when it starts in an interactive mode:
654
+
655
+ <program> Copyright (C) <year> <name of author>
656
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657
+ This is free software, and you are welcome to redistribute it
658
+ under certain conditions; type `show c' for details.
659
+
660
+ The hypothetical commands `show w' and `show c' should show the appropriate
661
+ parts of the General Public License. Of course, your program's commands
662
+ might be different; for a GUI interface, you would use an "about box".
663
+
664
+ You should also get your employer (if you work as a programmer) or school,
665
+ if any, to sign a "copyright disclaimer" for the program, if necessary.
666
+ For more information on this, and how to apply and follow the GNU GPL, see
667
+ <https://www.gnu.org/licenses/>.
668
+
669
+ The GNU General Public License does not permit incorporating your program
670
+ into proprietary programs. If your program is a subroutine library, you
671
+ may consider it more useful to permit linking proprietary applications with
672
+ the library. If this is what you want to do, use the GNU Lesser General
673
+ Public License instead of this License. But first, please read
674
+ <https://www.gnu.org/licenses/why-not-lgpl.html>.
README.md CHANGED
@@ -1,5 +1,5 @@
1
  ---
2
- title: ImageGen - Z-Image
3
  emoji: 🖼
4
  colorFrom: purple
5
  colorTo: red
 
1
  ---
2
+ title: ImageGen3
3
  emoji: 🖼
4
  colorFrom: purple
5
  colorTo: red
app.py CHANGED
@@ -1,7 +1,6 @@
1
  import spaces
2
  import os
3
  import sys
4
- import requests
5
  import site
6
 
7
  APP_DIR = os.path.dirname(os.path.abspath(__file__))
@@ -45,11 +44,11 @@ def dummy_gpu_for_startup():
45
  print("--- [GPU Startup] Startup check passed. ---")
46
  return "Startup check passed."
47
 
 
48
  def main():
49
- from utils.app_utils import print_welcome_message
50
  from scripts import build_sage_attention
51
-
52
- print_welcome_message()
53
 
54
  print("--- [Setup] Attempting to build and install SageAttention... ---")
55
  try:
@@ -58,7 +57,9 @@ def main():
58
  except Exception as e:
59
  print(f"--- [Setup] ❌ SageAttention installation failed: {e}. Continuing with default attention. ---")
60
 
61
-
 
 
62
  print("--- [Setup] Reloading site-packages to detect newly installed packages... ---")
63
  try:
64
  site.main()
@@ -66,52 +67,18 @@ def main():
66
  except Exception as e:
67
  print(f"--- [Setup] ⚠️ Warning: Could not fully reload site-packages: {e} ---")
68
 
69
- from comfy_integration import setup as setup_comfyui
70
- from utils.app_utils import (
71
- build_preprocessor_model_map,
72
- build_preprocessor_parameter_map
73
- )
74
- from core import shared_state
75
- from core.settings import ALL_MODEL_MAP, ALL_FILE_DOWNLOAD_MAP
76
-
77
- def check_all_model_urls_on_startup():
78
- print("--- [Setup] Checking all model URL validity (one-time check) ---")
79
- for display_name, model_info in ALL_MODEL_MAP.items():
80
- _, components, _, _ = model_info
81
- if not components: continue
82
-
83
- for filename in components.values():
84
- download_info = ALL_FILE_DOWNLOAD_MAP.get(filename, {})
85
- repo_id = download_info.get('repo_id')
86
- if not repo_id: continue
87
-
88
- repo_file_path = download_info.get('repository_file_path', filename)
89
- url = f"https://huggingface.co/{repo_id}/resolve/main/{repo_file_path}"
90
-
91
- try:
92
- response = requests.head(url, timeout=5, allow_redirects=True)
93
- if response.status_code >= 400:
94
- print(f"❌ Invalid URL for '{display_name}' component '{filename}': {url} (Status: {response.status_code})")
95
- shared_state.INVALID_MODEL_URLS[display_name] = True
96
- break
97
- except requests.RequestException as e:
98
- print(f"❌ URL check failed for '{display_name}' component '{filename}': {e}")
99
- shared_state.INVALID_MODEL_URLS[display_name] = True
100
- break
101
- print("--- [Setup] ✅ Finished checking model URLs. ---")
102
 
103
  print("--- Starting Application Setup ---")
104
 
105
- setup_comfyui.initialize_comfyui()
 
 
106
 
107
- check_all_model_urls_on_startup()
108
-
109
- print("--- Building ControlNet preprocessor maps ---")
110
- from core.generation_logic import build_reverse_map
111
- build_reverse_map()
112
- build_preprocessor_model_map()
113
- build_preprocessor_parameter_map()
114
- print("--- ✅ ControlNet preprocessor setup complete. ---")
115
 
116
  print("--- Environment configured. Proceeding with module imports. ---")
117
  from ui.layout import build_ui
 
1
  import spaces
2
  import os
3
  import sys
 
4
  import site
5
 
6
  APP_DIR = os.path.dirname(os.path.abspath(__file__))
 
44
  print("--- [GPU Startup] Startup check passed. ---")
45
  return "Startup check passed."
46
 
47
+
48
  def main():
 
49
  from scripts import build_sage_attention
50
+ from comfy_integration import setup as setup_comfyui
51
+ from utils.app_utils import load_ipadapter_presets
52
 
53
  print("--- [Setup] Attempting to build and install SageAttention... ---")
54
  try:
 
57
  except Exception as e:
58
  print(f"--- [Setup] ❌ SageAttention installation failed: {e}. Continuing with default attention. ---")
59
 
60
+ print("--- [Setup] Starting ComfyUI initialization ---")
61
+ setup_comfyui.initialize_comfyui()
62
+
63
  print("--- [Setup] Reloading site-packages to detect newly installed packages... ---")
64
  try:
65
  site.main()
 
67
  except Exception as e:
68
  print(f"--- [Setup] ⚠️ Warning: Could not fully reload site-packages: {e} ---")
69
 
70
+ print("--- Initiating GPU Startup Check & SageAttention Patch ---")
71
+ try:
72
+ dummy_gpu_for_startup()
73
+ except Exception as e:
74
+ print(f"--- [GPU Startup] ⚠️ Warning: Startup check failed: {e} ---")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
 
76
  print("--- Starting Application Setup ---")
77
 
78
+ print("--- Loading IPAdapter presets ---")
79
+ load_ipadapter_presets()
80
+ print("--- ✅ IPAdapter setup complete. ---")
81
 
 
 
 
 
 
 
 
 
82
 
83
  print("--- Environment configured. Proceeding with module imports. ---")
84
  from ui.layout import build_ui
chain_injectors/anima_controlnet_lllite_injector.py ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ def inject(assembler, chain_definition, chain_items):
2
+ if not chain_items:
3
+ return
4
+
5
+ ksampler_name = chain_definition.get('ksampler_node', 'ksampler')
6
+ if ksampler_name not in assembler.node_map:
7
+ print(f"Warning: KSampler node '{ksampler_name}' not found for Anima LLLite chain. Skipping.")
8
+ return
9
+
10
+ ksampler_id = assembler.node_map[ksampler_name]
11
+
12
+ if 'model' not in assembler.workflow[ksampler_id]['inputs']:
13
+ print(f"Warning: KSampler node '{ksampler_name}' is missing 'model' input. Skipping.")
14
+ return
15
+
16
+ current_model_connection = assembler.workflow[ksampler_id]['inputs']['model']
17
+
18
+ for item_data in chain_items:
19
+ image_loader_id = assembler._get_unique_id()
20
+ image_loader_node = assembler._get_node_template("LoadImage")
21
+ image_loader_node['inputs']['image'] = item_data['image']
22
+ assembler.workflow[image_loader_id] = image_loader_node
23
+
24
+ image_scaler_id = assembler._get_unique_id()
25
+ image_scaler_node = assembler._get_node_template("ImageScaleToTotalPixels")
26
+ image_scaler_node['inputs']['image'] = [image_loader_id, 0]
27
+ image_scaler_node['inputs']['upscale_method'] = 'nearest-exact'
28
+ image_scaler_node['inputs']['megapixels'] = 1.0
29
+ assembler.workflow[image_scaler_id] = image_scaler_node
30
+
31
+ apply_cn_id = assembler._get_unique_id()
32
+ apply_cn_node = assembler._get_node_template("AnimaLLLiteApply")
33
+
34
+ apply_cn_node['inputs']['lllite_name'] = item_data['control_net_name']
35
+ apply_cn_node['inputs']['strength'] = item_data['strength']
36
+ apply_cn_node['inputs']['start_percent'] = item_data.get('start_percent', 0.0)
37
+ apply_cn_node['inputs']['end_percent'] = item_data.get('end_percent', 1.0)
38
+
39
+ apply_cn_node['inputs']['model'] = current_model_connection
40
+ apply_cn_node['inputs']['image'] = [image_scaler_id, 0]
41
+
42
+ assembler.workflow[apply_cn_id] = apply_cn_node
43
+
44
+ current_model_connection = [apply_cn_id, 0]
45
+
46
+ assembler.workflow[ksampler_id]['inputs']['model'] = current_model_connection
47
+
48
+ print(f"Anima LLLite injector applied. KSampler model input re-routed through {len(chain_items)} LLLite(s).")
chain_injectors/controlnet_injector.py CHANGED
@@ -13,6 +13,16 @@ def inject(assembler, chain_definition, chain_items):
13
  'negative' not in assembler.workflow[ksampler_id]['inputs']:
14
  print(f"Warning: KSampler node '{ksampler_name}' is missing 'positive' or 'negative' inputs. Skipping ControlNet chain.")
15
  return
 
 
 
 
 
 
 
 
 
 
16
 
17
  current_positive_connection = assembler.workflow[ksampler_id]['inputs']['positive']
18
  current_negative_connection = assembler.workflow[ksampler_id]['inputs']['negative']
@@ -37,6 +47,7 @@ def inject(assembler, chain_definition, chain_items):
37
  apply_cn_node['inputs']['negative'] = current_negative_connection
38
  apply_cn_node['inputs']['control_net'] = [cn_loader_id, 0]
39
  apply_cn_node['inputs']['image'] = [image_loader_id, 0]
 
40
 
41
  assembler.workflow[apply_cn_id] = apply_cn_node
42
 
 
13
  'negative' not in assembler.workflow[ksampler_id]['inputs']:
14
  print(f"Warning: KSampler node '{ksampler_name}' is missing 'positive' or 'negative' inputs. Skipping ControlNet chain.")
15
  return
16
+
17
+ vae_source_str = chain_definition.get('vae_source')
18
+ if not vae_source_str:
19
+ print("Warning: 'vae_source' definition missing in the recipe for the ControlNet chain. Skipping.")
20
+ return
21
+ vae_node_name, vae_idx_str = vae_source_str.split(':')
22
+ if vae_node_name not in assembler.node_map:
23
+ print(f"Warning: VAE source node '{vae_node_name}' for ControlNet chain not found. Skipping.")
24
+ return
25
+ vae_connection = [assembler.node_map[vae_node_name], int(vae_idx_str)]
26
 
27
  current_positive_connection = assembler.workflow[ksampler_id]['inputs']['positive']
28
  current_negative_connection = assembler.workflow[ksampler_id]['inputs']['negative']
 
47
  apply_cn_node['inputs']['negative'] = current_negative_connection
48
  apply_cn_node['inputs']['control_net'] = [cn_loader_id, 0]
49
  apply_cn_node['inputs']['image'] = [image_loader_id, 0]
50
+ apply_cn_node['inputs']['vae'] = vae_connection
51
 
52
  assembler.workflow[apply_cn_id] = apply_cn_node
53
 
chain_injectors/flux1_ipadapter_injector.py ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ def inject(assembler, chain_definition, chain_items):
2
+ if not chain_items:
3
+ return
4
+
5
+ ksampler_name = chain_definition.get('ksampler_node', 'ksampler')
6
+ if ksampler_name not in assembler.node_map:
7
+ print(f"Warning: KSampler node '{ksampler_name}' not found for Flux1 IPAdapter chain. Skipping.")
8
+ return
9
+
10
+ ksampler_id = assembler.node_map[ksampler_name]
11
+
12
+ if 'model' not in assembler.workflow[ksampler_id]['inputs']:
13
+ print(f"Warning: KSampler node '{ksampler_name}' is missing 'model' input. Skipping Flux1 IPAdapter chain.")
14
+ return
15
+
16
+ current_model_connection = assembler.workflow[ksampler_id]['inputs']['model']
17
+
18
+ for item_data in chain_items:
19
+ image_loader_id = assembler._get_unique_id()
20
+ image_loader_node = assembler._get_node_template("LoadImage")
21
+ image_loader_node['inputs']['image'] = item_data['image']
22
+ assembler.workflow[image_loader_id] = image_loader_node
23
+
24
+ ipadapter_loader_id = assembler._get_unique_id()
25
+ ipadapter_loader_node = assembler._get_node_template("IPAdapterFluxLoader")
26
+ ipadapter_loader_node['inputs']['ipadapter'] = "ip-adapter.bin"
27
+ ipadapter_loader_node['inputs']['clip_vision'] = "google/siglip-so400m-patch14-384"
28
+ ipadapter_loader_node['inputs']['provider'] = "cuda"
29
+ assembler.workflow[ipadapter_loader_id] = ipadapter_loader_node
30
+
31
+ apply_ipa_id = assembler._get_unique_id()
32
+ apply_ipa_node = assembler._get_node_template("ApplyIPAdapterFlux")
33
+
34
+ apply_ipa_node['inputs']['weight'] = item_data['weight']
35
+ apply_ipa_node['inputs']['start_percent'] = item_data.get('start_percent', 0.0)
36
+ apply_ipa_node['inputs']['end_percent'] = item_data.get('end_percent', 0.6)
37
+
38
+ apply_ipa_node['inputs']['model'] = current_model_connection
39
+ apply_ipa_node['inputs']['ipadapter_flux'] = [ipadapter_loader_id, 0]
40
+ apply_ipa_node['inputs']['image'] = [image_loader_id, 0]
41
+
42
+ assembler.workflow[apply_ipa_id] = apply_ipa_node
43
+ current_model_connection = [apply_ipa_id, 0]
44
+
45
+ assembler.workflow[ksampler_id]['inputs']['model'] = current_model_connection
46
+ print(f"Flux1 IPAdapter injector applied. KSampler model input re-routed through {len(chain_items)} IPAdapter(s).")
chain_injectors/ipadapter_injector.py ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ def inject(assembler, chain_definition, chain_items):
2
+ if not chain_items:
3
+ return
4
+
5
+ final_settings = {}
6
+ if chain_items and isinstance(chain_items[-1], dict) and chain_items[-1].get('is_final_settings'):
7
+ final_settings = chain_items.pop()
8
+
9
+ if not chain_items:
10
+ return
11
+
12
+ end_node_name = chain_definition.get('end')
13
+ if not end_node_name or end_node_name not in assembler.node_map:
14
+ print(f"Warning: Target node '{end_node_name}' for IPAdapter chain not found. Skipping chain injection.")
15
+ return
16
+
17
+ end_node_id = assembler.node_map[end_node_name]
18
+
19
+ if 'model' not in assembler.workflow[end_node_id]['inputs']:
20
+ print(f"Warning: Target node '{end_node_name}' is missing 'model' input. Skipping IPAdapter chain.")
21
+ return
22
+
23
+ current_model_connection = assembler.workflow[end_node_id]['inputs']['model']
24
+
25
+ model_type = final_settings.get('model_type', 'sdxl')
26
+ megapixels = 1.05 if model_type == 'sdxl' else 0.39
27
+
28
+ pos_embed_outputs = []
29
+ neg_embed_outputs = []
30
+
31
+ for i, item_data in enumerate(chain_items):
32
+ loader_type = 'FaceID' if 'FACEID' in item_data.get('preset', '') else 'Unified'
33
+
34
+ loader_template_name = "IPAdapterUnifiedLoader"
35
+ if loader_type == 'FaceID':
36
+ loader_template_name = "IPAdapterUnifiedLoaderFaceID"
37
+
38
+ image_loader_id = assembler._get_unique_id()
39
+ image_loader_node = assembler._get_node_template("LoadImage")
40
+ image_loader_node['inputs']['image'] = item_data['image']
41
+ assembler.workflow[image_loader_id] = image_loader_node
42
+
43
+ image_scaler_id = assembler._get_unique_id()
44
+ image_scaler_node = assembler._get_node_template("ImageScaleToTotalPixels")
45
+ image_scaler_node['inputs']['image'] = [image_loader_id, 0]
46
+ image_scaler_node['inputs']['megapixels'] = megapixels
47
+ image_scaler_node['inputs']['upscale_method'] = "lanczos"
48
+ assembler.workflow[image_scaler_id] = image_scaler_node
49
+
50
+ ipadapter_loader_id = assembler._get_unique_id()
51
+ ipadapter_loader_node = assembler._get_node_template(loader_template_name)
52
+ ipadapter_loader_node['inputs']['model'] = current_model_connection
53
+ ipadapter_loader_node['inputs']['preset'] = item_data['preset']
54
+ if loader_type == 'FaceID':
55
+ ipadapter_loader_node['inputs']['lora_strength'] = item_data.get('lora_strength', 0.6)
56
+ assembler.workflow[ipadapter_loader_id] = ipadapter_loader_node
57
+
58
+ encoder_id = assembler._get_unique_id()
59
+ encoder_node = assembler._get_node_template("IPAdapterEncoder")
60
+ encoder_node['inputs']['weight'] = item_data['weight']
61
+ encoder_node['inputs']['ipadapter'] = [ipadapter_loader_id, 1]
62
+ encoder_node['inputs']['image'] = [image_scaler_id, 0]
63
+ assembler.workflow[encoder_id] = encoder_node
64
+
65
+ pos_embed_outputs.append([encoder_id, 0])
66
+ neg_embed_outputs.append([encoder_id, 1])
67
+
68
+ pos_combiner_id = assembler._get_unique_id()
69
+ pos_combiner_node = assembler._get_node_template("IPAdapterCombineEmbeds")
70
+ pos_combiner_node['inputs']['method'] = final_settings.get('final_combine_method', 'concat')
71
+ for i, conn in enumerate(pos_embed_outputs):
72
+ pos_combiner_node['inputs'][f'embed{i+1}'] = conn
73
+ assembler.workflow[pos_combiner_id] = pos_combiner_node
74
+
75
+ neg_combiner_id = assembler._get_unique_id()
76
+ neg_combiner_node = assembler._get_node_template("IPAdapterCombineEmbeds")
77
+ neg_combiner_node['inputs']['method'] = final_settings.get('final_combine_method', 'concat')
78
+ for i, conn in enumerate(neg_embed_outputs):
79
+ neg_combiner_node['inputs'][f'embed{i+1}'] = conn
80
+ assembler.workflow[neg_combiner_id] = neg_combiner_node
81
+
82
+ final_loader_type = 'FaceID' if 'FACEID' in final_settings.get('final_preset', '') else 'Unified'
83
+ final_loader_template_name = "IPAdapterUnifiedLoader"
84
+ if final_loader_type == 'FaceID':
85
+ final_loader_template_name = "IPAdapterUnifiedLoaderFaceID"
86
+
87
+ final_loader_id = assembler._get_unique_id()
88
+ final_loader_node = assembler._get_node_template(final_loader_template_name)
89
+ final_loader_node['inputs']['model'] = current_model_connection
90
+ final_loader_node['inputs']['preset'] = final_settings.get('final_preset', 'STANDARD (medium strength)')
91
+ if final_loader_type == 'FaceID':
92
+ final_loader_node['inputs']['lora_strength'] = final_settings.get('final_lora_strength', 0.6)
93
+ assembler.workflow[final_loader_id] = final_loader_node
94
+
95
+ apply_embeds_id = assembler._get_unique_id()
96
+ apply_embeds_node = assembler._get_node_template("IPAdapterEmbeds")
97
+ apply_embeds_node['inputs']['weight'] = final_settings.get('final_weight', 1.0)
98
+ apply_embeds_node['inputs']['embeds_scaling'] = final_settings.get('final_embeds_scaling', 'V only')
99
+ apply_embeds_node['inputs']['model'] = [final_loader_id, 0]
100
+ apply_embeds_node['inputs']['ipadapter'] = [final_loader_id, 1]
101
+ apply_embeds_node['inputs']['pos_embed'] = [pos_combiner_id, 0]
102
+ apply_embeds_node['inputs']['neg_embed'] = [neg_combiner_id, 0]
103
+ assembler.workflow[apply_embeds_id] = apply_embeds_node
104
+
105
+ assembler.workflow[end_node_id]['inputs']['model'] = [apply_embeds_id, 0]
106
+ print(f"IPAdapter injector applied. Redirected '{end_node_name}' model input through {len(chain_items)} reference images.")
chain_injectors/newbie_lora_injector.py ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from copy import deepcopy
2
+
3
+ def inject(assembler, chain_definition, chain_items):
4
+ if not chain_items:
5
+ return
6
+
7
+ output_map = chain_definition.get('output_map', {})
8
+ current_connections = {}
9
+ for key, type_name in output_map.items():
10
+ if ':' in str(key):
11
+ node_name, idx_str = key.split(':')
12
+ if node_name not in assembler.node_map:
13
+ print(f"Warning: [NewBie LoRA Injector] Node '{node_name}' in chain's output_map not found. Skipping.")
14
+ continue
15
+ node_id = assembler.node_map[node_name]
16
+ start_output_idx = int(idx_str)
17
+ current_connections[type_name] = [node_id, start_output_idx]
18
+ else:
19
+ print(f"Warning: [NewBie LoRA Injector] output_map key '{key}' is not in 'node:index' format. Skipping this connection.")
20
+
21
+ template_name = chain_definition.get('template')
22
+ if not template_name:
23
+ print(f"Warning: [NewBie LoRA Injector] No 'template' defined for chain. Skipping.")
24
+ return
25
+
26
+ for item_data in chain_items:
27
+ template = assembler._get_node_template(template_name)
28
+ node_data = deepcopy(template)
29
+
30
+ node_data['inputs']['lora_name'] = item_data.get('lora_name')
31
+ node_data['inputs']['strength'] = item_data.get('strength_model', 1.0)
32
+ node_data['inputs']['enabled'] = True
33
+
34
+ if 'model' in current_connections:
35
+ node_data['inputs']['model'] = current_connections['model']
36
+ if 'clip' in current_connections:
37
+ node_data['inputs']['clip'] = current_connections['clip']
38
+
39
+ new_node_id = assembler._get_unique_id()
40
+ assembler.workflow[new_node_id] = node_data
41
+
42
+ current_connections['model'] = [new_node_id, 0]
43
+ current_connections['clip'] = [new_node_id, 1]
44
+
45
+ end_input_map = chain_definition.get('end_input_map', {})
46
+ for type_name, targets in end_input_map.items():
47
+ if type_name in current_connections:
48
+ if not isinstance(targets, list):
49
+ targets = [targets]
50
+
51
+ for target_str in targets:
52
+ try:
53
+ end_node_name, end_input_name = target_str.split(':')
54
+ if end_node_name in assembler.node_map:
55
+ end_node_id = assembler.node_map[end_node_name]
56
+ assembler.workflow[end_node_id]['inputs'][end_input_name] = current_connections[type_name]
57
+ else:
58
+ print(f"Warning: [NewBie LoRA Injector] End node '{end_node_name}' for dynamic chain not found. Skipping connection.")
59
+ except ValueError:
60
+ print(f"Warning: [NewBie LoRA Injector] Invalid target format '{target_str}' in end_input_map. Skipping.")
61
+
62
+ if chain_items:
63
+ print(f"NewBie LoRA injector applied. Re-routed model and clip through {len(chain_items)} LoRA(s).")
chain_injectors/reference_latent_injector.py ADDED
@@ -0,0 +1,157 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ def inject(assembler, chain_definition, chain_items):
2
+ if not chain_items:
3
+ return
4
+
5
+ guider_node_name = chain_definition.get('guider_node')
6
+ guider_target_inputs = chain_definition.get('guider_target_inputs', [])
7
+ start_connections_map = chain_definition.get('start_connections', {})
8
+ vae_node_name = chain_definition.get('vae_node', 'vae_loader')
9
+
10
+ if guider_node_name and guider_node_name in assembler.node_map and guider_target_inputs:
11
+ guider_id = assembler.node_map[guider_node_name]
12
+ if vae_node_name not in assembler.node_map:
13
+ print(f"Warning: VAE node '{vae_node_name}' not found for Guider chain. Skipping.")
14
+ return
15
+ vae_node_id = assembler.node_map[vae_node_name]
16
+
17
+ print(f"ReferenceLatent injector targeting DualCFGGuider node '{guider_node_name}'.")
18
+
19
+ current_connections = {}
20
+ for target_input in guider_target_inputs:
21
+ conn_str = start_connections_map.get(target_input)
22
+ if not conn_str:
23
+ print(f"Warning: No start connection defined for '{target_input}' in Guider chain. Skipping this input.")
24
+ continue
25
+ try:
26
+ node_name, idx_str = conn_str.split(':')
27
+ node_id = assembler.node_map[node_name]
28
+ current_connections[target_input] = [node_id, int(idx_str)]
29
+ except (ValueError, KeyError):
30
+ print(f"Warning: Invalid start connection '{conn_str}' for '{target_input}'. Skipping.")
31
+
32
+ encoded_latents = []
33
+ for i, img_filename in enumerate(chain_items):
34
+ load_id = assembler._get_unique_id()
35
+ load_node = assembler._get_node_template("LoadImage")
36
+ load_node['inputs']['image'] = img_filename
37
+ assembler.workflow[load_id] = load_node
38
+
39
+ scale_id = assembler._get_unique_id()
40
+ scale_node = assembler._get_node_template("ImageScaleToTotalPixels")
41
+ scale_node['inputs']['megapixels'] = 1.0
42
+ scale_node['inputs']['upscale_method'] = "lanczos"
43
+ scale_node['inputs']['image'] = [load_id, 0]
44
+ assembler.workflow[scale_id] = scale_node
45
+
46
+ vae_encode_id = assembler._get_unique_id()
47
+ vae_encode_node = assembler._get_node_template("VAEEncode")
48
+ vae_encode_node['inputs']['pixels'] = [scale_id, 0]
49
+ vae_encode_node['inputs']['vae'] = [vae_node_id, 0]
50
+ assembler.workflow[vae_encode_id] = vae_encode_node
51
+ encoded_latents.append([vae_encode_id, 0])
52
+
53
+ for target_input_name, start_connection in current_connections.items():
54
+ current_chain_head = start_connection
55
+ for i, latent_conn in enumerate(encoded_latents):
56
+ ref_latent_id = assembler._get_unique_id()
57
+ ref_latent_node = assembler._get_node_template("ReferenceLatent")
58
+ ref_latent_node['inputs']['conditioning'] = current_chain_head
59
+ ref_latent_node['inputs']['latent'] = latent_conn
60
+ ref_latent_node['_meta']['title'] = f"{target_input_name} RefLatent {i+1}"
61
+ assembler.workflow[ref_latent_id] = ref_latent_node
62
+ current_chain_head = [ref_latent_id, 0]
63
+
64
+ assembler.workflow[guider_id]['inputs'][target_input_name] = current_chain_head
65
+ print(f" - Input '{target_input_name}' of node '{guider_node_name}' re-routed through {len(chain_items)} reference images.")
66
+
67
+ return
68
+
69
+ flux_guidance_name = chain_definition.get('flux_guidance_node')
70
+ ksampler_name = chain_definition.get('ksampler_node', 'ksampler')
71
+
72
+ if ksampler_name not in assembler.node_map:
73
+ print(f"Warning: KSampler node '{ksampler_name}' not found for ReferenceLatent chain. Skipping.")
74
+ return
75
+ if vae_node_name not in assembler.node_map:
76
+ print(f"Warning: VAE loader node '{vae_node_name}' not found for ReferenceLatent chain. Skipping.")
77
+ return
78
+
79
+ ksampler_id = assembler.node_map[ksampler_name]
80
+ vae_node_id = assembler.node_map[vae_node_name]
81
+
82
+ pos_target_node_id = None
83
+ pos_target_input_name = None
84
+ if flux_guidance_name and flux_guidance_name in assembler.node_map:
85
+ flux_guidance_id = assembler.node_map[flux_guidance_name]
86
+ if 'conditioning' in assembler.workflow[flux_guidance_id]['inputs']:
87
+ pos_target_node_id = flux_guidance_id
88
+ pos_target_input_name = 'conditioning'
89
+ print(f"ReferenceLatent injector targeting FluxGuidance node '{flux_guidance_name}' for positive chain.")
90
+
91
+ if not pos_target_node_id:
92
+ if 'positive' in assembler.workflow[ksampler_id]['inputs']:
93
+ pos_target_node_id = ksampler_id
94
+ pos_target_input_name = 'positive'
95
+ print(f"ReferenceLatent injector targeting KSampler node '{ksampler_name}' for positive chain.")
96
+ else:
97
+ print(f"Warning: Could not find a valid positive injection point for ReferenceLatent chain. Skipping.")
98
+ return
99
+
100
+ current_pos_conditioning = assembler.workflow[pos_target_node_id]['inputs'][pos_target_input_name]
101
+
102
+ neg_target_node_id = ksampler_id
103
+ neg_target_input_name = 'negative'
104
+ if 'negative' not in assembler.workflow[neg_target_node_id]['inputs']:
105
+ print(f"Warning: KSampler node '{ksampler_name}' has no 'negative' input. Skipping negative ReferenceLatent chain.")
106
+ neg_target_node_id = None
107
+
108
+ current_neg_conditioning = None
109
+ if neg_target_node_id:
110
+ current_neg_conditioning = assembler.workflow[neg_target_node_id]['inputs'][neg_target_input_name]
111
+
112
+ for i, img_filename in enumerate(chain_items):
113
+ load_id = assembler._get_unique_id()
114
+ load_node = assembler._get_node_template("LoadImage")
115
+ load_node['inputs']['image'] = img_filename
116
+ load_node['_meta']['title'] = f"Load Reference Image {i+1}"
117
+ assembler.workflow[load_id] = load_node
118
+
119
+ scale_id = assembler._get_unique_id()
120
+ scale_node = assembler._get_node_template("ImageScaleToTotalPixels")
121
+ scale_node['inputs']['megapixels'] = 1.0
122
+ scale_node['inputs']['upscale_method'] = "lanczos"
123
+ scale_node['inputs']['image'] = [load_id, 0]
124
+ scale_node['_meta']['title'] = f"Scale Reference {i+1}"
125
+ assembler.workflow[scale_id] = scale_node
126
+
127
+ vae_encode_id = assembler._get_unique_id()
128
+ vae_encode_node = assembler._get_node_template("VAEEncode")
129
+ vae_encode_node['inputs']['pixels'] = [scale_id, 0]
130
+ vae_encode_node['inputs']['vae'] = [vae_node_id, 0]
131
+ vae_encode_node['_meta']['title'] = f"VAE Encode Reference {i+1}"
132
+ assembler.workflow[vae_encode_id] = vae_encode_node
133
+
134
+ latent_conn = [vae_encode_id, 0]
135
+
136
+ pos_ref_latent_id = assembler._get_unique_id()
137
+ pos_ref_latent_node = assembler._get_node_template("ReferenceLatent")
138
+ pos_ref_latent_node['inputs']['conditioning'] = current_pos_conditioning
139
+ pos_ref_latent_node['inputs']['latent'] = latent_conn
140
+ pos_ref_latent_node['_meta']['title'] = f"Positive ReferenceLatent {i+1}"
141
+ assembler.workflow[pos_ref_latent_id] = pos_ref_latent_node
142
+ current_pos_conditioning = [pos_ref_latent_id, 0]
143
+
144
+ if neg_target_node_id:
145
+ neg_ref_latent_id = assembler._get_unique_id()
146
+ neg_ref_latent_node = assembler._get_node_template("ReferenceLatent")
147
+ neg_ref_latent_node['inputs']['conditioning'] = current_neg_conditioning
148
+ neg_ref_latent_node['inputs']['latent'] = latent_conn
149
+ neg_ref_latent_node['_meta']['title'] = f"Negative ReferenceLatent {i+1}"
150
+ assembler.workflow[neg_ref_latent_id] = neg_ref_latent_node
151
+ current_neg_conditioning = [neg_ref_latent_id, 0]
152
+
153
+ assembler.workflow[pos_target_node_id]['inputs'][pos_target_input_name] = current_pos_conditioning
154
+ if neg_target_node_id:
155
+ assembler.workflow[neg_target_node_id]['inputs'][neg_target_input_name] = current_neg_conditioning
156
+
157
+ print(f"ReferenceLatent injector applied. Re-routed inputs through {len(chain_items)} reference images.")
chain_injectors/sd3_ipadapter_injector.py ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ def inject(assembler, chain_definition, chain_items):
2
+ if not chain_items:
3
+ return
4
+
5
+ ksampler_name = chain_definition.get('ksampler_node', 'ksampler')
6
+ if ksampler_name not in assembler.node_map:
7
+ print(f"Warning: KSampler node '{ksampler_name}' not found for SD3 IPAdapter chain. Skipping.")
8
+ return
9
+
10
+ ksampler_id = assembler.node_map[ksampler_name]
11
+
12
+ if 'model' not in assembler.workflow[ksampler_id]['inputs']:
13
+ print(f"Warning: KSampler node '{ksampler_name}' is missing 'model' input. Skipping SD3 IPAdapter chain.")
14
+ return
15
+
16
+ current_model_connection = assembler.workflow[ksampler_id]['inputs']['model']
17
+
18
+ clip_vision_loader_id = assembler._get_unique_id()
19
+ clip_vision_loader_node = assembler._get_node_template("CLIPVisionLoader")
20
+ clip_vision_loader_node['inputs']['clip_name'] = "sigclip_vision_patch14_384.safetensors"
21
+ assembler.workflow[clip_vision_loader_id] = clip_vision_loader_node
22
+
23
+ ipadapter_loader_id = assembler._get_unique_id()
24
+ ipadapter_loader_node = assembler._get_node_template("IPAdapterSD3Loader")
25
+ ipadapter_loader_node['inputs']['ipadapter'] = "ip-adapter_sd35l_instantx.bin"
26
+ ipadapter_loader_node['inputs']['provider'] = "cuda"
27
+ assembler.workflow[ipadapter_loader_id] = ipadapter_loader_node
28
+
29
+ for item_data in chain_items:
30
+ image_loader_id = assembler._get_unique_id()
31
+ image_loader_node = assembler._get_node_template("LoadImage")
32
+ image_loader_node['inputs']['image'] = item_data['image']
33
+ assembler.workflow[image_loader_id] = image_loader_node
34
+
35
+ image_scaler_id = assembler._get_unique_id()
36
+ image_scaler_node = assembler._get_node_template("ImageScaleToTotalPixels")
37
+ image_scaler_node['inputs']['image'] = [image_loader_id, 0]
38
+ image_scaler_node['inputs']['upscale_method'] = 'nearest-exact'
39
+ image_scaler_node['inputs']['megapixels'] = 1.0
40
+ assembler.workflow[image_scaler_id] = image_scaler_node
41
+
42
+ clip_vision_encode_id = assembler._get_unique_id()
43
+ clip_vision_encode_node = assembler._get_node_template("CLIPVisionEncode")
44
+ clip_vision_encode_node['inputs']['crop'] = "center"
45
+ clip_vision_encode_node['inputs']['clip_vision'] = [clip_vision_loader_id, 0]
46
+ clip_vision_encode_node['inputs']['image'] = [image_scaler_id, 0]
47
+ assembler.workflow[clip_vision_encode_id] = clip_vision_encode_node
48
+
49
+ apply_ipa_id = assembler._get_unique_id()
50
+ apply_ipa_node = assembler._get_node_template("ApplyIPAdapterSD3")
51
+
52
+ apply_ipa_node['inputs']['weight'] = item_data.get('weight', 1.0)
53
+ apply_ipa_node['inputs']['start_percent'] = item_data.get('start_percent', 0.0)
54
+ apply_ipa_node['inputs']['end_percent'] = item_data.get('end_percent', 1.0)
55
+
56
+ apply_ipa_node['inputs']['model'] = current_model_connection
57
+ apply_ipa_node['inputs']['ipadapter'] = [ipadapter_loader_id, 0]
58
+ apply_ipa_node['inputs']['image_embed'] = [clip_vision_encode_id, 0]
59
+
60
+ assembler.workflow[apply_ipa_id] = apply_ipa_node
61
+
62
+ current_model_connection = [apply_ipa_id, 0]
63
+
64
+ assembler.workflow[ksampler_id]['inputs']['model'] = current_model_connection
65
+
66
+ print(f"SD3 IPAdapter injector applied. KSampler model input re-routed through {len(chain_items)} IPAdapter(s).")
chain_injectors/style_injector.py ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ def inject(assembler, chain_definition, chain_items):
2
+ if not chain_items:
3
+ return
4
+
5
+ flux_guidance_name = chain_definition.get('flux_guidance_node')
6
+ ksampler_name = chain_definition.get('ksampler_node', 'ksampler')
7
+
8
+ target_node_id = None
9
+ target_input_name = None
10
+
11
+ if flux_guidance_name and flux_guidance_name in assembler.node_map:
12
+ flux_guidance_id = assembler.node_map[flux_guidance_name]
13
+ if 'conditioning' in assembler.workflow[flux_guidance_id]['inputs']:
14
+ target_node_id = flux_guidance_id
15
+ target_input_name = 'conditioning'
16
+
17
+ if not target_node_id:
18
+ if ksampler_name in assembler.node_map:
19
+ ksampler_id = assembler.node_map[ksampler_name]
20
+ if 'positive' in assembler.workflow[ksampler_id]['inputs']:
21
+ target_node_id = ksampler_id
22
+ target_input_name = 'positive'
23
+ else:
24
+ return
25
+
26
+ if not target_node_id:
27
+ return
28
+
29
+ current_conditioning = assembler.workflow[target_node_id]['inputs'][target_input_name]
30
+
31
+ style_model_loader_id = assembler._get_unique_id()
32
+ style_model_loader_node = assembler._get_node_template("StyleModelLoader")
33
+ style_model_loader_node['inputs']['style_model_name'] = "flux1-redux-dev.safetensors"
34
+ assembler.workflow[style_model_loader_id] = style_model_loader_node
35
+
36
+ clip_vision_loader_id = assembler._get_unique_id()
37
+ clip_vision_loader_node = assembler._get_node_template("CLIPVisionLoader")
38
+ clip_vision_loader_node['inputs']['clip_name'] = "sigclip_vision_patch14_384.safetensors"
39
+ assembler.workflow[clip_vision_loader_id] = clip_vision_loader_node
40
+
41
+ for item_data in chain_items:
42
+ image = item_data.get('image')
43
+ strength = item_data.get('strength', 1.0)
44
+ if not image or strength is None:
45
+ continue
46
+
47
+ load_image_id = assembler._get_unique_id()
48
+ clip_vision_encode_id = assembler._get_unique_id()
49
+ style_apply_id = assembler._get_unique_id()
50
+
51
+ load_image_node = assembler._get_node_template("LoadImage")
52
+ clip_vision_encode_node = assembler._get_node_template("CLIPVisionEncode")
53
+ style_apply_node = assembler._get_node_template("StyleModelApply")
54
+
55
+ load_image_node['inputs']['image'] = image
56
+ clip_vision_encode_node['inputs']['crop'] = "center"
57
+ clip_vision_encode_node['inputs']['clip_vision'] = [clip_vision_loader_id, 0]
58
+ clip_vision_encode_node['inputs']['image'] = [load_image_id, 0]
59
+
60
+ style_apply_node['inputs']['strength'] = strength
61
+ style_apply_node['inputs']['strength_type'] = "multiply"
62
+ style_apply_node['inputs']['conditioning'] = current_conditioning
63
+ style_apply_node['inputs']['style_model'] = [style_model_loader_id, 0]
64
+ style_apply_node['inputs']['clip_vision_output'] = [clip_vision_encode_id, 0]
65
+
66
+ assembler.workflow[load_image_id] = load_image_node
67
+ assembler.workflow[clip_vision_encode_id] = clip_vision_encode_node
68
+ assembler.workflow[style_apply_id] = style_apply_node
69
+ current_conditioning = [style_apply_id, 0]
70
+
71
+ assembler.workflow[target_node_id]['inputs'][target_input_name] = current_conditioning
chain_injectors/vae_injector.py ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ def inject(assembler, chain_definition, chain_items):
2
+ if not chain_items:
3
+ return
4
+
5
+ vae_name = chain_items[0] if isinstance(chain_items, list) else chain_items
6
+ if not vae_name or vae_name == "None":
7
+ return
8
+
9
+ targets = chain_definition.get('targets', [])
10
+ if not targets:
11
+ return
12
+
13
+ vae_loader_id = assembler._get_unique_id()
14
+ vae_loader_node = assembler._get_node_template("VAELoader")
15
+ vae_loader_node['inputs']['vae_name'] = vae_name
16
+ assembler.workflow[vae_loader_id] = vae_loader_node
17
+
18
+ injected_count = 0
19
+ for target_str in targets:
20
+ try:
21
+ node_name, input_name = target_str.split(':')
22
+ if node_name in assembler.node_map:
23
+ node_id = assembler.node_map[node_name]
24
+ assembler.workflow[node_id]['inputs'][input_name] = [vae_loader_id, 0]
25
+ injected_count += 1
26
+ except ValueError:
27
+ print(f"Warning: Invalid VAE injector target format '{target_str}'. Expected 'node_name:input_name'.")
28
+
29
+ if injected_count > 0:
30
+ print(f"VAE injector applied. Rerouted {injected_count} connection(s) to new VAELoader ({vae_name}).")
comfy_integration/nodes.py CHANGED
@@ -23,6 +23,11 @@ CLIPTextEncodeSDXL = NODE_CLASS_MAPPINGS['CLIPTextEncodeSDXL']
23
  LoraLoader = NODE_CLASS_MAPPINGS['LoraLoader']
24
  CLIPSetLastLayer = NODE_CLASS_MAPPINGS['CLIPSetLastLayer']
25
 
 
 
 
 
 
26
  try:
27
  KSamplerNode = NODE_CLASS_MAPPINGS['KSampler']
28
  SAMPLER_CHOICES = KSamplerNode.INPUT_TYPES()["required"]["sampler_name"][0]
 
23
  LoraLoader = NODE_CLASS_MAPPINGS['LoraLoader']
24
  CLIPSetLastLayer = NODE_CLASS_MAPPINGS['CLIPSetLastLayer']
25
 
26
+ if 'EmptyHunyuanImageLatent' in NODE_CLASS_MAPPINGS:
27
+ EmptyHunyuanImageLatent = NODE_CLASS_MAPPINGS['EmptyHunyuanImageLatent']
28
+ else:
29
+ print("⚠️ Warning: 'EmptyHunyuanImageLatent' not found in NODE_CLASS_MAPPINGS. HunyuanImage txt2img may fail if this node is required.")
30
+
31
  try:
32
  KSamplerNode = NODE_CLASS_MAPPINGS['KSampler']
33
  SAMPLER_CHOICES = KSamplerNode.INPUT_TYPES()["required"]["sampler_name"][0]
comfy_integration/setup.py CHANGED
@@ -39,14 +39,48 @@ def initialize_comfyui():
39
  except OSError as e:
40
  print(f"⚠️ Could not remove temporary directory '{COMFYUI_TEMP_DIR}': {e}")
41
 
 
42
  print("--- Cloning third-party extensions for ComfyUI ---")
43
- controlnet_aux_path = os.path.join(APP_DIR, "custom_nodes", "comfyui_controlnet_aux")
44
- if not os.path.exists(controlnet_aux_path):
45
- os.system(f"git clone https://github.com/Fannovel16/comfyui_controlnet_aux.git {controlnet_aux_path}")
46
- print("✅ comfyui_controlnet_aux extension cloned.")
 
 
 
 
 
 
 
 
 
 
47
  else:
48
- print("✅ comfyui_controlnet_aux extension already exists.")
49
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
 
51
  print(f"✅ Current working directory is: {os.getcwd()}")
52
 
@@ -55,13 +89,10 @@ def initialize_comfyui():
55
 
56
  print("✅ ComfyUI initialized with default attention mechanism.")
57
 
58
- os.makedirs(os.path.join(APP_DIR, CHECKPOINT_DIR), exist_ok=True)
59
- os.makedirs(os.path.join(APP_DIR, LORA_DIR), exist_ok=True)
60
- os.makedirs(os.path.join(APP_DIR, EMBEDDING_DIR), exist_ok=True)
61
- os.makedirs(os.path.join(APP_DIR, CONTROLNET_DIR), exist_ok=True)
62
- os.makedirs(os.path.join(APP_DIR, MODEL_PATCHES_DIR), exist_ok=True)
63
- os.makedirs(os.path.join(APP_DIR, DIFFUSION_MODELS_DIR), exist_ok=True)
64
- os.makedirs(os.path.join(APP_DIR, VAE_DIR), exist_ok=True)
65
- os.makedirs(os.path.join(APP_DIR, TEXT_ENCODERS_DIR), exist_ok=True)
66
  os.makedirs(os.path.join(APP_DIR, INPUT_DIR), exist_ok=True)
 
 
67
  print("✅ All required model directories are present.")
 
39
  except OSError as e:
40
  print(f"⚠️ Could not remove temporary directory '{COMFYUI_TEMP_DIR}': {e}")
41
 
42
+
43
  print("--- Cloning third-party extensions for ComfyUI ---")
44
+
45
+ # 1. ComfyUI_IPAdapter_plus
46
+ ipadapter_plus_path = os.path.join(APP_DIR, "custom_nodes", "ComfyUI_IPAdapter_plus")
47
+ if not os.path.exists(ipadapter_plus_path):
48
+ os.system(f"git clone https://github.com/cubiq/ComfyUI_IPAdapter_plus.git {ipadapter_plus_path}")
49
+ print("✅ ComfyUI_IPAdapter_plus extension cloned.")
50
+ else:
51
+ print("✅ ComfyUI_IPAdapter_plus extension already exists.")
52
+
53
+ # 2. ComfyUI-InstantX-IPAdapter-SD3
54
+ ipadapter_plus_path = os.path.join(APP_DIR, "custom_nodes", "ComfyUI-InstantX-IPAdapter-SD3")
55
+ if not os.path.exists(ipadapter_plus_path):
56
+ os.system(f"git clone https://github.com/Slickytail/ComfyUI-InstantX-IPAdapter-SD3.git {ipadapter_plus_path}")
57
+ print("✅ ComfyUI-InstantX-IPAdapter-SD3 extension cloned.")
58
  else:
59
+ print("✅ ComfyUI-InstantX-IPAdapter-SD3 extension already exists.")
60
 
61
+ # 3. ComfyUI-IPAdapter-Flux
62
+ ipadapter_flux_path = os.path.join(APP_DIR, "custom_nodes", "ComfyUI-IPAdapter-Flux")
63
+ if not os.path.exists(ipadapter_flux_path):
64
+ os.system(f"git clone https://github.com/Shakker-Labs/ComfyUI-IPAdapter-Flux.git {ipadapter_flux_path}")
65
+ print("✅ ComfyUI-IPAdapter-Flux extension cloned.")
66
+ else:
67
+ print("✅ ComfyUI-IPAdapter-Flux extension already exists.")
68
+
69
+ # 4. ComfyUI-Newbie-Nodes
70
+ newbie_nodes_path = os.path.join(APP_DIR, "custom_nodes", "ComfyUI-Newbie-Nodes")
71
+ if not os.path.exists(newbie_nodes_path):
72
+ os.system(f"git clone https://github.com/NewBieAI-Lab/ComfyUI-Newbie-Nodes.git {newbie_nodes_path}")
73
+ print("✅ ComfyUI-Newbie-Nodes extension cloned.")
74
+ else:
75
+ print("✅ ComfyUI-Newbie-Nodes extension already exists.")
76
+
77
+ # 5. ComfyUI-Anima-LLLite
78
+ anima_controlnet_lllite_nodes_path = os.path.join(APP_DIR, "custom_nodes", "ComfyUI-Anima-LLLite")
79
+ if not os.path.exists(anima_controlnet_lllite_nodes_path):
80
+ os.system(f"git clone https://github.com/kohya-ss/ComfyUI-Anima-LLLite.git {anima_controlnet_lllite_nodes_path}")
81
+ print("✅ ComfyUI-Anima-LLLite extension cloned.")
82
+ else:
83
+ print("✅ ComfyUI-Anima-LLLite extension already exists.")
84
 
85
  print(f"✅ Current working directory is: {os.getcwd()}")
86
 
 
89
 
90
  print("✅ ComfyUI initialized with default attention mechanism.")
91
 
92
+ for dir_path in CATEGORY_TO_DIR_MAP.values():
93
+ os.makedirs(os.path.join(APP_DIR, dir_path), exist_ok=True)
94
+
 
 
 
 
 
95
  os.makedirs(os.path.join(APP_DIR, INPUT_DIR), exist_ok=True)
96
+ os.makedirs(os.path.join(APP_DIR, OUTPUT_DIR), exist_ok=True)
97
+
98
  print("✅ All required model directories are present.")
core/generation_logic.py CHANGED
@@ -1,25 +1,10 @@
1
  from typing import Any, Dict
2
  import gradio as gr
3
 
4
- from core.pipelines.controlnet_preprocessor import ControlNetPreprocessorPipeline
5
  from core.pipelines.sd_image_pipeline import SdImagePipeline
6
 
7
- controlnet_preprocessor_pipeline = ControlNetPreprocessorPipeline()
8
  sd_image_pipeline = SdImagePipeline()
9
 
10
 
11
- def build_reverse_map():
12
- from nodes import NODE_DISPLAY_NAME_MAPPINGS
13
- import core.pipelines.controlnet_preprocessor as cn_module
14
-
15
- if cn_module.REVERSE_DISPLAY_NAME_MAP is None:
16
- cn_module.REVERSE_DISPLAY_NAME_MAP = {v: k for k, v in NODE_DISPLAY_NAME_MAPPINGS.items()}
17
- if "Semantic Segmentor (legacy, alias for UniFormer)" not in cn_module.REVERSE_DISPLAY_NAME_MAP:
18
- cn_module.REVERSE_DISPLAY_NAME_MAP["Semantic Segmentor (legacy, alias for UniFormer)"] = "SemSegPreprocessor"
19
-
20
-
21
- def run_cn_preprocessor_entry(*args, **kwargs):
22
- return controlnet_preprocessor_pipeline.run(*args, **kwargs)
23
-
24
  def generate_image_wrapper(ui_inputs: dict, progress=gr.Progress(track_tqdm=True)):
25
  return sd_image_pipeline.run(ui_inputs=ui_inputs, progress=progress)
 
1
  from typing import Any, Dict
2
  import gradio as gr
3
 
 
4
  from core.pipelines.sd_image_pipeline import SdImagePipeline
5
 
 
6
  sd_image_pipeline = SdImagePipeline()
7
 
8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  def generate_image_wrapper(ui_inputs: dict, progress=gr.Progress(track_tqdm=True)):
10
  return sd_image_pipeline.run(ui_inputs=ui_inputs, progress=progress)
core/model_manager.py CHANGED
@@ -1,11 +1,8 @@
1
  import gc
2
  from typing import List
3
-
4
  import gradio as gr
5
-
6
- from core.settings import ALL_MODEL_MAP
7
  from utils.app_utils import _ensure_model_downloaded
8
-
9
 
10
  class ModelManager:
11
  _instance = None
@@ -23,26 +20,13 @@ class ModelManager:
23
 
24
  def ensure_models_downloaded(self, required_models: List[str], progress):
25
  print(f"--- [ModelManager] Ensuring models are downloaded: {required_models} ---")
26
-
27
- files_to_download = set()
28
- for display_name in required_models:
29
- if display_name in ALL_MODEL_MAP:
30
- _, components, _, _ = ALL_MODEL_MAP[display_name]
31
- for component_key, component_file in components.items():
32
- if component_key in ['unet', 'clip', 'vae', 'lora']:
33
- files_to_download.add(component_file)
34
-
35
- files_to_download = list(files_to_download)
36
- total_files = len(files_to_download)
37
-
38
- for i, filename in enumerate(files_to_download):
39
  if progress and hasattr(progress, '__call__'):
40
- progress(i / total_files, desc=f"Checking file: {filename}")
41
  try:
42
- _ensure_model_downloaded(filename, progress)
43
  except Exception as e:
44
- raise gr.Error(f"Failed to download model component '{filename}'. Reason: {e}")
45
-
46
  print(f"--- [ModelManager] ✅ All required models are present on disk. ---")
47
 
48
  model_manager = ModelManager()
 
1
  import gc
2
  from typing import List
 
3
  import gradio as gr
 
 
4
  from utils.app_utils import _ensure_model_downloaded
5
+ from core.settings import ALL_MODEL_MAP
6
 
7
  class ModelManager:
8
  _instance = None
 
20
 
21
  def ensure_models_downloaded(self, required_models: List[str], progress):
22
  print(f"--- [ModelManager] Ensuring models are downloaded: {required_models} ---")
23
+ for i, display_name in enumerate(required_models):
 
 
 
 
 
 
 
 
 
 
 
 
24
  if progress and hasattr(progress, '__call__'):
25
+ progress(i / max(len(required_models), 1), desc=f"Checking file: {display_name}")
26
  try:
27
+ _ensure_model_downloaded(display_name, progress)
28
  except Exception as e:
29
+ raise gr.Error(f"Failed to download model '{display_name}'. Reason: {e}")
 
30
  print(f"--- [ModelManager] ✅ All required models are present on disk. ---")
31
 
32
  model_manager = ModelManager()
core/pipelines/sd_image_pipeline.py CHANGED
@@ -11,12 +11,20 @@ import numpy as np
11
  from .base_pipeline import BasePipeline
12
  from core.settings import *
13
  from comfy_integration.nodes import *
14
- from utils.app_utils import get_value_at_index, sanitize_prompt, get_lora_path, get_embedding_path, ensure_controlnet_model_downloaded, sanitize_filename
15
  from core.workflow_assembler import WorkflowAssembler
16
 
17
  class SdImagePipeline(BasePipeline):
18
  def get_required_models(self, model_display_name: str, **kwargs) -> List[str]:
19
- return [model_display_name]
 
 
 
 
 
 
 
 
20
 
21
  def _topological_sort(self, workflow: Dict[str, Any]) -> List[str]:
22
  graph = defaultdict(list)
@@ -47,7 +55,6 @@ class SdImagePipeline(BasePipeline):
47
 
48
  return sorted_nodes
49
 
50
-
51
  def _execute_workflow(self, workflow: Dict[str, Any], initial_objects: Dict[str, Any]):
52
  with torch.no_grad():
53
  computed_outputs = initial_objects
@@ -113,13 +120,13 @@ class SdImagePipeline(BasePipeline):
113
 
114
  return get_value_at_index(computed_outputs[image_source_node_id], image_source_index)
115
 
116
- def _gpu_logic(self, ui_inputs: Dict, loras_string: str, required_models_for_gpu: List[str], workflow: Dict[str, Any], assembler: WorkflowAssembler, progress=gr.Progress(track_tqdm=True)):
117
  model_display_name = ui_inputs['model_display_name']
118
 
119
  progress(0.4, desc="Executing workflow...")
120
 
121
  initial_objects = {}
122
-
123
  decoded_images_tensor = self._execute_workflow(workflow, initial_objects=initial_objects)
124
 
125
  output_images = []
@@ -135,6 +142,7 @@ class SdImagePipeline(BasePipeline):
135
  params_string = f"{ui_inputs['positive_prompt']}\nNegative prompt: {ui_inputs['negative_prompt']}\n"
136
  params_string += f"Steps: {ui_inputs['num_inference_steps']}, Sampler: {ui_inputs['sampler']}, Scheduler: {ui_inputs['scheduler']}, CFG scale: {ui_inputs['guidance_scale']}, Seed: {current_seed}, Size: {width_for_meta}x{height_for_meta}, Base Model: {model_display_name}"
137
  if ui_inputs['task_type'] != 'txt2img': params_string += f", Denoise: {ui_inputs['denoise']}"
 
138
  if loras_string: params_string += f", {loras_string}"
139
 
140
  pil_image.info = {'parameters': params_string.strip()}
@@ -146,51 +154,58 @@ class SdImagePipeline(BasePipeline):
146
  progress(0, desc="Preparing models...")
147
 
148
  task_type = ui_inputs['task_type']
 
 
 
 
 
149
 
150
  ui_inputs['positive_prompt'] = sanitize_prompt(ui_inputs.get('positive_prompt', ''))
151
  ui_inputs['negative_prompt'] = sanitize_prompt(ui_inputs.get('negative_prompt', ''))
152
 
153
- required_models = self.get_required_models(model_display_name=ui_inputs['model_display_name'])
154
-
 
 
 
 
155
  self.model_manager.ensure_models_downloaded(required_models, progress=progress)
156
 
157
  lora_data = ui_inputs.get('lora_data', [])
158
  active_loras_for_gpu, active_loras_for_meta = [], []
159
-
160
  if lora_data:
161
  sources, ids, scales, files = lora_data[0::4], lora_data[1::4], lora_data[2::4], lora_data[3::4]
162
-
163
  for i, (source, lora_id, scale, _) in enumerate(zip(sources, ids, scales, files)):
164
  if scale > 0 and lora_id and lora_id.strip():
165
  lora_filename = None
166
  if source == "File":
167
  lora_filename = sanitize_filename(lora_id)
168
  elif source == "Civitai":
169
- local_path, status = get_lora_path(source, lora_id, ui_inputs['civitai_api_key'], progress)
170
  if local_path: lora_filename = os.path.basename(local_path)
171
  else: raise gr.Error(f"Failed to prepare LoRA {lora_id}: {status}")
172
 
173
  if lora_filename:
174
  active_loras_for_gpu.append({"lora_name": lora_filename, "strength_model": scale, "strength_clip": scale})
175
  active_loras_for_meta.append(f"{source} {lora_id}:{scale}")
176
-
177
  ui_inputs['denoise'] = 1.0
178
  if task_type == 'img2img': ui_inputs['denoise'] = ui_inputs.get('img2img_denoise', 0.7)
179
  elif task_type == 'hires_fix': ui_inputs['denoise'] = ui_inputs.get('hires_denoise', 0.55)
180
 
181
  temp_files_to_clean = []
182
-
183
  if not os.path.exists(INPUT_DIR): os.makedirs(INPUT_DIR)
184
 
185
  if task_type == 'img2img':
186
  input_image_pil = ui_inputs.get('img2img_image')
187
- if input_image_pil:
188
- temp_file_path = os.path.join(INPUT_DIR, f"temp_input_{random.randint(1000, 9999)}.png")
189
- input_image_pil.save(temp_file_path, "PNG")
190
- ui_inputs['input_image'] = os.path.basename(temp_file_path)
191
- temp_files_to_clean.append(temp_file_path)
192
- ui_inputs['width'] = input_image_pil.width
193
- ui_inputs['height'] = input_image_pil.height
 
194
 
195
  elif task_type == 'inpaint':
196
  inpaint_dict = ui_inputs.get('inpaint_image_dict')
@@ -198,7 +213,6 @@ class SdImagePipeline(BasePipeline):
198
  raise gr.Error("Inpainting requires an input image and a drawn mask.")
199
 
200
  background_img = inpaint_dict['background'].convert("RGBA")
201
-
202
  composite_mask_pil = Image.new('L', background_img.size, 0)
203
  for layer in inpaint_dict['layers']:
204
  if layer:
@@ -212,25 +226,30 @@ class SdImagePipeline(BasePipeline):
212
  temp_file_path = os.path.join(INPUT_DIR, f"temp_inpaint_composite_{random.randint(1000, 9999)}.png")
213
  composite_image_with_mask.save(temp_file_path, "PNG")
214
 
215
- ui_inputs['inpaint_image'] = os.path.basename(temp_file_path)
216
  temp_files_to_clean.append(temp_file_path)
217
  ui_inputs.pop('inpaint_mask', None)
218
 
219
  elif task_type == 'outpaint':
220
  input_image_pil = ui_inputs.get('outpaint_image')
221
- if input_image_pil:
222
- temp_file_path = os.path.join(INPUT_DIR, f"temp_input_{random.randint(1000, 9999)}.png")
223
- input_image_pil.save(temp_file_path, "PNG")
224
- ui_inputs['input_image'] = os.path.basename(temp_file_path)
225
- temp_files_to_clean.append(temp_file_path)
 
 
 
 
226
 
227
  elif task_type == 'hires_fix':
228
  input_image_pil = ui_inputs.get('hires_image')
229
- if input_image_pil:
230
- temp_file_path = os.path.join(INPUT_DIR, f"temp_input_{random.randint(1000, 9999)}.png")
231
- input_image_pil.save(temp_file_path, "PNG")
232
- ui_inputs['input_image'] = os.path.basename(temp_file_path)
233
- temp_files_to_clean.append(temp_file_path)
 
234
 
235
  embedding_data = ui_inputs.get('embedding_data', [])
236
  embedding_filenames = []
@@ -242,7 +261,7 @@ class SdImagePipeline(BasePipeline):
242
  if source == "File":
243
  emb_filename = sanitize_filename(emb_id)
244
  elif source == "Civitai":
245
- local_path, status = get_embedding_path(source, emb_id, ui_inputs['civitai_api_key'], progress)
246
  if local_path: emb_filename = os.path.basename(local_path)
247
  else: raise gr.Error(f"Failed to prepare Embedding {emb_id}: {status}")
248
 
@@ -263,7 +282,6 @@ class SdImagePipeline(BasePipeline):
263
  for i in range(len(cn_images)):
264
  if cn_images[i] and cn_strengths[i] > 0 and cn_filepaths[i] and cn_filepaths[i] != "None":
265
  ensure_controlnet_model_downloaded(cn_filepaths[i], progress)
266
-
267
  if not os.path.exists(INPUT_DIR): os.makedirs(INPUT_DIR)
268
  cn_temp_path = os.path.join(INPUT_DIR, f"temp_cn_{i}_{random.randint(1000, 9999)}.png")
269
  cn_images[i].save(cn_temp_path, "PNG")
@@ -273,6 +291,23 @@ class SdImagePipeline(BasePipeline):
273
  "start_percent": 0.0, "end_percent": 1.0, "control_net_name": cn_filepaths[i]
274
  })
275
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
276
  diffsynth_controlnet_data = ui_inputs.get('diffsynth_controlnet_data', [])
277
  active_diffsynth_controlnets = []
278
  if diffsynth_controlnet_data:
@@ -289,21 +324,130 @@ class SdImagePipeline(BasePipeline):
289
  "image": os.path.basename(cn_temp_path), "strength": cn_strengths[i],
290
  "control_net_name": cn_filepaths[i]
291
  })
292
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
293
  from utils.app_utils import get_vae_path
294
  vae_source = ui_inputs.get('vae_source')
295
  vae_id = ui_inputs.get('vae_id')
296
- vae_file = ui_inputs.get('vae_file')
297
  vae_name_override = None
298
-
299
  if vae_source and vae_source != "None":
300
  if vae_source == "File":
301
  vae_name_override = sanitize_filename(vae_id)
302
  elif vae_source == "Civitai" and vae_id and vae_id.strip():
303
- local_path, status = get_vae_path(vae_source, vae_id, ui_inputs.get('civitai_api_key'), progress)
304
  if local_path: vae_name_override = os.path.basename(local_path)
305
  else: raise gr.Error(f"Failed to prepare VAE {vae_id}: {status}")
306
-
307
  if vae_name_override:
308
  ui_inputs['vae_name'] = vae_name_override
309
 
@@ -311,22 +455,12 @@ class SdImagePipeline(BasePipeline):
311
  active_conditioning = []
312
  if conditioning_data:
313
  num_units = len(conditioning_data) // 6
314
- prompts = conditioning_data[0*num_units : 1*num_units]
315
- widths = conditioning_data[1*num_units : 2*num_units]
316
- heights = conditioning_data[2*num_units : 3*num_units]
317
- xs = conditioning_data[3*num_units : 4*num_units]
318
- ys = conditioning_data[4*num_units : 5*num_units]
319
- strengths = conditioning_data[5*num_units : 6*num_units]
320
-
321
  for i in range(num_units):
322
  if prompts[i] and prompts[i].strip():
323
  active_conditioning.append({
324
- "prompt": prompts[i],
325
- "width": int(widths[i]),
326
- "height": int(heights[i]),
327
- "x": int(xs[i]),
328
- "y": int(ys[i]),
329
- "strength": float(strengths[i])
330
  })
331
 
332
  loras_string = f"LoRAs: [{', '.join(active_loras_for_meta)}]" if active_loras_for_meta else ""
@@ -335,45 +469,71 @@ class SdImagePipeline(BasePipeline):
335
 
336
  if ui_inputs.get('seed') == -1:
337
  ui_inputs['seed'] = random.randint(0, 2**32 - 1)
338
-
339
- dynamic_values = {'task_type': ui_inputs['task_type']}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
340
 
341
  recipe_path = os.path.join(os.path.dirname(__file__), "workflow_recipes", "sd_unified_recipe.yaml")
342
  assembler = WorkflowAssembler(recipe_path, dynamic_values=dynamic_values)
343
 
344
- model_display_name = ui_inputs['model_display_name']
345
- if model_display_name not in ALL_MODEL_MAP:
346
- raise gr.Error(f"Model '{model_display_name}' is not configured in model_list.yaml.")
347
-
348
- _, components, _, _ = ALL_MODEL_MAP[model_display_name]
349
-
350
  workflow_inputs = {
 
351
  "positive_prompt": ui_inputs['positive_prompt'], "negative_prompt": ui_inputs['negative_prompt'],
352
  "seed": ui_inputs['seed'], "steps": ui_inputs['num_inference_steps'], "cfg": ui_inputs['guidance_scale'],
353
  "sampler_name": ui_inputs['sampler'], "scheduler": ui_inputs['scheduler'],
354
  "batch_size": ui_inputs['batch_size'],
355
- "denoise": ui_inputs['denoise'],
356
- "input_image": ui_inputs.get('input_image'),
357
- "inpaint_image": ui_inputs.get('inpaint_image'),
358
- "inpaint_mask": ui_inputs.get('inpaint_mask'),
359
- "left": ui_inputs.get('outpaint_left'), "top": ui_inputs.get('outpaint_top'),
360
- "right": ui_inputs.get('outpaint_right'), "bottom": ui_inputs.get('outpaint_bottom'),
361
- "hires_upscaler": ui_inputs.get('hires_upscaler'), "hires_scale_by": ui_inputs.get('hires_scale_by'),
362
- "unet_name": components['unet'],
363
- "clip_name": components['clip'],
364
- "vae_name": ui_inputs.get('vae_name', components['vae']),
365
  "lora_chain": active_loras_for_gpu,
366
- "controlnet_chain": active_controlnets,
 
367
  "diffsynth_controlnet_chain": active_diffsynth_controlnets,
 
 
 
 
368
  "conditioning_chain": active_conditioning,
 
 
369
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
370
 
371
  if task_type == 'txt2img':
372
  workflow_inputs['width'] = ui_inputs['width']
373
  workflow_inputs['height'] = ui_inputs['height']
374
 
375
  workflow = assembler.assemble(workflow_inputs)
376
-
377
  progress(1.0, desc="All models ready. Requesting GPU for generation...")
378
 
379
  try:
@@ -384,7 +544,6 @@ class SdImagePipeline(BasePipeline):
384
  task_name=f"ImageGen ({task_type})",
385
  ui_inputs=ui_inputs,
386
  loras_string=loras_string,
387
- required_models_for_gpu=required_models,
388
  workflow=workflow,
389
  assembler=assembler,
390
  progress=progress
 
11
  from .base_pipeline import BasePipeline
12
  from core.settings import *
13
  from comfy_integration.nodes import *
14
+ from utils.app_utils import get_value_at_index, sanitize_prompt, get_lora_path, get_embedding_path, ensure_controlnet_model_downloaded, ensure_ipadapter_models_downloaded, sanitize_filename
15
  from core.workflow_assembler import WorkflowAssembler
16
 
17
  class SdImagePipeline(BasePipeline):
18
  def get_required_models(self, model_display_name: str, **kwargs) -> List[str]:
19
+ model_info = ALL_MODEL_MAP.get(model_display_name)
20
+ if not model_info:
21
+ return [model_display_name]
22
+
23
+ path_or_components = model_info[1]
24
+ if isinstance(path_or_components, dict):
25
+ return [v for v in path_or_components.values() if v and v != "pixel_space"]
26
+ else:
27
+ return [model_display_name]
28
 
29
  def _topological_sort(self, workflow: Dict[str, Any]) -> List[str]:
30
  graph = defaultdict(list)
 
55
 
56
  return sorted_nodes
57
 
 
58
  def _execute_workflow(self, workflow: Dict[str, Any], initial_objects: Dict[str, Any]):
59
  with torch.no_grad():
60
  computed_outputs = initial_objects
 
120
 
121
  return get_value_at_index(computed_outputs[image_source_node_id], image_source_index)
122
 
123
+ def _gpu_logic(self, ui_inputs: Dict, loras_string: str, workflow: Dict[str, Any], assembler: WorkflowAssembler, progress=gr.Progress(track_tqdm=True)):
124
  model_display_name = ui_inputs['model_display_name']
125
 
126
  progress(0.4, desc="Executing workflow...")
127
 
128
  initial_objects = {}
129
+
130
  decoded_images_tensor = self._execute_workflow(workflow, initial_objects=initial_objects)
131
 
132
  output_images = []
 
142
  params_string = f"{ui_inputs['positive_prompt']}\nNegative prompt: {ui_inputs['negative_prompt']}\n"
143
  params_string += f"Steps: {ui_inputs['num_inference_steps']}, Sampler: {ui_inputs['sampler']}, Scheduler: {ui_inputs['scheduler']}, CFG scale: {ui_inputs['guidance_scale']}, Seed: {current_seed}, Size: {width_for_meta}x{height_for_meta}, Base Model: {model_display_name}"
144
  if ui_inputs['task_type'] != 'txt2img': params_string += f", Denoise: {ui_inputs['denoise']}"
145
+ if ui_inputs.get('clip_skip') and ui_inputs['clip_skip'] != 1: params_string += f", Clip skip: {abs(ui_inputs['clip_skip'])}"
146
  if loras_string: params_string += f", {loras_string}"
147
 
148
  pil_image.info = {'parameters': params_string.strip()}
 
154
  progress(0, desc="Preparing models...")
155
 
156
  task_type = ui_inputs['task_type']
157
+ model_display_name = ui_inputs['model_display_name']
158
+ model_type = MODEL_TYPE_MAP.get(model_display_name, 'sdxl')
159
+
160
+ architectures_dict = ARCHITECTURES_CONFIG.get('architectures', {})
161
+ workflow_model_type = architectures_dict.get(model_type, {}).get("model_type", "sdxl")
162
 
163
  ui_inputs['positive_prompt'] = sanitize_prompt(ui_inputs.get('positive_prompt', ''))
164
  ui_inputs['negative_prompt'] = sanitize_prompt(ui_inputs.get('negative_prompt', ''))
165
 
166
+ if 'clip_skip' in ui_inputs and ui_inputs['clip_skip'] is not None:
167
+ ui_inputs['clip_skip'] = -int(ui_inputs['clip_skip'])
168
+ else:
169
+ ui_inputs['clip_skip'] = -1
170
+
171
+ required_models = self.get_required_models(model_display_name=model_display_name)
172
  self.model_manager.ensure_models_downloaded(required_models, progress=progress)
173
 
174
  lora_data = ui_inputs.get('lora_data', [])
175
  active_loras_for_gpu, active_loras_for_meta = [], []
 
176
  if lora_data:
177
  sources, ids, scales, files = lora_data[0::4], lora_data[1::4], lora_data[2::4], lora_data[3::4]
 
178
  for i, (source, lora_id, scale, _) in enumerate(zip(sources, ids, scales, files)):
179
  if scale > 0 and lora_id and lora_id.strip():
180
  lora_filename = None
181
  if source == "File":
182
  lora_filename = sanitize_filename(lora_id)
183
  elif source == "Civitai":
184
+ local_path, status = get_lora_path(source, lora_id, os.environ.get("CIVITAI_API_KEY", ""), progress)
185
  if local_path: lora_filename = os.path.basename(local_path)
186
  else: raise gr.Error(f"Failed to prepare LoRA {lora_id}: {status}")
187
 
188
  if lora_filename:
189
  active_loras_for_gpu.append({"lora_name": lora_filename, "strength_model": scale, "strength_clip": scale})
190
  active_loras_for_meta.append(f"{source} {lora_id}:{scale}")
191
+
192
  ui_inputs['denoise'] = 1.0
193
  if task_type == 'img2img': ui_inputs['denoise'] = ui_inputs.get('img2img_denoise', 0.7)
194
  elif task_type == 'hires_fix': ui_inputs['denoise'] = ui_inputs.get('hires_denoise', 0.55)
195
 
196
  temp_files_to_clean = []
 
197
  if not os.path.exists(INPUT_DIR): os.makedirs(INPUT_DIR)
198
 
199
  if task_type == 'img2img':
200
  input_image_pil = ui_inputs.get('img2img_image')
201
+ if not input_image_pil:
202
+ raise gr.Error("Please upload an image for Image-to-Image.")
203
+ temp_file_path = os.path.join(INPUT_DIR, f"temp_input_{random.randint(1000, 9999)}.png")
204
+ input_image_pil.save(temp_file_path, "PNG")
205
+ ui_inputs['input_image'] = os.path.basename(temp_file_path)
206
+ temp_files_to_clean.append(temp_file_path)
207
+ ui_inputs['width'] = input_image_pil.width
208
+ ui_inputs['height'] = input_image_pil.height
209
 
210
  elif task_type == 'inpaint':
211
  inpaint_dict = ui_inputs.get('inpaint_image_dict')
 
213
  raise gr.Error("Inpainting requires an input image and a drawn mask.")
214
 
215
  background_img = inpaint_dict['background'].convert("RGBA")
 
216
  composite_mask_pil = Image.new('L', background_img.size, 0)
217
  for layer in inpaint_dict['layers']:
218
  if layer:
 
226
  temp_file_path = os.path.join(INPUT_DIR, f"temp_inpaint_composite_{random.randint(1000, 9999)}.png")
227
  composite_image_with_mask.save(temp_file_path, "PNG")
228
 
229
+ ui_inputs['input_image'] = os.path.basename(temp_file_path)
230
  temp_files_to_clean.append(temp_file_path)
231
  ui_inputs.pop('inpaint_mask', None)
232
 
233
  elif task_type == 'outpaint':
234
  input_image_pil = ui_inputs.get('outpaint_image')
235
+ if not input_image_pil:
236
+ raise gr.Error("Please upload an image for Outpainting.")
237
+ temp_file_path = os.path.join(INPUT_DIR, f"temp_input_{random.randint(1000, 9999)}.png")
238
+ input_image_pil.save(temp_file_path, "PNG")
239
+ ui_inputs['input_image'] = os.path.basename(temp_file_path)
240
+ temp_files_to_clean.append(temp_file_path)
241
+
242
+ ui_inputs['megapixels'] = 0.25
243
+ ui_inputs['grow_mask_by'] = ui_inputs.get('feathering', 10)
244
 
245
  elif task_type == 'hires_fix':
246
  input_image_pil = ui_inputs.get('hires_image')
247
+ if not input_image_pil:
248
+ raise gr.Error("Please upload an image for Hires Fix.")
249
+ temp_file_path = os.path.join(INPUT_DIR, f"temp_input_{random.randint(1000, 9999)}.png")
250
+ input_image_pil.save(temp_file_path, "PNG")
251
+ ui_inputs['input_image'] = os.path.basename(temp_file_path)
252
+ temp_files_to_clean.append(temp_file_path)
253
 
254
  embedding_data = ui_inputs.get('embedding_data', [])
255
  embedding_filenames = []
 
261
  if source == "File":
262
  emb_filename = sanitize_filename(emb_id)
263
  elif source == "Civitai":
264
+ local_path, status = get_embedding_path(source, emb_id, os.environ.get("CIVITAI_API_KEY", ""), progress)
265
  if local_path: emb_filename = os.path.basename(local_path)
266
  else: raise gr.Error(f"Failed to prepare Embedding {emb_id}: {status}")
267
 
 
282
  for i in range(len(cn_images)):
283
  if cn_images[i] and cn_strengths[i] > 0 and cn_filepaths[i] and cn_filepaths[i] != "None":
284
  ensure_controlnet_model_downloaded(cn_filepaths[i], progress)
 
285
  if not os.path.exists(INPUT_DIR): os.makedirs(INPUT_DIR)
286
  cn_temp_path = os.path.join(INPUT_DIR, f"temp_cn_{i}_{random.randint(1000, 9999)}.png")
287
  cn_images[i].save(cn_temp_path, "PNG")
 
291
  "start_percent": 0.0, "end_percent": 1.0, "control_net_name": cn_filepaths[i]
292
  })
293
 
294
+ anima_controlnet_lllite_data = ui_inputs.get('anima_controlnet_lllite_data', [])
295
+ active_anima_controlnets = []
296
+ if anima_controlnet_lllite_data:
297
+ (cn_images, _, _, cn_strengths, cn_filepaths, cn_starts, cn_ends) = [anima_controlnet_lllite_data[i::7] for i in range(7)]
298
+ for i in range(len(cn_images)):
299
+ if cn_images[i] and cn_strengths[i] > 0 and cn_filepaths[i] and cn_filepaths[i] != "None":
300
+ from utils.app_utils import _ensure_model_downloaded
301
+ _ensure_model_downloaded(cn_filepaths[i], progress)
302
+ if not os.path.exists(INPUT_DIR): os.makedirs(INPUT_DIR)
303
+ cn_temp_path = os.path.join(INPUT_DIR, f"temp_anima_cn_{i}_{random.randint(1000, 9999)}.png")
304
+ cn_images[i].save(cn_temp_path, "PNG")
305
+ temp_files_to_clean.append(cn_temp_path)
306
+ active_anima_controlnets.append({
307
+ "image": os.path.basename(cn_temp_path), "strength": cn_strengths[i],
308
+ "start_percent": cn_starts[i], "end_percent": cn_ends[i], "control_net_name": cn_filepaths[i]
309
+ })
310
+
311
  diffsynth_controlnet_data = ui_inputs.get('diffsynth_controlnet_data', [])
312
  active_diffsynth_controlnets = []
313
  if diffsynth_controlnet_data:
 
324
  "image": os.path.basename(cn_temp_path), "strength": cn_strengths[i],
325
  "control_net_name": cn_filepaths[i]
326
  })
327
+
328
+ ipadapter_data = ui_inputs.get('ipadapter_data', [])
329
+ active_ipadapters = []
330
+ if ipadapter_data:
331
+ num_ipa_units = (len(ipadapter_data) - 5) // 3
332
+ final_preset, final_weight, final_lora_strength, final_embeds_scaling, final_combine_method = ipadapter_data[-5:]
333
+ ipa_images, ipa_weights, ipa_lora_strengths = [ipadapter_data[i*num_ipa_units:(i+1)*num_ipa_units] for i in range(3)]
334
+ all_presets_to_download = set()
335
+ for i in range(num_ipa_units):
336
+ if ipa_images[i] and ipa_weights[i] > 0 and final_preset:
337
+ all_presets_to_download.add(final_preset)
338
+ if not os.path.exists(INPUT_DIR): os.makedirs(INPUT_DIR)
339
+ ipa_temp_path = os.path.join(INPUT_DIR, f"temp_ipa_{i}_{random.randint(1000, 9999)}.png")
340
+ ipa_images[i].save(ipa_temp_path, "PNG")
341
+ temp_files_to_clean.append(ipa_temp_path)
342
+ active_ipadapters.append({
343
+ "image": os.path.basename(ipa_temp_path), "preset": final_preset,
344
+ "weight": ipa_weights[i], "lora_strength": ipa_lora_strengths[i]
345
+ })
346
+ if active_ipadapters and final_preset:
347
+ all_presets_to_download.add(final_preset)
348
+ for preset in all_presets_to_download:
349
+ ensure_ipadapter_models_downloaded(preset, progress)
350
+
351
+ model_type_key = 'sd15' if workflow_model_type == 'sd15' else 'sdxl'
352
+ if active_ipadapters:
353
+ active_ipadapters.append({
354
+ 'is_final_settings': True, 'model_type': model_type_key, 'final_preset': final_preset,
355
+ 'final_weight': final_weight, 'final_lora_strength': final_lora_strength,
356
+ 'final_embeds_scaling': final_embeds_scaling, 'final_combine_method': final_combine_method
357
+ })
358
+
359
+ flux1_ipadapter_data = ui_inputs.get('flux1_ipadapter_data', [])
360
+ active_flux1_ipadapters = []
361
+ if flux1_ipadapter_data:
362
+ num_units = len(flux1_ipadapter_data) // 4
363
+ f_images = flux1_ipadapter_data[0*num_units : 1*num_units]
364
+ f_weights = flux1_ipadapter_data[1*num_units : 2*num_units]
365
+ f_starts = flux1_ipadapter_data[2*num_units : 3*num_units]
366
+ f_ends = flux1_ipadapter_data[3*num_units : 4*num_units]
367
+ for i in range(len(f_images)):
368
+ if f_images[i] and f_weights[i] > 0:
369
+ from utils.app_utils import _ensure_model_downloaded
370
+ for filename in ["ip-adapter.bin"]:
371
+ _ensure_model_downloaded(filename, progress)
372
+
373
+ from huggingface_hub import snapshot_download
374
+ progress(0.5, desc="Caching HF SigLIP model...")
375
+ snapshot_download(
376
+ repo_id="google/siglip-so400m-patch14-384",
377
+ allow_patterns=["*.json", "*.safetensors", "*.txt"],
378
+ ignore_patterns=["*.msgpack", "*.h5", "*.bin"]
379
+ )
380
+
381
+ temp_path = os.path.join(INPUT_DIR, f"temp_fipa_{i}_{random.randint(1000, 9999)}.png")
382
+ f_images[i].save(temp_path, "PNG")
383
+ temp_files_to_clean.append(temp_path)
384
+ active_flux1_ipadapters.append({
385
+ "image": os.path.basename(temp_path),
386
+ "weight": f_weights[i], "start_percent": f_starts[i], "end_percent": f_ends[i]
387
+ })
388
+
389
+ sd3_ipadapter_data = ui_inputs.get('sd3_ipadapter_chain', [])
390
+ active_sd3_ipadapters = []
391
+ if sd3_ipadapter_data:
392
+ num_units = len(sd3_ipadapter_data) // 4
393
+ s_images = sd3_ipadapter_data[0*num_units : 1*num_units]
394
+ s_weights = sd3_ipadapter_data[1*num_units : 2*num_units]
395
+ s_starts = sd3_ipadapter_data[2*num_units : 3*num_units]
396
+ s_ends = sd3_ipadapter_data[3*num_units : 4*num_units]
397
+ sd3_ipa_downloaded = False
398
+ for i in range(len(s_images)):
399
+ if s_images[i] and s_weights[i] > 0:
400
+ if not sd3_ipa_downloaded:
401
+ from utils.app_utils import ensure_sd3_ipadapter_models_downloaded
402
+ ensure_sd3_ipadapter_models_downloaded(progress)
403
+ sd3_ipa_downloaded = True
404
+ temp_path = os.path.join(INPUT_DIR, f"temp_s3ipa_{i}_{random.randint(1000, 9999)}.png")
405
+ s_images[i].save(temp_path, "PNG")
406
+ temp_files_to_clean.append(temp_path)
407
+ active_sd3_ipadapters.append({
408
+ "image": os.path.basename(temp_path),
409
+ "weight": s_weights[i], "start_percent": s_starts[i], "end_percent": s_ends[i]
410
+ })
411
+
412
+ style_data = ui_inputs.get('style_data', [])
413
+ active_styles = []
414
+ if style_data:
415
+ num_units = len(style_data) // 2
416
+ st_images = style_data[0*num_units : 1*num_units]
417
+ st_strengths = style_data[1*num_units : 2*num_units]
418
+ for i in range(len(st_images)):
419
+ if st_images[i] and st_strengths[i] > 0:
420
+ from utils.app_utils import _ensure_model_downloaded
421
+ _ensure_model_downloaded("sigclip_vision_patch14_384.safetensors", progress)
422
+ temp_path = os.path.join(INPUT_DIR, f"temp_style_{i}_{random.randint(1000, 9999)}.png")
423
+ st_images[i].save(temp_path, "PNG")
424
+ temp_files_to_clean.append(temp_path)
425
+ active_styles.append({
426
+ "image": os.path.basename(temp_path), "strength": st_strengths[i]
427
+ })
428
+
429
+ reference_latent_data = ui_inputs.get('reference_latent_data', [])
430
+ active_reference_latents = []
431
+ if reference_latent_data:
432
+ for img in reference_latent_data:
433
+ if img:
434
+ if not os.path.exists(INPUT_DIR): os.makedirs(INPUT_DIR)
435
+ temp_path = os.path.join(INPUT_DIR, f"temp_ref_{random.randint(1000, 9999)}.png")
436
+ img.save(temp_path, "PNG")
437
+ temp_files_to_clean.append(temp_path)
438
+ active_reference_latents.append(os.path.basename(temp_path))
439
+
440
  from utils.app_utils import get_vae_path
441
  vae_source = ui_inputs.get('vae_source')
442
  vae_id = ui_inputs.get('vae_id')
 
443
  vae_name_override = None
 
444
  if vae_source and vae_source != "None":
445
  if vae_source == "File":
446
  vae_name_override = sanitize_filename(vae_id)
447
  elif vae_source == "Civitai" and vae_id and vae_id.strip():
448
+ local_path, status = get_vae_path(vae_source, vae_id, os.environ.get("CIVITAI_API_KEY", ""), progress)
449
  if local_path: vae_name_override = os.path.basename(local_path)
450
  else: raise gr.Error(f"Failed to prepare VAE {vae_id}: {status}")
 
451
  if vae_name_override:
452
  ui_inputs['vae_name'] = vae_name_override
453
 
 
455
  active_conditioning = []
456
  if conditioning_data:
457
  num_units = len(conditioning_data) // 6
458
+ prompts, widths, heights, xs, ys, strengths = [conditioning_data[i*num_units : (i+1)*num_units] for i in range(6)]
 
 
 
 
 
 
459
  for i in range(num_units):
460
  if prompts[i] and prompts[i].strip():
461
  active_conditioning.append({
462
+ "prompt": prompts[i], "width": int(widths[i]), "height": int(heights[i]),
463
+ "x": int(xs[i]), "y": int(ys[i]), "strength": float(strengths[i])
 
 
 
 
464
  })
465
 
466
  loras_string = f"LoRAs: [{', '.join(active_loras_for_meta)}]" if active_loras_for_meta else ""
 
469
 
470
  if ui_inputs.get('seed') == -1:
471
  ui_inputs['seed'] = random.randint(0, 2**32 - 1)
472
+
473
+ model_info = ALL_MODEL_MAP[model_display_name]
474
+ path_or_components = model_info[1]
475
+ latent_type = model_info[3] if len(model_info) > 3 and model_info[3] else 'latent'
476
+ latent_generator_template = "EmptyLatentImage"
477
+ if latent_type == 'sd3_latent':
478
+ latent_generator_template = "EmptySD3LatentImage"
479
+ elif latent_type == 'chroma_radiance_latent':
480
+ latent_generator_template = "EmptyChromaRadianceLatentImage"
481
+ elif latent_type == 'hunyuan_latent':
482
+ latent_generator_template = "EmptyHunyuanImageLatent"
483
+
484
+ dynamic_values = {
485
+ 'task_type': ui_inputs['task_type'],
486
+ 'model_type': workflow_model_type,
487
+ 'latent_type': latent_type,
488
+ 'latent_generator_template': latent_generator_template
489
+ }
490
 
491
  recipe_path = os.path.join(os.path.dirname(__file__), "workflow_recipes", "sd_unified_recipe.yaml")
492
  assembler = WorkflowAssembler(recipe_path, dynamic_values=dynamic_values)
493
 
 
 
 
 
 
 
494
  workflow_inputs = {
495
+ **ui_inputs,
496
  "positive_prompt": ui_inputs['positive_prompt'], "negative_prompt": ui_inputs['negative_prompt'],
497
  "seed": ui_inputs['seed'], "steps": ui_inputs['num_inference_steps'], "cfg": ui_inputs['guidance_scale'],
498
  "sampler_name": ui_inputs['sampler'], "scheduler": ui_inputs['scheduler'],
499
  "batch_size": ui_inputs['batch_size'],
500
+ "clip_skip": ui_inputs['clip_skip'],
501
+ "denoise": ui_inputs['denoise'],
502
+ "vae_name": ui_inputs.get('vae_name'),
503
+ "guidance": ui_inputs.get('guidance', 3.5),
 
 
 
 
 
 
504
  "lora_chain": active_loras_for_gpu,
505
+ "controlnet_chain": active_controlnets if not active_anima_controlnets else [],
506
+ "anima_controlnet_lllite_chain": active_anima_controlnets,
507
  "diffsynth_controlnet_chain": active_diffsynth_controlnets,
508
+ "ipadapter_chain": active_ipadapters,
509
+ "flux1_ipadapter_chain": active_flux1_ipadapters,
510
+ "sd3_ipadapter_chain": active_sd3_ipadapters,
511
+ "style_chain": active_styles,
512
  "conditioning_chain": active_conditioning,
513
+ "reference_latent_chain": active_reference_latents,
514
+ "vae_chain": [ui_inputs.get('vae_name')] if ui_inputs.get('vae_name') else [],
515
  }
516
+
517
+ if isinstance(path_or_components, dict):
518
+ workflow_inputs.update({
519
+ 'unet_name': path_or_components.get('unet'),
520
+ 'vae_name': ui_inputs.get('vae_name') or path_or_components.get('vae'),
521
+ 'clip_name': path_or_components.get('clip'),
522
+ 'clip1_name': path_or_components.get('clip1'),
523
+ 'clip2_name': path_or_components.get('clip2'),
524
+ 'clip3_name': path_or_components.get('clip3'),
525
+ 'clip4_name': path_or_components.get('clip4'),
526
+ 'lora_name': path_or_components.get('lora'),
527
+ })
528
+ else:
529
+ workflow_inputs['model_name'] = path_or_components
530
 
531
  if task_type == 'txt2img':
532
  workflow_inputs['width'] = ui_inputs['width']
533
  workflow_inputs['height'] = ui_inputs['height']
534
 
535
  workflow = assembler.assemble(workflow_inputs)
536
+
537
  progress(1.0, desc="All models ready. Requesting GPU for generation...")
538
 
539
  try:
 
544
  task_name=f"ImageGen ({task_type})",
545
  ui_inputs=ui_inputs,
546
  loras_string=loras_string,
 
547
  workflow=workflow,
548
  assembler=assembler,
549
  progress=progress
core/pipelines/workflow_recipes/_partials/_base_sampler_sd.yaml ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ nodes:
2
+ pos_prompt:
3
+ class_type: CLIPTextEncode
4
+ title: "CLIP Text Encode (Positive)"
5
+ neg_prompt:
6
+ class_type: CLIPTextEncode
7
+ title: "CLIP Text Encode (Negative)"
8
+ ksampler:
9
+ class_type: KSampler
10
+ title: "KSampler"
11
+ params:
12
+ denoise: 1.0
13
+ vae_decode:
14
+ class_type: VAEDecode
15
+ title: "VAE Decode"
16
+ save_image:
17
+ class_type: SaveImage
18
+ title: "Save Image"
19
+ params: {}
20
+
21
+ connections:
22
+ - from: "ksampler:0"
23
+ to: "vae_decode:samples"
24
+ - from: "vae_decode:0"
25
+ to: "save_image:images"
26
+
27
+ ui_map:
28
+ positive_prompt: "pos_prompt:text"
29
+ negative_prompt: "neg_prompt:text"
30
+ seed: "ksampler:seed"
31
+ steps: "ksampler:steps"
32
+ cfg: "ksampler:cfg"
33
+ sampler_name: "ksampler:sampler_name"
34
+ scheduler: "ksampler:scheduler"
35
+ denoise: "ksampler:denoise"
36
+ filename_prefix: "save_image:filename_prefix"
core/pipelines/workflow_recipes/_partials/conditioning/anima.yaml ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ nodes:
2
+ unet_loader:
3
+ class_type: UNETLoader
4
+ title: "Load Diffusion Model"
5
+ params:
6
+ weight_dtype: "default"
7
+ vae_loader:
8
+ class_type: VAELoader
9
+ title: "Load VAE"
10
+ clip_loader:
11
+ class_type: CLIPLoader
12
+ title: "Load CLIP"
13
+ params:
14
+ type: "stable_diffusion"
15
+ device: "default"
16
+
17
+ connections:
18
+ - from: "unet_loader:0"
19
+ to: "ksampler:model"
20
+ - from: "clip_loader:0"
21
+ to: "pos_prompt:clip"
22
+ - from: "clip_loader:0"
23
+ to: "neg_prompt:clip"
24
+ - from: "vae_loader:0"
25
+ to: "vae_decode:vae"
26
+ - from: "vae_loader:0"
27
+ to: "vae_encode:vae"
28
+ - from: "pos_prompt:0"
29
+ to: "ksampler:positive"
30
+ - from: "neg_prompt:0"
31
+ to: "ksampler:negative"
32
+
33
+ dynamic_lora_chains:
34
+ lora_chain:
35
+ template: "LoraLoader"
36
+ output_map:
37
+ "unet_loader:0": "model"
38
+ "clip_loader:0": "clip"
39
+ input_map:
40
+ "model": "model"
41
+ "clip": "clip"
42
+ end_input_map:
43
+ "model": ["ksampler:model"]
44
+ "clip": ["pos_prompt:clip", "neg_prompt:clip"]
45
+
46
+ dynamic_anima_controlnet_lllite_chains:
47
+ anima_controlnet_lllite_chain:
48
+ ksampler_node: "ksampler"
49
+
50
+ dynamic_conditioning_chains:
51
+ conditioning_chain:
52
+ ksampler_node: "ksampler"
53
+ clip_source: "clip_loader:0"
54
+
55
+ ui_map:
56
+ unet_name: "unet_loader:unet_name"
57
+ vae_name: "vae_loader:vae_name"
58
+ clip_name: "clip_loader:clip_name"
core/pipelines/workflow_recipes/_partials/conditioning/chroma1-radiance.yaml ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ nodes:
2
+ unet_loader:
3
+ class_type: UNETLoader
4
+ title: "Load Diffusion Model"
5
+ params:
6
+ weight_dtype: "default"
7
+ vae_loader:
8
+ class_type: VAELoader
9
+ title: "Load VAE"
10
+ params:
11
+ vae_name: "pixel_space"
12
+ clip_loader:
13
+ class_type: CLIPLoader
14
+ title: "Load CLIP"
15
+ params:
16
+ type: "chroma"
17
+ device: "default"
18
+ t5_tokenizer:
19
+ class_type: T5TokenizerOptions
20
+ title: "T5TokenizerOptions"
21
+ params:
22
+ min_padding: 0
23
+ min_length: 3
24
+ model_sampler:
25
+ class_type: ModelSamplingAuraFlow
26
+ params:
27
+ shift: 3.0
28
+
29
+ connections:
30
+ - from: "unet_loader:0"
31
+ to: "model_sampler:model"
32
+ - from: "model_sampler:0"
33
+ to: "ksampler:model"
34
+
35
+ - from: "clip_loader:0"
36
+ to: "t5_tokenizer:clip"
37
+ - from: "t5_tokenizer:0"
38
+ to: "pos_prompt:clip"
39
+ - from: "t5_tokenizer:0"
40
+ to: "neg_prompt:clip"
41
+
42
+ - from: "pos_prompt:0"
43
+ to: "ksampler:positive"
44
+ - from: "neg_prompt:0"
45
+ to: "ksampler:negative"
46
+
47
+ - from: "vae_loader:0"
48
+ to: "vae_decode:vae"
49
+ - from: "vae_loader:0"
50
+ to: "vae_encode:vae"
51
+
52
+ dynamic_conditioning_chains:
53
+ conditioning_chain:
54
+ ksampler_node: "ksampler"
55
+ clip_source: "t5_tokenizer:0"
56
+
57
+ ui_map:
58
+ unet_name: "unet_loader:unet_name"
59
+ clip_name: "clip_loader:clip_name"
core/pipelines/workflow_recipes/_partials/conditioning/chroma1.yaml ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ nodes:
2
+ unet_loader:
3
+ class_type: UNETLoader
4
+ title: "Load Diffusion Model"
5
+ params:
6
+ weight_dtype: "default"
7
+ vae_loader:
8
+ class_type: VAELoader
9
+ title: "Load VAE"
10
+ clip_loader:
11
+ class_type: CLIPLoader
12
+ title: "Load CLIP"
13
+ params:
14
+ type: "chroma"
15
+ device: "default"
16
+ t5_tokenizer:
17
+ class_type: T5TokenizerOptions
18
+ title: "T5TokenizerOptions"
19
+ params:
20
+ min_padding: 1
21
+ min_length: 0
22
+ fresca:
23
+ class_type: FreSca
24
+ title: "FreSca"
25
+ params:
26
+ scale_low: 1.0
27
+ scale_high: 2.5
28
+ freq_cutoff: 30
29
+
30
+ connections:
31
+ - from: "unet_loader:0"
32
+ to: "fresca:model"
33
+ - from: "fresca:0"
34
+ to: "ksampler:model"
35
+
36
+ - from: "clip_loader:0"
37
+ to: "t5_tokenizer:clip"
38
+ - from: "t5_tokenizer:0"
39
+ to: "pos_prompt:clip"
40
+ - from: "t5_tokenizer:0"
41
+ to: "neg_prompt:clip"
42
+
43
+ - from: "pos_prompt:0"
44
+ to: "ksampler:positive"
45
+ - from: "neg_prompt:0"
46
+ to: "ksampler:negative"
47
+
48
+ - from: "vae_loader:0"
49
+ to: "vae_decode:vae"
50
+ - from: "vae_loader:0"
51
+ to: "vae_encode:vae"
52
+
53
+ dynamic_conditioning_chains:
54
+ conditioning_chain:
55
+ ksampler_node: "ksampler"
56
+ clip_source: "t5_tokenizer:0"
57
+
58
+ ui_map:
59
+ unet_name: "unet_loader:unet_name"
60
+ vae_name: "vae_loader:vae_name"
61
+ clip_name: "clip_loader:clip_name"
core/pipelines/workflow_recipes/_partials/conditioning/ernie-image.yaml ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ nodes:
2
+ unet_loader:
3
+ class_type: UNETLoader
4
+ title: "Load Diffusion Model"
5
+ params:
6
+ weight_dtype: "default"
7
+ clip_loader:
8
+ class_type: CLIPLoader
9
+ title: "Load CLIP"
10
+ params:
11
+ type: "flux2"
12
+ device: "default"
13
+ vae_loader:
14
+ class_type: VAELoader
15
+ title: "Load VAE"
16
+
17
+ connections:
18
+ - from: "unet_loader:0"
19
+ to: "ksampler:model"
20
+ - from: "clip_loader:0"
21
+ to: "pos_prompt:clip"
22
+ - from: "clip_loader:0"
23
+ to: "neg_prompt:clip"
24
+ - from: "pos_prompt:0"
25
+ to: "ksampler:positive"
26
+ - from: "neg_prompt:0"
27
+ to: "ksampler:negative"
28
+ - from: "vae_loader:0"
29
+ to: "vae_decode:vae"
30
+ - from: "vae_loader:0"
31
+ to: "vae_encode:vae"
32
+
33
+ dynamic_lora_chains:
34
+ lora_chain:
35
+ template: "LoraLoader"
36
+ output_map:
37
+ "unet_loader:0": "model"
38
+ "clip_loader:0": "clip"
39
+ input_map:
40
+ "model": "model"
41
+ "clip": "clip"
42
+ end_input_map:
43
+ "model": ["ksampler:model"]
44
+ "clip": ["pos_prompt:clip", "neg_prompt:clip"]
45
+
46
+ dynamic_conditioning_chains:
47
+ conditioning_chain:
48
+ ksampler_node: "ksampler"
49
+ clip_source: "clip_loader:0"
50
+
51
+ ui_map:
52
+ unet_name: "unet_loader:unet_name"
53
+ clip_name: "clip_loader:clip_name"
54
+ vae_name: "vae_loader:vae_name"
core/pipelines/workflow_recipes/_partials/conditioning/flux1.yaml ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ nodes:
2
+ unet_loader:
3
+ class_type: UNETLoader
4
+ title: "Load FLUX UNET"
5
+ params:
6
+ weight_dtype: "default"
7
+ vae_loader:
8
+ class_type: VAELoader
9
+ title: "Load FLUX VAE"
10
+ clip_loader:
11
+ class_type: DualCLIPLoader
12
+ title: "Load FLUX Dual CLIP"
13
+ params:
14
+ type: "flux"
15
+ device: "default"
16
+ flux_guidance:
17
+ class_type: FluxGuidance
18
+ title: "FluxGuidance"
19
+
20
+ connections:
21
+ - from: "unet_loader:0"
22
+ to: "ksampler:model"
23
+ - from: "clip_loader:0"
24
+ to: "pos_prompt:clip"
25
+ - from: "clip_loader:0"
26
+ to: "neg_prompt:clip"
27
+ - from: "vae_loader:0"
28
+ to: "vae_decode:vae"
29
+ - from: "vae_loader:0"
30
+ to: "vae_encode:vae"
31
+ - from: "pos_prompt:0"
32
+ to: "flux_guidance:conditioning"
33
+ - from: "flux_guidance:0"
34
+ to: "ksampler:positive"
35
+ - from: "neg_prompt:0"
36
+ to: "ksampler:negative"
37
+
38
+ dynamic_controlnet_chains:
39
+ controlnet_chain:
40
+ template: "ControlNetApplyAdvanced"
41
+ ksampler_node: "ksampler"
42
+ vae_source: "vae_loader:0"
43
+
44
+ dynamic_flux1_ipadapter_chains:
45
+ flux1_ipadapter_chain:
46
+ ksampler_node: "ksampler"
47
+
48
+ dynamic_style_chains:
49
+ style_chain:
50
+ flux_guidance_node: "flux_guidance"
51
+ ksampler_node: "ksampler"
52
+
53
+ dynamic_conditioning_chains:
54
+ conditioning_chain:
55
+ flux_guidance_node: "flux_guidance"
56
+ ksampler_node: "ksampler"
57
+ clip_source: "clip_loader:0"
58
+
59
+ ui_map:
60
+ unet_name: "unet_loader:unet_name"
61
+ vae_name: "vae_loader:vae_name"
62
+ clip1_name: "clip_loader:clip_name1"
63
+ clip2_name: "clip_loader:clip_name2"
64
+ guidance: "flux_guidance:guidance"
core/pipelines/workflow_recipes/_partials/conditioning/flux2-kv.yaml ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ nodes:
2
+ unet_loader:
3
+ class_type: UNETLoader
4
+ title: "Load Diffusion Model"
5
+ params:
6
+ weight_dtype: "default"
7
+ clip_loader:
8
+ class_type: CLIPLoader
9
+ title: "Load CLIP"
10
+ params:
11
+ type: "flux2"
12
+ device: "default"
13
+ vae_loader:
14
+ class_type: VAELoader
15
+ title: "Load VAE"
16
+
17
+ flux_kv_cache:
18
+ class_type: FluxKVCache
19
+ title: "Flux KV Cache"
20
+
21
+ pos_prompt:
22
+ class_type: CLIPTextEncode
23
+ title: "CLIP Text Encode (Positive)"
24
+ neg_prompt:
25
+ class_type: CLIPTextEncode
26
+ title: "CLIP Text Encode (Negative)"
27
+
28
+ ksampler:
29
+ class_type: KSampler
30
+ title: "KSampler"
31
+ params:
32
+ denoise: 1.0
33
+
34
+ vae_decode:
35
+ class_type: VAEDecode
36
+ title: "VAE Decode"
37
+
38
+ save_image:
39
+ class_type: SaveImage
40
+ title: "Save Image"
41
+
42
+ connections:
43
+ - from: "unet_loader:0"
44
+ to: "flux_kv_cache:model"
45
+ - from: "flux_kv_cache:0"
46
+ to: "ksampler:model"
47
+
48
+ - from: "clip_loader:0"
49
+ to: "pos_prompt:clip"
50
+ - from: "clip_loader:0"
51
+ to: "neg_prompt:clip"
52
+
53
+ - from: "vae_loader:0"
54
+ to: "vae_decode:vae"
55
+ - from: "vae_loader:0"
56
+ to: "vae_encode:vae"
57
+
58
+ - from: "pos_prompt:0"
59
+ to: "ksampler:positive"
60
+ - from: "neg_prompt:0"
61
+ to: "ksampler:negative"
62
+
63
+ - from: "latent_source:0"
64
+ to: "ksampler:latent_image"
65
+
66
+ - from: "ksampler:0"
67
+ to: "vae_decode:samples"
68
+ - from: "vae_decode:0"
69
+ to: "save_image:images"
70
+
71
+ dynamic_lora_chains:
72
+ lora_chain:
73
+ template: "LoraLoader"
74
+ output_map:
75
+ "unet_loader:0": "model"
76
+ "clip_loader:0": "clip"
77
+ input_map:
78
+ "model": "model"
79
+ "clip": "clip"
80
+ end_input_map:
81
+ "model": ["flux_kv_cache:model"]
82
+ "clip": ["pos_prompt:clip", "neg_prompt:clip"]
83
+
84
+ dynamic_reference_latent_chains:
85
+ reference_latent_chain:
86
+ ksampler_node: "ksampler"
87
+ vae_node: "vae_loader"
88
+
89
+ ui_map:
90
+ unet_name: "unet_loader:unet_name"
91
+ clip_name: "clip_loader:clip_name"
92
+ vae_name: "vae_loader:vae_name"
93
+
94
+ positive_prompt: "pos_prompt:text"
95
+ negative_prompt: "neg_prompt:text"
96
+
97
+ seed: "ksampler:seed"
98
+ steps: "ksampler:steps"
99
+ cfg: "ksampler:cfg"
100
+ sampler_name: "ksampler:sampler_name"
101
+ scheduler: "ksampler:scheduler"
102
+ denoise: "ksampler:denoise"
103
+
104
+ filename_prefix: "save_image:filename_prefix"
core/pipelines/workflow_recipes/_partials/conditioning/flux2.yaml ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ nodes:
2
+ unet_loader:
3
+ class_type: UNETLoader
4
+ title: "Load Diffusion Model"
5
+ params:
6
+ weight_dtype: "default"
7
+ clip_loader:
8
+ class_type: CLIPLoader
9
+ title: "Load CLIP"
10
+ params:
11
+ type: "flux2"
12
+ device: "default"
13
+ vae_loader:
14
+ class_type: VAELoader
15
+ title: "Load VAE"
16
+
17
+ pos_prompt:
18
+ class_type: CLIPTextEncode
19
+ title: "CLIP Text Encode (Positive)"
20
+ neg_prompt:
21
+ class_type: CLIPTextEncode
22
+ title: "CLIP Text Encode (Negative)"
23
+
24
+ ksampler:
25
+ class_type: KSampler
26
+ title: "KSampler"
27
+ params:
28
+ denoise: 1.0
29
+
30
+ vae_decode:
31
+ class_type: VAEDecode
32
+ title: "VAE Decode"
33
+
34
+ save_image:
35
+ class_type: SaveImage
36
+ title: "Save Image"
37
+
38
+ connections:
39
+ - from: "unet_loader:0"
40
+ to: "ksampler:model"
41
+ - from: "clip_loader:0"
42
+ to: "pos_prompt:clip"
43
+ - from: "clip_loader:0"
44
+ to: "neg_prompt:clip"
45
+ - from: "vae_loader:0"
46
+ to: "vae_decode:vae"
47
+ - from: "vae_loader:0"
48
+ to: "vae_encode:vae"
49
+
50
+ - from: "pos_prompt:0"
51
+ to: "ksampler:positive"
52
+ - from: "neg_prompt:0"
53
+ to: "ksampler:negative"
54
+
55
+ - from: "latent_source:0"
56
+ to: "ksampler:latent_image"
57
+
58
+ - from: "ksampler:0"
59
+ to: "vae_decode:samples"
60
+ - from: "vae_decode:0"
61
+ to: "save_image:images"
62
+
63
+ dynamic_lora_chains:
64
+ lora_chain:
65
+ template: "LoraLoader"
66
+ output_map:
67
+ "unet_loader:0": "model"
68
+ "clip_loader:0": "clip"
69
+ input_map:
70
+ "model": "model"
71
+ "clip": "clip"
72
+ end_input_map:
73
+ "model": ["ksampler:model"]
74
+ "clip": ["pos_prompt:clip", "neg_prompt:clip"]
75
+
76
+ dynamic_reference_latent_chains:
77
+ reference_latent_chain:
78
+ ksampler_node: "ksampler"
79
+ vae_node: "vae_loader"
80
+
81
+ ui_map:
82
+ unet_name: "unet_loader:unet_name"
83
+ clip_name: "clip_loader:clip_name"
84
+ vae_name: "vae_loader:vae_name"
85
+
86
+ positive_prompt: "pos_prompt:text"
87
+ negative_prompt: "neg_prompt:text"
88
+
89
+ seed: "ksampler:seed"
90
+ steps: "ksampler:steps"
91
+ cfg: "ksampler:cfg"
92
+ sampler_name: "ksampler:sampler_name"
93
+ scheduler: "ksampler:scheduler"
94
+ denoise: "ksampler:denoise"
95
+
96
+ filename_prefix: "save_image:filename_prefix"
core/pipelines/workflow_recipes/_partials/conditioning/hidream.yaml ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ nodes:
2
+ unet_loader:
3
+ class_type: UNETLoader
4
+ title: "Load HiDream UNET"
5
+ params:
6
+ weight_dtype: "default"
7
+ vae_loader:
8
+ class_type: VAELoader
9
+ title: "Load HiDream VAE"
10
+ clip_loader:
11
+ class_type: QuadrupleCLIPLoader
12
+ title: "Load HiDream Quadruple CLIP"
13
+
14
+ model_sampler:
15
+ class_type: ModelSamplingSD3
16
+ title: "ModelSamplingSD3"
17
+ params:
18
+ shift: 6.0
19
+
20
+ connections:
21
+ - from: "unet_loader:0"
22
+ to: "model_sampler:model"
23
+
24
+ - from: "model_sampler:0"
25
+ to: "ksampler:model"
26
+
27
+ - from: "clip_loader:0"
28
+ to: "pos_prompt:clip"
29
+ - from: "clip_loader:0"
30
+ to: "neg_prompt:clip"
31
+
32
+ - from: "pos_prompt:0"
33
+ to: "ksampler:positive"
34
+ - from: "neg_prompt:0"
35
+ to: "ksampler:negative"
36
+
37
+ - from: "vae_loader:0"
38
+ to: "vae_decode:vae"
39
+ - from: "vae_loader:0"
40
+ to: "vae_encode:vae"
41
+
42
+ dynamic_conditioning_chains:
43
+ conditioning_chain:
44
+ ksampler_node: "ksampler"
45
+ clip_source: "clip_loader:0"
46
+
47
+ ui_map:
48
+ unet_name: "unet_loader:unet_name"
49
+ vae_name: "vae_loader:vae_name"
50
+ clip1_name: "clip_loader:clip_name1"
51
+ clip2_name: "clip_loader:clip_name2"
52
+ clip3_name: "clip_loader:clip_name3"
53
+ clip4_name: "clip_loader:clip_name4"
core/pipelines/workflow_recipes/_partials/conditioning/hunyuanimage.yaml ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ nodes:
2
+ unet_loader:
3
+ class_type: UNETLoader
4
+ title: "Load Hunyuan UNET"
5
+ params:
6
+ weight_dtype: "default"
7
+ vae_loader:
8
+ class_type: VAELoader
9
+ title: "Load Hunyuan VAE"
10
+ clip_loader:
11
+ class_type: DualCLIPLoader
12
+ title: "Load Hunyuan Dual CLIP"
13
+ params:
14
+ type: "hunyuan_image"
15
+ device: "default"
16
+
17
+ connections:
18
+ - from: "unet_loader:0"
19
+ to: "ksampler:model"
20
+ - from: "clip_loader:0"
21
+ to: "pos_prompt:clip"
22
+ - from: "clip_loader:0"
23
+ to: "neg_prompt:clip"
24
+ - from: "vae_loader:0"
25
+ to: "vae_decode:vae"
26
+ - from: "vae_loader:0"
27
+ to: "vae_encode:vae"
28
+ - from: "pos_prompt:0"
29
+ to: "ksampler:positive"
30
+ - from: "neg_prompt:0"
31
+ to: "ksampler:negative"
32
+
33
+ dynamic_conditioning_chains:
34
+ conditioning_chain:
35
+ ksampler_node: "ksampler"
36
+ clip_source: "clip_loader:0"
37
+
38
+ ui_map:
39
+ unet_name: "unet_loader:unet_name"
40
+ vae_name: "vae_loader:vae_name"
41
+ clip1_name: "clip_loader:clip_name1"
42
+ clip2_name: "clip_loader:clip_name2"
core/pipelines/workflow_recipes/_partials/conditioning/longcat-image.yaml ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ nodes:
2
+ unet_loader:
3
+ class_type: UNETLoader
4
+ title: "Load Diffusion Model"
5
+ params:
6
+ weight_dtype: "default"
7
+ vae_loader:
8
+ class_type: VAELoader
9
+ title: "Load VAE"
10
+ clip_loader:
11
+ class_type: CLIPLoader
12
+ title: "Load CLIP"
13
+ params:
14
+ type: "longcat_image"
15
+ device: "default"
16
+
17
+ cfg_norm:
18
+ class_type: CFGNorm
19
+ title: "CFGNorm"
20
+ params:
21
+ strength: 1.0
22
+
23
+ flux_guidance_pos:
24
+ class_type: FluxGuidance
25
+ title: "FluxGuidance (Positive)"
26
+ params:
27
+ guidance: 4.0
28
+
29
+ flux_guidance_neg:
30
+ class_type: FluxGuidance
31
+ title: "FluxGuidance (Negative)"
32
+ params:
33
+ guidance: 4.0
34
+
35
+ connections:
36
+ - from: "unet_loader:0"
37
+ to: "cfg_norm:model"
38
+ - from: "cfg_norm:0"
39
+ to: "ksampler:model"
40
+
41
+ - from: "clip_loader:0"
42
+ to: "pos_prompt:clip"
43
+ - from: "clip_loader:0"
44
+ to: "neg_prompt:clip"
45
+
46
+ - from: "pos_prompt:0"
47
+ to: "flux_guidance_pos:conditioning"
48
+ - from: "neg_prompt:0"
49
+ to: "flux_guidance_neg:conditioning"
50
+
51
+ - from: "flux_guidance_pos:0"
52
+ to: "ksampler:positive"
53
+ - from: "flux_guidance_neg:0"
54
+ to: "ksampler:negative"
55
+
56
+ - from: "vae_loader:0"
57
+ to: "vae_decode:vae"
58
+ - from: "vae_loader:0"
59
+ to: "vae_encode:vae"
60
+
61
+ dynamic_lora_chains:
62
+ lora_chain:
63
+ template: "LoraLoader"
64
+ output_map:
65
+ "unet_loader:0": "model"
66
+ "clip_loader:0": "clip"
67
+ input_map:
68
+ "model": "model"
69
+ "clip": "clip"
70
+ end_input_map:
71
+ "model": ["cfg_norm:model"]
72
+ "clip": ["pos_prompt:clip", "neg_prompt:clip"]
73
+
74
+ dynamic_conditioning_chains:
75
+ conditioning_chain:
76
+ flux_guidance_node: "flux_guidance_pos"
77
+ ksampler_node: "ksampler"
78
+ clip_source: "clip_loader:0"
79
+
80
+ ui_map:
81
+ unet_name: "unet_loader:unet_name"
82
+ vae_name: "vae_loader:vae_name"
83
+ clip_name: "clip_loader:clip_name"
core/pipelines/workflow_recipes/_partials/conditioning/lumina.yaml ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ nodes:
2
+ ckpt_loader:
3
+ class_type: CheckpointLoaderSimple
4
+ title: "Load Checkpoint"
5
+ model_sampler:
6
+ class_type: ModelSamplingAuraFlow
7
+ title: "ModelSamplingAuraFlow"
8
+ params:
9
+ shift: 4.0
10
+
11
+ connections:
12
+ - from: "ckpt_loader:0"
13
+ to: "model_sampler:model"
14
+ - from: "model_sampler:0"
15
+ to: "ksampler:model"
16
+
17
+ - from: "ckpt_loader:1"
18
+ to: "pos_prompt:clip"
19
+ - from: "ckpt_loader:1"
20
+ to: "neg_prompt:clip"
21
+ - from: "pos_prompt:0"
22
+ to: "ksampler:positive"
23
+ - from: "neg_prompt:0"
24
+ to: "ksampler:negative"
25
+
26
+ - from: "ckpt_loader:2"
27
+ to: "vae_decode:vae"
28
+ - from: "ckpt_loader:2"
29
+ to: "vae_encode:vae"
30
+
31
+ dynamic_vae_chains:
32
+ vae_chain:
33
+ targets:
34
+ - "vae_decode:vae"
35
+ - "vae_encode:vae"
36
+
37
+ dynamic_lora_chains:
38
+ lora_chain:
39
+ template: "LoraLoader"
40
+ start: "ckpt_loader"
41
+ output_map:
42
+ "0": "model"
43
+ "1": "clip"
44
+ input_map:
45
+ "model": "model"
46
+ "clip": "clip"
47
+ end_input_map:
48
+ "model": ["model_sampler:model"]
49
+ "clip": ["pos_prompt:clip", "neg_prompt:clip"]
50
+
51
+ dynamic_conditioning_chains:
52
+ conditioning_chain:
53
+ ksampler_node: "ksampler"
54
+ clip_source: "ckpt_loader:1"
55
+
56
+ ui_map:
57
+ model_name: "ckpt_loader:ckpt_name"
core/pipelines/workflow_recipes/_partials/conditioning/newbie-image.yaml ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ nodes:
2
+ unet_loader:
3
+ class_type: UNETLoader
4
+ title: "Load Diffusion Model"
5
+ params:
6
+ weight_dtype: "default"
7
+ vae_loader:
8
+ class_type: VAELoader
9
+ title: "Load VAE"
10
+ clip_loader:
11
+ class_type: DualCLIPLoader
12
+ title: "Load Dual CLIP"
13
+ params:
14
+ type: "newbie"
15
+ device: "default"
16
+ model_sampler:
17
+ class_type: ModelSamplingAuraFlow
18
+ title: "ModelSamplingAuraFlow"
19
+ params:
20
+ shift: 6
21
+
22
+ connections:
23
+ - from: "unet_loader:0"
24
+ to: "model_sampler:model"
25
+ - from: "model_sampler:0"
26
+ to: "ksampler:model"
27
+
28
+ - from: "clip_loader:0"
29
+ to: "pos_prompt:clip"
30
+ - from: "clip_loader:0"
31
+ to: "neg_prompt:clip"
32
+
33
+ - from: "pos_prompt:0"
34
+ to: "ksampler:positive"
35
+ - from: "neg_prompt:0"
36
+ to: "ksampler:negative"
37
+
38
+ - from: "vae_loader:0"
39
+ to: "vae_decode:vae"
40
+ - from: "vae_loader:0"
41
+ to: "vae_encode:vae"
42
+
43
+ dynamic_newbie_lora_chains:
44
+ lora_chain:
45
+ template: "NewBieLoraLoader"
46
+ output_map:
47
+ "unet_loader:0": "model"
48
+ "clip_loader:0": "clip"
49
+ input_map:
50
+ "model": "model"
51
+ "clip": "clip"
52
+ end_input_map:
53
+ "model": ["model_sampler:model"]
54
+ "clip": ["pos_prompt:clip", "neg_prompt:clip"]
55
+
56
+ dynamic_conditioning_chains:
57
+ conditioning_chain:
58
+ ksampler_node: "ksampler"
59
+ clip_source: "clip_loader:0"
60
+
61
+ ui_map:
62
+ unet_name: "unet_loader:unet_name"
63
+ vae_name: "vae_loader:vae_name"
64
+ clip1_name: "clip_loader:clip_name1"
65
+ clip2_name: "clip_loader:clip_name2"
core/pipelines/workflow_recipes/_partials/conditioning/omnigen2.yaml ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ nodes:
2
+ unet_loader:
3
+ class_type: UNETLoader
4
+ title: "Load Diffusion Model"
5
+ params:
6
+ weight_dtype: "default"
7
+ vae_loader:
8
+ class_type: VAELoader
9
+ title: "Load VAE"
10
+ clip_loader:
11
+ class_type: CLIPLoader
12
+ title: "Load CLIP"
13
+ params:
14
+ type: "omnigen2"
15
+ device: "default"
16
+
17
+ connections:
18
+ - from: "unet_loader:0"
19
+ to: "ksampler:model"
20
+ - from: "clip_loader:0"
21
+ to: "pos_prompt:clip"
22
+ - from: "clip_loader:0"
23
+ to: "neg_prompt:clip"
24
+ - from: "pos_prompt:0"
25
+ to: "ksampler:positive"
26
+ - from: "neg_prompt:0"
27
+ to: "ksampler:negative"
28
+ - from: "vae_loader:0"
29
+ to: "vae_decode:vae"
30
+ - from: "vae_loader:0"
31
+ to: "vae_encode:vae"
32
+
33
+ dynamic_lora_chains:
34
+ lora_chain:
35
+ template: "LoraLoader"
36
+ output_map:
37
+ "unet_loader:0": "model"
38
+ "clip_loader:0": "clip"
39
+ input_map:
40
+ "model": "model"
41
+ "clip": "clip"
42
+ end_input_map:
43
+ "model": ["ksampler:model"]
44
+ "clip": ["pos_prompt:clip", "neg_prompt:clip"]
45
+
46
+ dynamic_conditioning_chains:
47
+ conditioning_chain:
48
+ ksampler_node: "ksampler"
49
+ clip_source: "clip_loader:0"
50
+
51
+ dynamic_reference_latent_chains:
52
+ reference_latent_chain:
53
+ ksampler_node: "ksampler"
54
+ vae_node: "vae_loader"
55
+
56
+ ui_map:
57
+ unet_name: "unet_loader:unet_name"
58
+ vae_name: "vae_loader:vae_name"
59
+ clip_name: "clip_loader:clip_name"
core/pipelines/workflow_recipes/_partials/conditioning/ovis-image.yaml ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ nodes:
2
+ unet_loader:
3
+ class_type: UNETLoader
4
+ title: "Load Diffusion Model"
5
+ params:
6
+ weight_dtype: "default"
7
+ vae_loader:
8
+ class_type: VAELoader
9
+ title: "Load VAE"
10
+ clip_loader:
11
+ class_type: CLIPLoader
12
+ title: "Load CLIP"
13
+ params:
14
+ type: "ovis"
15
+ device: "default"
16
+ model_sampler:
17
+ class_type: ModelSamplingAuraFlow
18
+ params:
19
+ shift: 3.0
20
+
21
+ connections:
22
+ - from: "unet_loader:0"
23
+ to: "model_sampler:model"
24
+ - from: "model_sampler:0"
25
+ to: "ksampler:model"
26
+
27
+ - from: "clip_loader:0"
28
+ to: "pos_prompt:clip"
29
+ - from: "clip_loader:0"
30
+ to: "neg_prompt:clip"
31
+
32
+ - from: "pos_prompt:0"
33
+ to: "ksampler:positive"
34
+ - from: "neg_prompt:0"
35
+ to: "ksampler:negative"
36
+
37
+ - from: "vae_loader:0"
38
+ to: "vae_decode:vae"
39
+ - from: "vae_loader:0"
40
+ to: "vae_encode:vae"
41
+
42
+ dynamic_conditioning_chains:
43
+ conditioning_chain:
44
+ ksampler_node: "ksampler"
45
+ clip_source: "clip_loader:0"
46
+
47
+ ui_map:
48
+ unet_name: "unet_loader:unet_name"
49
+ vae_name: "vae_loader:vae_name"
50
+ clip_name: "clip_loader:clip_name"
core/pipelines/workflow_recipes/_partials/conditioning/qwen-image.yaml ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ nodes:
2
+ unet_loader:
3
+ class_type: UNETLoader
4
+ title: "Load Qwen UNET"
5
+ params:
6
+ weight_dtype: "default"
7
+ vae_loader:
8
+ class_type: VAELoader
9
+ title: "Load Qwen VAE"
10
+ clip_loader:
11
+ class_type: CLIPLoader
12
+ title: "Load Qwen CLIP"
13
+ params:
14
+ type: "qwen_image"
15
+ device: "default"
16
+
17
+ lora_loader:
18
+ class_type: LoraLoaderModelOnly
19
+ title: "Load Qwen Lightning LoRA"
20
+ params:
21
+ strength_model: 1.0
22
+ model_sampler:
23
+ class_type: ModelSamplingAuraFlow
24
+ title: "ModelSamplingAuraFlow"
25
+ params:
26
+ shift: 3.1
27
+
28
+ connections:
29
+ - from: "unet_loader:0"
30
+ to: "lora_loader:model"
31
+ - from: "lora_loader:0"
32
+ to: "model_sampler:model"
33
+
34
+ - from: "model_sampler:0"
35
+ to: "ksampler:model"
36
+
37
+ - from: "clip_loader:0"
38
+ to: "pos_prompt:clip"
39
+ - from: "clip_loader:0"
40
+ to: "neg_prompt:clip"
41
+
42
+ - from: "vae_loader:0"
43
+ to: "vae_decode:vae"
44
+ - from: "vae_loader:0"
45
+ to: "vae_encode:vae"
46
+
47
+ - from: "pos_prompt:0"
48
+ to: "ksampler:positive"
49
+ - from: "neg_prompt:0"
50
+ to: "ksampler:negative"
51
+
52
+ dynamic_lora_chains:
53
+ lora_chain:
54
+ template: "LoraLoader"
55
+ output_map:
56
+ "lora_loader:0": "model"
57
+ "clip_loader:0": "clip"
58
+ input_map:
59
+ "model": "model"
60
+ "clip": "clip"
61
+ end_input_map:
62
+ "model": ["model_sampler:model"]
63
+ "clip": ["pos_prompt:clip", "neg_prompt:clip"]
64
+
65
+ dynamic_controlnet_chains:
66
+ controlnet_chain:
67
+ template: "ControlNetApplyAdvanced"
68
+ ksampler_node: "ksampler"
69
+ vae_source: "vae_loader:0"
70
+
71
+ dynamic_conditioning_chains:
72
+ conditioning_chain:
73
+ ksampler_node: "ksampler"
74
+ clip_source: "clip_loader:0"
75
+
76
+ ui_map:
77
+ unet_name: "unet_loader:unet_name"
78
+ vae_name: "vae_loader:vae_name"
79
+ clip_name: "clip_loader:clip_name"
80
+ lora_name: "lora_loader:lora_name"
core/pipelines/workflow_recipes/_partials/conditioning/sd15.yaml ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ nodes:
2
+ ckpt_loader:
3
+ class_type: CheckpointLoaderSimple
4
+ title: "Load Checkpoint"
5
+ clip_set_last_layer:
6
+ class_type: CLIPSetLastLayer
7
+ title: "CLIP Set Last Layer"
8
+
9
+ connections:
10
+ - from: "ckpt_loader:0"
11
+ to: "ksampler:model"
12
+ - from: "ckpt_loader:1"
13
+ to: "clip_set_last_layer:clip"
14
+ - from: "clip_set_last_layer:0"
15
+ to: "pos_prompt:clip"
16
+ - from: "clip_set_last_layer:0"
17
+ to: "neg_prompt:clip"
18
+ - from: "pos_prompt:0"
19
+ to: "ksampler:positive"
20
+ - from: "neg_prompt:0"
21
+ to: "ksampler:negative"
22
+ - from: "ckpt_loader:2"
23
+ to: "vae_decode:vae"
24
+ - from: "ckpt_loader:2"
25
+ to: "vae_encode:vae"
26
+
27
+ dynamic_vae_chains:
28
+ vae_chain:
29
+ targets:
30
+ - "vae_decode:vae"
31
+ - "vae_encode:vae"
32
+
33
+ dynamic_lora_chains:
34
+ lora_chain:
35
+ template: "LoraLoader"
36
+ start: "clip_set_last_layer"
37
+ output_map:
38
+ "ckpt_loader:0": "model"
39
+ "0": "clip"
40
+ input_map:
41
+ "model": "model"
42
+ "clip": "clip"
43
+ end_input_map:
44
+ "model": ["ksampler:model"]
45
+ "clip": ["pos_prompt:clip", "neg_prompt:clip"]
46
+
47
+ dynamic_controlnet_chains:
48
+ controlnet_chain:
49
+ template: "ControlNetApplyAdvanced"
50
+ ksampler_node: "ksampler"
51
+ vae_source: "ckpt_loader:2"
52
+
53
+ dynamic_ipadapter_chains:
54
+ ipadapter_chain:
55
+ end: "ksampler"
56
+ final_preset: "{{ ipadapter_final_preset }}"
57
+ final_weight: "{{ ipadapter_final_weight }}"
58
+ final_embeds_scaling: "{{ ipadapter_embeds_scaling }}"
59
+ final_loader_type: "{{ ipadapter_final_loader_type }}"
60
+ final_lora_strength: "{{ ipadapter_final_lora_strength }}"
61
+
62
+ dynamic_conditioning_chains:
63
+ conditioning_chain:
64
+ ksampler_node: "ksampler"
65
+ clip_source: "clip_set_last_layer:0"
66
+
67
+ ui_map:
68
+ model_name: "ckpt_loader:ckpt_name"
69
+ clip_skip: "clip_set_last_layer:stop_at_clip_layer"
core/pipelines/workflow_recipes/_partials/conditioning/sd35.yaml ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ nodes:
2
+ ckpt_loader:
3
+ class_type: CheckpointLoaderSimple
4
+ title: "Load Checkpoint"
5
+
6
+ connections:
7
+ - from: "ckpt_loader:0"
8
+ to: "ksampler:model"
9
+ - from: "ckpt_loader:1"
10
+ to: "pos_prompt:clip"
11
+ - from: "ckpt_loader:1"
12
+ to: "neg_prompt:clip"
13
+ - from: "pos_prompt:0"
14
+ to: "ksampler:positive"
15
+ - from: "neg_prompt:0"
16
+ to: "ksampler:negative"
17
+ - from: "ckpt_loader:2"
18
+ to: "vae_decode:vae"
19
+ - from: "ckpt_loader:2"
20
+ to: "vae_encode:vae"
21
+
22
+ dynamic_vae_chains:
23
+ vae_chain:
24
+ targets:
25
+ - "vae_decode:vae"
26
+ - "vae_encode:vae"
27
+
28
+ dynamic_lora_chains:
29
+ lora_chain:
30
+ template: "LoraLoader"
31
+ start: "ckpt_loader"
32
+ output_map:
33
+ "0": "model"
34
+ "1": "clip"
35
+ input_map:
36
+ "model": "model"
37
+ "clip": "clip"
38
+ end_input_map:
39
+ "model": ["ksampler:model"]
40
+ "clip": ["pos_prompt:clip", "neg_prompt:clip"]
41
+
42
+ dynamic_controlnet_chains:
43
+ controlnet_chain:
44
+ template: "ControlNetApplyAdvanced"
45
+ ksampler_node: "ksampler"
46
+ vae_source: "ckpt_loader:2"
47
+
48
+ dynamic_sd3_ipadapter_chains:
49
+ sd3_ipadapter_chain:
50
+ ksampler_node: "ksampler"
51
+
52
+ dynamic_conditioning_chains:
53
+ conditioning_chain:
54
+ ksampler_node: "ksampler"
55
+ clip_source: "ckpt_loader:1"
56
+
57
+ ui_map:
58
+ model_name: "ckpt_loader:ckpt_name"
core/pipelines/workflow_recipes/_partials/conditioning/sdxl.yaml ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ nodes:
2
+ ckpt_loader:
3
+ class_type: CheckpointLoaderSimple
4
+ title: "Load Checkpoint"
5
+
6
+ connections:
7
+ - from: "ckpt_loader:0"
8
+ to: "ksampler:model"
9
+ - from: "ckpt_loader:1"
10
+ to: "pos_prompt:clip"
11
+ - from: "ckpt_loader:1"
12
+ to: "neg_prompt:clip"
13
+ - from: "pos_prompt:0"
14
+ to: "ksampler:positive"
15
+ - from: "neg_prompt:0"
16
+ to: "ksampler:negative"
17
+ - from: "ckpt_loader:2"
18
+ to: "vae_decode:vae"
19
+ - from: "ckpt_loader:2"
20
+ to: "vae_encode:vae"
21
+
22
+ dynamic_vae_chains:
23
+ vae_chain:
24
+ targets:
25
+ - "vae_decode:vae"
26
+ - "vae_encode:vae"
27
+
28
+ dynamic_lora_chains:
29
+ lora_chain:
30
+ template: "LoraLoader"
31
+ start: "ckpt_loader"
32
+ output_map:
33
+ "0": "model"
34
+ "1": "clip"
35
+ input_map:
36
+ "model": "model"
37
+ "clip": "clip"
38
+ end_input_map:
39
+ "model": ["ksampler:model"]
40
+ "clip": ["pos_prompt:clip", "neg_prompt:clip"]
41
+
42
+ dynamic_controlnet_chains:
43
+ controlnet_chain:
44
+ template: "ControlNetApplyAdvanced"
45
+ ksampler_node: "ksampler"
46
+ vae_source: "ckpt_loader:2"
47
+
48
+ dynamic_ipadapter_chains:
49
+ ipadapter_chain:
50
+ end: "ksampler"
51
+ final_preset: "{{ ipadapter_final_preset }}"
52
+ final_weight: "{{ ipadapter_final_weight }}"
53
+ final_embeds_scaling: "{{ ipadapter_embeds_scaling }}"
54
+ final_loader_type: "{{ ipadapter_final_loader_type }}"
55
+ final_lora_strength: "{{ ipadapter_final_lora_strength }}"
56
+
57
+ dynamic_conditioning_chains:
58
+ conditioning_chain:
59
+ ksampler_node: "ksampler"
60
+ clip_source: "ckpt_loader:1"
61
+
62
+ ui_map:
63
+ model_name: "ckpt_loader:ckpt_name"
core/pipelines/workflow_recipes/_partials/conditioning/z-image.yaml CHANGED
@@ -17,12 +17,6 @@ nodes:
17
  class_type: ModelSamplingAuraFlow
18
  params:
19
  shift: 3.0
20
- pos_prompt:
21
- class_type: CLIPTextEncode
22
- title: "Positive Prompt Encoder"
23
- neg_prompt:
24
- class_type: CLIPTextEncode
25
- title: "Negative Prompt Encoder"
26
 
27
  connections:
28
  - from: "unet_loader:0"
@@ -65,14 +59,7 @@ dynamic_diffsynth_controlnet_chains:
65
  ksampler_node: "ksampler"
66
  vae_source: "vae_loader:0"
67
 
68
- dynamic_conditioning_chains:
69
- conditioning_chain:
70
- ksampler_node: "ksampler"
71
- clip_source: "clip_loader:0"
72
-
73
  ui_map:
74
  unet_name: "unet_loader:unet_name"
75
  vae_name: "vae_loader:vae_name"
76
- clip_name: "clip_loader:clip_name"
77
- positive_prompt: "pos_prompt:text"
78
- negative_prompt: "neg_prompt:text"
 
17
  class_type: ModelSamplingAuraFlow
18
  params:
19
  shift: 3.0
 
 
 
 
 
 
20
 
21
  connections:
22
  - from: "unet_loader:0"
 
59
  ksampler_node: "ksampler"
60
  vae_source: "vae_loader:0"
61
 
 
 
 
 
 
62
  ui_map:
63
  unet_name: "unet_loader:unet_name"
64
  vae_name: "vae_loader:vae_name"
65
+ clip_name: "clip_loader:clip_name"
 
 
core/pipelines/workflow_recipes/_partials/input/hires_fix.yaml CHANGED
@@ -1,15 +1,16 @@
1
  nodes:
2
  input_image_loader:
3
  class_type: LoadImage
4
-
5
  vae_encode:
6
  class_type: VAEEncode
7
-
8
  latent_upscaler:
9
  class_type: LatentUpscaleBy
10
-
11
  latent_source:
12
  class_type: RepeatLatentBatch
 
13
 
14
  connections:
15
  - from: "input_image_loader:0"
 
1
  nodes:
2
  input_image_loader:
3
  class_type: LoadImage
4
+ title: "Load Input Image"
5
  vae_encode:
6
  class_type: VAEEncode
7
+ title: "VAE Encode (Hires Pre-step)"
8
  latent_upscaler:
9
  class_type: LatentUpscaleBy
10
+ title: "Upscale Latent By"
11
  latent_source:
12
  class_type: RepeatLatentBatch
13
+ title: "Repeat Latent Batch for Hires"
14
 
15
  connections:
16
  - from: "input_image_loader:0"
core/pipelines/workflow_recipes/_partials/input/img2img.yaml CHANGED
@@ -1,12 +1,13 @@
1
  nodes:
2
  input_image_loader:
3
  class_type: LoadImage
4
-
5
  vae_encode:
6
  class_type: VAEEncode
7
-
8
  latent_source:
9
  class_type: RepeatLatentBatch
 
10
 
11
  connections:
12
  - from: "input_image_loader:0"
 
1
  nodes:
2
  input_image_loader:
3
  class_type: LoadImage
4
+ title: "Load Input Image"
5
  vae_encode:
6
  class_type: VAEEncode
7
+ title: "VAE Encode (Img2Img)"
8
  latent_source:
9
  class_type: RepeatLatentBatch
10
+ title: "Repeat Latent Batch"
11
 
12
  connections:
13
  - from: "input_image_loader:0"
core/pipelines/workflow_recipes/_partials/input/inpaint.yaml CHANGED
@@ -2,24 +2,22 @@ nodes:
2
  inpaint_loader:
3
  class_type: LoadImage
4
  title: "Load Inpaint Image+Mask"
5
-
6
  vae_encode:
7
  class_type: VAEEncodeForInpaint
8
- params:
9
- grow_mask_by: 6
10
-
11
  latent_source:
12
  class_type: RepeatLatentBatch
13
-
 
14
  connections:
15
  - from: "inpaint_loader:0"
16
  to: "vae_encode:pixels"
17
  - from: "inpaint_loader:1"
18
  to: "vae_encode:mask"
19
-
20
  - from: "vae_encode:0"
21
  to: "latent_source:samples"
22
 
23
  ui_map:
24
- inpaint_image: "inpaint_loader:image"
25
- batch_size: "latent_source:amount"
 
 
2
  inpaint_loader:
3
  class_type: LoadImage
4
  title: "Load Inpaint Image+Mask"
 
5
  vae_encode:
6
  class_type: VAEEncodeForInpaint
7
+ title: "VAE Encode (for Inpainting)"
 
 
8
  latent_source:
9
  class_type: RepeatLatentBatch
10
+ title: "Repeat Latent Batch"
11
+
12
  connections:
13
  - from: "inpaint_loader:0"
14
  to: "vae_encode:pixels"
15
  - from: "inpaint_loader:1"
16
  to: "vae_encode:mask"
 
17
  - from: "vae_encode:0"
18
  to: "latent_source:samples"
19
 
20
  ui_map:
21
+ input_image: "inpaint_loader:image"
22
+ batch_size: "latent_source:amount"
23
+ grow_mask_by: "vae_encode:grow_mask_by"
core/pipelines/workflow_recipes/_partials/input/outpaint.yaml CHANGED
@@ -1,38 +1,41 @@
1
  nodes:
2
  input_image_loader:
3
  class_type: LoadImage
4
-
 
 
 
 
 
5
  pad_image:
6
  class_type: ImagePadForOutpaint
7
- params:
8
- feathering: 10
9
-
10
  vae_encode:
11
  class_type: VAEEncodeForInpaint
12
- params:
13
- grow_mask_by: 6
14
-
15
  latent_source:
16
  class_type: RepeatLatentBatch
 
17
 
18
  connections:
19
  - from: "input_image_loader:0"
 
 
20
  to: "pad_image:image"
21
-
22
  - from: "pad_image:0"
23
  to: "vae_encode:pixels"
24
  - from: "pad_image:1"
25
  to: "vae_encode:mask"
26
-
27
  - from: "vae_encode:0"
28
  to: "latent_source:samples"
29
 
30
  ui_map:
31
  input_image: "input_image_loader:image"
32
-
33
  left: "pad_image:left"
34
  top: "pad_image:top"
35
  right: "pad_image:right"
36
  bottom: "pad_image:bottom"
37
-
 
38
  batch_size: "latent_source:amount"
 
1
  nodes:
2
  input_image_loader:
3
  class_type: LoadImage
4
+ title: "Load Image for Outpaint"
5
+ scale_image:
6
+ class_type: ImageScaleToTotalPixels
7
+ title: "Scale Image to Total Pixels"
8
+ params:
9
+ upscale_method: "nearest-exact"
10
  pad_image:
11
  class_type: ImagePadForOutpaint
12
+ title: "Pad Image for Outpainting"
 
 
13
  vae_encode:
14
  class_type: VAEEncodeForInpaint
15
+ title: "VAE Encode (for Inpainting)"
 
 
16
  latent_source:
17
  class_type: RepeatLatentBatch
18
+ title: "Repeat Latent Batch"
19
 
20
  connections:
21
  - from: "input_image_loader:0"
22
+ to: "scale_image:image"
23
+ - from: "scale_image:0"
24
  to: "pad_image:image"
 
25
  - from: "pad_image:0"
26
  to: "vae_encode:pixels"
27
  - from: "pad_image:1"
28
  to: "vae_encode:mask"
 
29
  - from: "vae_encode:0"
30
  to: "latent_source:samples"
31
 
32
  ui_map:
33
  input_image: "input_image_loader:image"
34
+ megapixels: "scale_image:megapixels"
35
  left: "pad_image:left"
36
  top: "pad_image:top"
37
  right: "pad_image:right"
38
  bottom: "pad_image:bottom"
39
+ feathering: "pad_image:feathering"
40
+ grow_mask_by: "vae_encode:grow_mask_by"
41
  batch_size: "latent_source:amount"
core/pipelines/workflow_recipes/_partials/input/txt2img.yaml CHANGED
@@ -1,8 +1,2 @@
1
- nodes:
2
- latent_source:
3
- class_type: EmptySD3LatentImage
4
-
5
- ui_map:
6
- width: "latent_source:width"
7
- height: "latent_source:height"
8
- batch_size: "latent_source:batch_size"
 
1
+ imports:
2
+ - "txt2img_{{ latent_type }}.yaml"
 
 
 
 
 
 
core/pipelines/workflow_recipes/_partials/input/txt2img_chroma_radiance_latent.yaml ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ nodes:
2
+ latent_source:
3
+ class_type: "EmptyChromaRadianceLatentImage"
4
+ title: "EmptyChromaRadianceLatentImage"
5
+
6
+ connections: []
7
+
8
+ ui_map:
9
+ width: "latent_source:width"
10
+ height: "latent_source:height"
11
+ batch_size: "latent_source:batch_size"
core/pipelines/workflow_recipes/_partials/input/txt2img_flux2_latent.yaml ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ nodes:
2
+ latent_source:
3
+ class_type: "EmptyFlux2LatentImage"
4
+ title: "Empty Flux 2 Latent"
5
+
6
+ connections: []
7
+
8
+ ui_map:
9
+ width: "latent_source:width"
10
+ height: "latent_source:height"
11
+ batch_size: "latent_source:batch_size"
core/pipelines/workflow_recipes/_partials/input/txt2img_hunyuan_latent.yaml ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ nodes:
2
+ latent_source:
3
+ class_type: "EmptyHunyuanImageLatent"
4
+ title: "EmptyHunyuanImageLatent"
5
+
6
+ connections: []
7
+
8
+ ui_map:
9
+ width: "latent_source:width"
10
+ height: "latent_source:height"
11
+ batch_size: "latent_source:batch_size"
core/pipelines/workflow_recipes/_partials/input/txt2img_latent.yaml ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ nodes:
2
+ latent_source:
3
+ class_type: "{{ latent_generator_template }}"
4
+ title: "Empty Latent Image"
5
+
6
+ connections: []
7
+
8
+ ui_map:
9
+ width: "latent_source:width"
10
+ height: "latent_source:height"
11
+ batch_size: "latent_source:batch_size"
core/pipelines/workflow_recipes/_partials/input/txt2img_sd3_latent.yaml ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ nodes:
2
+ latent_source:
3
+ class_type: "EmptySD3LatentImage"
4
+ title: "EmptySD3LatentImage"
5
+
6
+ connections: []
7
+
8
+ ui_map:
9
+ width: "latent_source:width"
10
+ height: "latent_source:height"
11
+ batch_size: "latent_source:batch_size"
core/pipelines/workflow_recipes/sd_unified_recipe.yaml CHANGED
@@ -1,7 +1,7 @@
1
  imports:
2
- - "_partials/_base_sampler.yaml"
3
  - "_partials/input/{{ task_type }}.yaml"
4
- - "_partials/conditioning/z-image.yaml"
5
 
6
  connections:
7
  - from: "latent_source:0"
 
1
  imports:
2
+ - "_partials/_base_sampler_sd.yaml"
3
  - "_partials/input/{{ task_type }}.yaml"
4
+ - "_partials/conditioning/{{ model_type }}.yaml"
5
 
6
  connections:
7
  - from: "latent_source:0"
core/settings.py CHANGED
@@ -10,16 +10,37 @@ MODEL_PATCHES_DIR = "models/model_patches"
10
  DIFFUSION_MODELS_DIR = "models/diffusion_models"
11
  VAE_DIR = "models/vae"
12
  TEXT_ENCODERS_DIR = "models/text_encoders"
 
 
 
 
13
  INPUT_DIR = "input"
14
  OUTPUT_DIR = "output"
15
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  _PROJECT_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
17
  _MODEL_LIST_PATH = os.path.join(_PROJECT_ROOT, 'yaml', 'model_list.yaml')
18
  _FILE_LIST_PATH = os.path.join(_PROJECT_ROOT, 'yaml', 'file_list.yaml')
 
19
  _CONSTANTS_PATH = os.path.join(_PROJECT_ROOT, 'yaml', 'constants.yaml')
 
 
20
  _MODEL_DEFAULTS_PATH = os.path.join(_PROJECT_ROOT, 'yaml', 'model_defaults.yaml')
21
 
22
-
23
  def load_constants_from_yaml(filepath=_CONSTANTS_PATH):
24
  if not os.path.exists(filepath):
25
  print(f"Warning: Constants file not found at {filepath}. Using fallback values.")
@@ -27,6 +48,27 @@ def load_constants_from_yaml(filepath=_CONSTANTS_PATH):
27
  with open(filepath, 'r', encoding='utf-8') as f:
28
  return yaml.safe_load(f)
29
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  def load_file_download_map(filepath=_FILE_LIST_PATH):
31
  if not os.path.exists(filepath):
32
  raise FileNotFoundError(f"The file list (for downloads) was not found at: {filepath}")
@@ -59,50 +101,86 @@ def load_models_from_yaml(model_list_filepath=_MODEL_LIST_PATH, download_map=Non
59
  }
60
  category_map_names = {
61
  "Checkpoint": "MODEL_MAP_CHECKPOINT",
 
62
  }
63
 
64
- for category, models in model_data.items():
65
  if category in category_map_names:
66
  map_name = category_map_names[category]
67
- if not isinstance(models, list): continue
68
- for model in models:
69
- display_name = model['display_name']
70
- components = model.get('components', {})
71
-
72
- model_tuple = (
73
- None,
74
- components,
75
- "SDXL",
76
- None
77
- )
78
- model_maps[map_name][display_name] = model_tuple
79
- model_maps["ALL_MODEL_MAP"][display_name] = model_tuple
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80
 
81
  return model_maps
82
 
83
- def load_model_defaults(filepath=_MODEL_DEFAULTS_PATH):
84
- if not os.path.exists(filepath):
85
- print(f"Warning: Model defaults file not found at {filepath}. Using empty defaults.")
86
- return {}
87
- with open(filepath, 'r', encoding='utf-8') as f:
88
- return yaml.safe_load(f)
89
-
90
  try:
91
  ALL_FILE_DOWNLOAD_MAP = load_file_download_map()
92
  loaded_maps = load_models_from_yaml(download_map=ALL_FILE_DOWNLOAD_MAP)
93
  MODEL_MAP_CHECKPOINT = loaded_maps["MODEL_MAP_CHECKPOINT"]
94
  ALL_MODEL_MAP = loaded_maps["ALL_MODEL_MAP"]
95
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
  MODEL_TYPE_MAP = {k: v[2] for k, v in ALL_MODEL_MAP.items()}
97
-
98
- ALL_MODEL_DEFAULTS = load_model_defaults()
 
 
 
 
 
 
 
99
 
100
  except Exception as e:
101
  print(f"FATAL: Could not load model configuration from YAML. Error: {e}")
102
  ALL_FILE_DOWNLOAD_MAP = {}
103
  MODEL_MAP_CHECKPOINT, ALL_MODEL_MAP = {}, {}
104
  MODEL_TYPE_MAP = {}
105
- ALL_MODEL_DEFAULTS = {}
106
 
107
 
108
  try:
@@ -111,13 +189,17 @@ try:
111
  MAX_EMBEDDINGS = _constants.get('MAX_EMBEDDINGS', 5)
112
  MAX_CONDITIONINGS = _constants.get('MAX_CONDITIONINGS', 10)
113
  MAX_CONTROLNETS = _constants.get('MAX_CONTROLNETS', 5)
114
- LORA_SOURCE_CHOICES = _constants.get('LORA_SOURCE_CHOICES', ["Civitai", "Custom URL", "File"])
 
115
  RESOLUTION_MAP = _constants.get('RESOLUTION_MAP', {})
 
 
 
116
  except Exception as e:
117
  print(f"FATAL: Could not load constants from YAML. Error: {e}")
118
- MAX_LORAS, MAX_EMBEDDINGS, MAX_CONDITIONINGS, MAX_CONTROLNETS = 5, 5, 10, 5
119
- LORA_SOURCE_CHOICES = ["Civitai", "Custom URL", "File"]
120
  RESOLUTION_MAP = {}
121
-
122
-
123
- DEFAULT_NEGATIVE_PROMPT = ""
 
10
  DIFFUSION_MODELS_DIR = "models/diffusion_models"
11
  VAE_DIR = "models/vae"
12
  TEXT_ENCODERS_DIR = "models/text_encoders"
13
+ STYLE_MODELS_DIR = "models/style_models"
14
+ CLIP_VISION_DIR = "models/clip_vision"
15
+ IPADAPTER_DIR = "models/ipadapter"
16
+ IPADAPTER_FLUX_DIR = "models/ipadapter-flux"
17
  INPUT_DIR = "input"
18
  OUTPUT_DIR = "output"
19
 
20
+ CATEGORY_TO_DIR_MAP = {
21
+ "diffusion_models": DIFFUSION_MODELS_DIR,
22
+ "text_encoders": TEXT_ENCODERS_DIR,
23
+ "vae": VAE_DIR,
24
+ "checkpoints": CHECKPOINT_DIR,
25
+ "loras": LORA_DIR,
26
+ "controlnet": CONTROLNET_DIR,
27
+ "model_patches": MODEL_PATCHES_DIR,
28
+ "embeddings": EMBEDDING_DIR,
29
+ "style_models": STYLE_MODELS_DIR,
30
+ "clip_vision": CLIP_VISION_DIR,
31
+ "ipadapter": IPADAPTER_DIR,
32
+ "ipadapter-flux": IPADAPTER_FLUX_DIR
33
+ }
34
+
35
  _PROJECT_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
36
  _MODEL_LIST_PATH = os.path.join(_PROJECT_ROOT, 'yaml', 'model_list.yaml')
37
  _FILE_LIST_PATH = os.path.join(_PROJECT_ROOT, 'yaml', 'file_list.yaml')
38
+ _IPADAPTER_LIST_PATH = os.path.join(_PROJECT_ROOT, 'yaml', 'ipadapter.yaml')
39
  _CONSTANTS_PATH = os.path.join(_PROJECT_ROOT, 'yaml', 'constants.yaml')
40
+ _MODEL_ARCHITECTURES_PATH = os.path.join(_PROJECT_ROOT, 'yaml', 'model_architectures.yaml')
41
+ _IMAGE_GEN_FEATURES_PATH = os.path.join(_PROJECT_ROOT, 'yaml', 'image_gen_features.yaml')
42
  _MODEL_DEFAULTS_PATH = os.path.join(_PROJECT_ROOT, 'yaml', 'model_defaults.yaml')
43
 
 
44
  def load_constants_from_yaml(filepath=_CONSTANTS_PATH):
45
  if not os.path.exists(filepath):
46
  print(f"Warning: Constants file not found at {filepath}. Using fallback values.")
 
48
  with open(filepath, 'r', encoding='utf-8') as f:
49
  return yaml.safe_load(f)
50
 
51
+ def load_architectures_config(filepath=_MODEL_ARCHITECTURES_PATH):
52
+ if not os.path.exists(filepath):
53
+ print(f"Warning: Architectures file not found at {filepath}.")
54
+ return {}
55
+ with open(filepath, 'r', encoding='utf-8') as f:
56
+ return yaml.safe_load(f)
57
+
58
+ def load_features_config(filepath=_IMAGE_GEN_FEATURES_PATH):
59
+ if not os.path.exists(filepath):
60
+ print(f"Warning: Features file not found at {filepath}.")
61
+ return {}
62
+ with open(filepath, 'r', encoding='utf-8') as f:
63
+ return yaml.safe_load(f)
64
+
65
+ def load_model_defaults(filepath=_MODEL_DEFAULTS_PATH):
66
+ if not os.path.exists(filepath):
67
+ print(f"Warning: Model defaults file not found at {filepath}.")
68
+ return {}
69
+ with open(filepath, 'r', encoding='utf-8') as f:
70
+ return yaml.safe_load(f)
71
+
72
  def load_file_download_map(filepath=_FILE_LIST_PATH):
73
  if not os.path.exists(filepath):
74
  raise FileNotFoundError(f"The file list (for downloads) was not found at: {filepath}")
 
101
  }
102
  category_map_names = {
103
  "Checkpoint": "MODEL_MAP_CHECKPOINT",
104
+ "Checkpoints": "MODEL_MAP_CHECKPOINT"
105
  }
106
 
107
+ for category, architectures in model_data.items():
108
  if category in category_map_names:
109
  map_name = category_map_names[category]
110
+ if not isinstance(architectures, dict): continue
111
+
112
+ for arch, arch_data in architectures.items():
113
+ if not isinstance(arch_data, dict): continue
114
+
115
+ latent_type = arch_data.get('latent_type', 'latent')
116
+ models = arch_data.get('models', [])
117
+ if not isinstance(models, list): continue
118
+
119
+ for model in models:
120
+ display_name = model['display_name']
121
+ path_or_components = model.get('path') or model.get('components')
122
+ mod_category = model.get('category', None)
123
+
124
+ repo_id = ''
125
+ if isinstance(path_or_components, str):
126
+ download_info = download_map.get(path_or_components, {})
127
+ repo_id = download_info.get('repo_id', '')
128
+
129
+ model_tuple = (
130
+ repo_id,
131
+ path_or_components,
132
+ arch,
133
+ latent_type,
134
+ mod_category
135
+ )
136
+ model_maps[map_name][display_name] = model_tuple
137
+ model_maps["ALL_MODEL_MAP"][display_name] = model_tuple
138
 
139
  return model_maps
140
 
 
 
 
 
 
 
 
141
  try:
142
  ALL_FILE_DOWNLOAD_MAP = load_file_download_map()
143
  loaded_maps = load_models_from_yaml(download_map=ALL_FILE_DOWNLOAD_MAP)
144
  MODEL_MAP_CHECKPOINT = loaded_maps["MODEL_MAP_CHECKPOINT"]
145
  ALL_MODEL_MAP = loaded_maps["ALL_MODEL_MAP"]
146
 
147
+ category_to_model_type = {
148
+ "diffusion_models": "UNET",
149
+ "text_encoders": "TEXT_ENCODER",
150
+ "vae": "VAE",
151
+ "checkpoints": "SDXL",
152
+ "loras": "LORA",
153
+ "controlnet": "CONTROLNET",
154
+ "model_patches": "MODEL_PATCH",
155
+ "style_models": "STYLE",
156
+ "clip_vision": "CLIP_VISION",
157
+ "ipadapter": "IPADAPTER",
158
+ "ipadapter-flux": "IPADAPTER_FLUX"
159
+ }
160
+ for filename, file_info in ALL_FILE_DOWNLOAD_MAP.items():
161
+ if filename not in ALL_MODEL_MAP:
162
+ category = file_info.get('category')
163
+ model_type = category_to_model_type.get(category, 'UNKNOWN')
164
+ repo_id = file_info.get('repo_id', '')
165
+ ALL_MODEL_MAP[filename] = (repo_id, filename, model_type, None, None)
166
+
167
  MODEL_TYPE_MAP = {k: v[2] for k, v in ALL_MODEL_MAP.items()}
168
+
169
+ ARCH_CATEGORIES_MAP = {}
170
+ for display_name, info in MODEL_MAP_CHECKPOINT.items():
171
+ arch = info[2]
172
+ cat = info[4] if len(info) > 4 else None
173
+ if arch not in ARCH_CATEGORIES_MAP:
174
+ ARCH_CATEGORIES_MAP[arch] = []
175
+ if cat and cat not in ARCH_CATEGORIES_MAP[arch]:
176
+ ARCH_CATEGORIES_MAP[arch].append(cat)
177
 
178
  except Exception as e:
179
  print(f"FATAL: Could not load model configuration from YAML. Error: {e}")
180
  ALL_FILE_DOWNLOAD_MAP = {}
181
  MODEL_MAP_CHECKPOINT, ALL_MODEL_MAP = {}, {}
182
  MODEL_TYPE_MAP = {}
183
+ ARCH_CATEGORIES_MAP = {}
184
 
185
 
186
  try:
 
189
  MAX_EMBEDDINGS = _constants.get('MAX_EMBEDDINGS', 5)
190
  MAX_CONDITIONINGS = _constants.get('MAX_CONDITIONINGS', 10)
191
  MAX_CONTROLNETS = _constants.get('MAX_CONTROLNETS', 5)
192
+ MAX_IPADAPTERS = _constants.get('MAX_IPADAPTERS', 5)
193
+ LORA_SOURCE_CHOICES = _constants.get('LORA_SOURCE_CHOICES', ["Civitai", "File"])
194
  RESOLUTION_MAP = _constants.get('RESOLUTION_MAP', {})
195
+ ARCHITECTURES_CONFIG = load_architectures_config()
196
+ FEATURES_CONFIG = load_features_config()
197
+ MODEL_DEFAULTS_CONFIG = load_model_defaults()
198
  except Exception as e:
199
  print(f"FATAL: Could not load constants from YAML. Error: {e}")
200
+ MAX_LORAS, MAX_EMBEDDINGS, MAX_CONDITIONINGS, MAX_CONTROLNETS, MAX_IPADAPTERS = 5, 5, 10, 5, 5
201
+ LORA_SOURCE_CHOICES = ["Civitai", "File"]
202
  RESOLUTION_MAP = {}
203
+ ARCHITECTURES_CONFIG = {}
204
+ FEATURES_CONFIG = {}
205
+ MODEL_DEFAULTS_CONFIG = {}
requirements.txt CHANGED
@@ -1,10 +1,10 @@
1
- comfyui-frontend-package==1.42.14
2
- comfyui-workflow-templates==0.9.59
3
- comfyui-embedded-docs==0.4.3
4
- torch==2.10.0
5
  torchsde
6
- torchvision==0.25.0
7
- torchaudio==2.10.0
8
  numpy>=1.25.0
9
  einops
10
  transformers>=4.50.3
@@ -19,11 +19,11 @@ scipy
19
  tqdm
20
  psutil
21
  alembic
22
- SQLAlchemy>=2.0
23
  filelock
24
  av>=14.2.0
25
  comfy-kitchen>=0.2.8
26
- comfy-aimdo>=0.2.12
27
  requests
28
  simpleeval>=1.0.0
29
  blake3
@@ -58,4 +58,5 @@ svglib
58
  trimesh[easy]
59
  yacs
60
  yapf
61
- onnxruntime-gpu
 
 
1
+ comfyui-frontend-package==1.43.18
2
+ comfyui-workflow-templates==0.9.77
3
+ comfyui-embedded-docs==0.5.0
4
+ torch
5
  torchsde
6
+ torchvision
7
+ torchaudio
8
  numpy>=1.25.0
9
  einops
10
  transformers>=4.50.3
 
19
  tqdm
20
  psutil
21
  alembic
22
+ SQLAlchemy>=2.0.0
23
  filelock
24
  av>=14.2.0
25
  comfy-kitchen>=0.2.8
26
+ comfy-aimdo==0.3.0
27
  requests
28
  simpleeval>=1.0.0
29
  blake3
 
58
  trimesh[easy]
59
  yacs
60
  yapf
61
+ onnxruntime-gpu
62
+ diffusers