layerdiffuse
Browse files- ComfyUI/custom_nodes/layerdiffuse/.gitignore +161 -0
- ComfyUI/custom_nodes/layerdiffuse/LICENSE +201 -0
- ComfyUI/custom_nodes/layerdiffuse/README.md +66 -0
- ComfyUI/custom_nodes/layerdiffuse/__init__.py +3 -0
- ComfyUI/custom_nodes/layerdiffuse/examples/layer_diffusion_cond_example.json +668 -0
- ComfyUI/custom_nodes/layerdiffuse/examples/layer_diffusion_cond_fg_all.json +951 -0
- ComfyUI/custom_nodes/layerdiffuse/examples/layer_diffusion_cond_joint_bg.json +723 -0
- ComfyUI/custom_nodes/layerdiffuse/examples/layer_diffusion_cond_joint_fg.json +480 -0
- ComfyUI/custom_nodes/layerdiffuse/examples/layer_diffusion_diff_bg.json +750 -0
- ComfyUI/custom_nodes/layerdiffuse/examples/layer_diffusion_diff_bg_stop_at.json +877 -0
- ComfyUI/custom_nodes/layerdiffuse/examples/layer_diffusion_diff_fg.json +686 -0
- ComfyUI/custom_nodes/layerdiffuse/examples/layer_diffusion_fg_example.json +733 -0
- ComfyUI/custom_nodes/layerdiffuse/examples/layer_diffusion_fg_example_rgba.json +511 -0
- ComfyUI/custom_nodes/layerdiffuse/examples/layer_diffusion_joint.json +703 -0
- ComfyUI/custom_nodes/layerdiffuse/layered_diffusion.py +683 -0
- ComfyUI/custom_nodes/layerdiffuse/lib_layerdiffusion/__init__.py +0 -0
- ComfyUI/custom_nodes/layerdiffuse/lib_layerdiffusion/attention_sharing.py +360 -0
- ComfyUI/custom_nodes/layerdiffuse/lib_layerdiffusion/enums.py +23 -0
- ComfyUI/custom_nodes/layerdiffuse/lib_layerdiffusion/models.py +318 -0
- ComfyUI/custom_nodes/layerdiffuse/lib_layerdiffusion/utils.py +135 -0
- ComfyUI/custom_nodes/layerdiffuse/requirements.txt +2 -0
ComfyUI/custom_nodes/layerdiffuse/.gitignore
ADDED
@@ -0,0 +1,161 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Byte-compiled / optimized / DLL files
|
2 |
+
__pycache__/
|
3 |
+
*.py[cod]
|
4 |
+
*$py.class
|
5 |
+
|
6 |
+
# C extensions
|
7 |
+
*.so
|
8 |
+
|
9 |
+
# Distribution / packaging
|
10 |
+
.Python
|
11 |
+
build/
|
12 |
+
develop-eggs/
|
13 |
+
dist/
|
14 |
+
downloads/
|
15 |
+
eggs/
|
16 |
+
.eggs/
|
17 |
+
lib/
|
18 |
+
lib64/
|
19 |
+
parts/
|
20 |
+
sdist/
|
21 |
+
var/
|
22 |
+
wheels/
|
23 |
+
share/python-wheels/
|
24 |
+
*.egg-info/
|
25 |
+
.installed.cfg
|
26 |
+
*.egg
|
27 |
+
MANIFEST
|
28 |
+
|
29 |
+
# PyInstaller
|
30 |
+
# Usually these files are written by a python script from a template
|
31 |
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
32 |
+
*.manifest
|
33 |
+
*.spec
|
34 |
+
|
35 |
+
# Installer logs
|
36 |
+
pip-log.txt
|
37 |
+
pip-delete-this-directory.txt
|
38 |
+
|
39 |
+
# Unit test / coverage reports
|
40 |
+
htmlcov/
|
41 |
+
.tox/
|
42 |
+
.nox/
|
43 |
+
.coverage
|
44 |
+
.coverage.*
|
45 |
+
.cache
|
46 |
+
nosetests.xml
|
47 |
+
coverage.xml
|
48 |
+
*.cover
|
49 |
+
*.py,cover
|
50 |
+
.hypothesis/
|
51 |
+
.pytest_cache/
|
52 |
+
cover/
|
53 |
+
|
54 |
+
# Translations
|
55 |
+
*.mo
|
56 |
+
*.pot
|
57 |
+
|
58 |
+
# Django stuff:
|
59 |
+
*.log
|
60 |
+
local_settings.py
|
61 |
+
db.sqlite3
|
62 |
+
db.sqlite3-journal
|
63 |
+
|
64 |
+
# Flask stuff:
|
65 |
+
instance/
|
66 |
+
.webassets-cache
|
67 |
+
|
68 |
+
# Scrapy stuff:
|
69 |
+
.scrapy
|
70 |
+
|
71 |
+
# Sphinx documentation
|
72 |
+
docs/_build/
|
73 |
+
|
74 |
+
# PyBuilder
|
75 |
+
.pybuilder/
|
76 |
+
target/
|
77 |
+
|
78 |
+
# Jupyter Notebook
|
79 |
+
.ipynb_checkpoints
|
80 |
+
|
81 |
+
# IPython
|
82 |
+
profile_default/
|
83 |
+
ipython_config.py
|
84 |
+
|
85 |
+
# pyenv
|
86 |
+
# For a library or package, you might want to ignore these files since the code is
|
87 |
+
# intended to run in multiple environments; otherwise, check them in:
|
88 |
+
# .python-version
|
89 |
+
|
90 |
+
# pipenv
|
91 |
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
92 |
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
93 |
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
94 |
+
# install all needed dependencies.
|
95 |
+
#Pipfile.lock
|
96 |
+
|
97 |
+
# poetry
|
98 |
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
99 |
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
100 |
+
# commonly ignored for libraries.
|
101 |
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
102 |
+
#poetry.lock
|
103 |
+
|
104 |
+
# pdm
|
105 |
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
106 |
+
#pdm.lock
|
107 |
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
108 |
+
# in version control.
|
109 |
+
# https://pdm.fming.dev/#use-with-ide
|
110 |
+
.pdm.toml
|
111 |
+
|
112 |
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
113 |
+
__pypackages__/
|
114 |
+
|
115 |
+
# Celery stuff
|
116 |
+
celerybeat-schedule
|
117 |
+
celerybeat.pid
|
118 |
+
|
119 |
+
# SageMath parsed files
|
120 |
+
*.sage.py
|
121 |
+
|
122 |
+
# Environments
|
123 |
+
.env
|
124 |
+
.venv
|
125 |
+
env/
|
126 |
+
venv/
|
127 |
+
ENV/
|
128 |
+
env.bak/
|
129 |
+
venv.bak/
|
130 |
+
|
131 |
+
# Spyder project settings
|
132 |
+
.spyderproject
|
133 |
+
.spyproject
|
134 |
+
|
135 |
+
# Rope project settings
|
136 |
+
.ropeproject
|
137 |
+
|
138 |
+
# mkdocs documentation
|
139 |
+
/site
|
140 |
+
|
141 |
+
# mypy
|
142 |
+
.mypy_cache/
|
143 |
+
.dmypy.json
|
144 |
+
dmypy.json
|
145 |
+
|
146 |
+
# Pyre type checker
|
147 |
+
.pyre/
|
148 |
+
|
149 |
+
# pytype static type analyzer
|
150 |
+
.pytype/
|
151 |
+
|
152 |
+
# Cython debug symbols
|
153 |
+
cython_debug/
|
154 |
+
|
155 |
+
# PyCharm
|
156 |
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
157 |
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
158 |
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
159 |
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
160 |
+
.idea/
|
161 |
+
.vscode/
|
ComfyUI/custom_nodes/layerdiffuse/LICENSE
ADDED
@@ -0,0 +1,201 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Apache License
|
2 |
+
Version 2.0, January 2004
|
3 |
+
http://www.apache.org/licenses/
|
4 |
+
|
5 |
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
6 |
+
|
7 |
+
1. Definitions.
|
8 |
+
|
9 |
+
"License" shall mean the terms and conditions for use, reproduction,
|
10 |
+
and distribution as defined by Sections 1 through 9 of this document.
|
11 |
+
|
12 |
+
"Licensor" shall mean the copyright owner or entity authorized by
|
13 |
+
the copyright owner that is granting the License.
|
14 |
+
|
15 |
+
"Legal Entity" shall mean the union of the acting entity and all
|
16 |
+
other entities that control, are controlled by, or are under common
|
17 |
+
control with that entity. For the purposes of this definition,
|
18 |
+
"control" means (i) the power, direct or indirect, to cause the
|
19 |
+
direction or management of such entity, whether by contract or
|
20 |
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
21 |
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
22 |
+
|
23 |
+
"You" (or "Your") shall mean an individual or Legal Entity
|
24 |
+
exercising permissions granted by this License.
|
25 |
+
|
26 |
+
"Source" form shall mean the preferred form for making modifications,
|
27 |
+
including but not limited to software source code, documentation
|
28 |
+
source, and configuration files.
|
29 |
+
|
30 |
+
"Object" form shall mean any form resulting from mechanical
|
31 |
+
transformation or translation of a Source form, including but
|
32 |
+
not limited to compiled object code, generated documentation,
|
33 |
+
and conversions to other media types.
|
34 |
+
|
35 |
+
"Work" shall mean the work of authorship, whether in Source or
|
36 |
+
Object form, made available under the License, as indicated by a
|
37 |
+
copyright notice that is included in or attached to the work
|
38 |
+
(an example is provided in the Appendix below).
|
39 |
+
|
40 |
+
"Derivative Works" shall mean any work, whether in Source or Object
|
41 |
+
form, that is based on (or derived from) the Work and for which the
|
42 |
+
editorial revisions, annotations, elaborations, or other modifications
|
43 |
+
represent, as a whole, an original work of authorship. For the purposes
|
44 |
+
of this License, Derivative Works shall not include works that remain
|
45 |
+
separable from, or merely link (or bind by name) to the interfaces of,
|
46 |
+
the Work and Derivative Works thereof.
|
47 |
+
|
48 |
+
"Contribution" shall mean any work of authorship, including
|
49 |
+
the original version of the Work and any modifications or additions
|
50 |
+
to that Work or Derivative Works thereof, that is intentionally
|
51 |
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
52 |
+
or by an individual or Legal Entity authorized to submit on behalf of
|
53 |
+
the copyright owner. For the purposes of this definition, "submitted"
|
54 |
+
means any form of electronic, verbal, or written communication sent
|
55 |
+
to the Licensor or its representatives, including but not limited to
|
56 |
+
communication on electronic mailing lists, source code control systems,
|
57 |
+
and issue tracking systems that are managed by, or on behalf of, the
|
58 |
+
Licensor for the purpose of discussing and improving the Work, but
|
59 |
+
excluding communication that is conspicuously marked or otherwise
|
60 |
+
designated in writing by the copyright owner as "Not a Contribution."
|
61 |
+
|
62 |
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
63 |
+
on behalf of whom a Contribution has been received by Licensor and
|
64 |
+
subsequently incorporated within the Work.
|
65 |
+
|
66 |
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
67 |
+
this License, each Contributor hereby grants to You a perpetual,
|
68 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
69 |
+
copyright license to reproduce, prepare Derivative Works of,
|
70 |
+
publicly display, publicly perform, sublicense, and distribute the
|
71 |
+
Work and such Derivative Works in Source or Object form.
|
72 |
+
|
73 |
+
3. Grant of Patent License. Subject to the terms and conditions of
|
74 |
+
this License, each Contributor hereby grants to You a perpetual,
|
75 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
76 |
+
(except as stated in this section) patent license to make, have made,
|
77 |
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
78 |
+
where such license applies only to those patent claims licensable
|
79 |
+
by such Contributor that are necessarily infringed by their
|
80 |
+
Contribution(s) alone or by combination of their Contribution(s)
|
81 |
+
with the Work to which such Contribution(s) was submitted. If You
|
82 |
+
institute patent litigation against any entity (including a
|
83 |
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
84 |
+
or a Contribution incorporated within the Work constitutes direct
|
85 |
+
or contributory patent infringement, then any patent licenses
|
86 |
+
granted to You under this License for that Work shall terminate
|
87 |
+
as of the date such litigation is filed.
|
88 |
+
|
89 |
+
4. Redistribution. You may reproduce and distribute copies of the
|
90 |
+
Work or Derivative Works thereof in any medium, with or without
|
91 |
+
modifications, and in Source or Object form, provided that You
|
92 |
+
meet the following conditions:
|
93 |
+
|
94 |
+
(a) You must give any other recipients of the Work or
|
95 |
+
Derivative Works a copy of this License; and
|
96 |
+
|
97 |
+
(b) You must cause any modified files to carry prominent notices
|
98 |
+
stating that You changed the files; and
|
99 |
+
|
100 |
+
(c) You must retain, in the Source form of any Derivative Works
|
101 |
+
that You distribute, all copyright, patent, trademark, and
|
102 |
+
attribution notices from the Source form of the Work,
|
103 |
+
excluding those notices that do not pertain to any part of
|
104 |
+
the Derivative Works; and
|
105 |
+
|
106 |
+
(d) If the Work includes a "NOTICE" text file as part of its
|
107 |
+
distribution, then any Derivative Works that You distribute must
|
108 |
+
include a readable copy of the attribution notices contained
|
109 |
+
within such NOTICE file, excluding those notices that do not
|
110 |
+
pertain to any part of the Derivative Works, in at least one
|
111 |
+
of the following places: within a NOTICE text file distributed
|
112 |
+
as part of the Derivative Works; within the Source form or
|
113 |
+
documentation, if provided along with the Derivative Works; or,
|
114 |
+
within a display generated by the Derivative Works, if and
|
115 |
+
wherever such third-party notices normally appear. The contents
|
116 |
+
of the NOTICE file are for informational purposes only and
|
117 |
+
do not modify the License. You may add Your own attribution
|
118 |
+
notices within Derivative Works that You distribute, alongside
|
119 |
+
or as an addendum to the NOTICE text from the Work, provided
|
120 |
+
that such additional attribution notices cannot be construed
|
121 |
+
as modifying the License.
|
122 |
+
|
123 |
+
You may add Your own copyright statement to Your modifications and
|
124 |
+
may provide additional or different license terms and conditions
|
125 |
+
for use, reproduction, or distribution of Your modifications, or
|
126 |
+
for any such Derivative Works as a whole, provided Your use,
|
127 |
+
reproduction, and distribution of the Work otherwise complies with
|
128 |
+
the conditions stated in this License.
|
129 |
+
|
130 |
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
131 |
+
any Contribution intentionally submitted for inclusion in the Work
|
132 |
+
by You to the Licensor shall be under the terms and conditions of
|
133 |
+
this License, without any additional terms or conditions.
|
134 |
+
Notwithstanding the above, nothing herein shall supersede or modify
|
135 |
+
the terms of any separate license agreement you may have executed
|
136 |
+
with Licensor regarding such Contributions.
|
137 |
+
|
138 |
+
6. Trademarks. This License does not grant permission to use the trade
|
139 |
+
names, trademarks, service marks, or product names of the Licensor,
|
140 |
+
except as required for reasonable and customary use in describing the
|
141 |
+
origin of the Work and reproducing the content of the NOTICE file.
|
142 |
+
|
143 |
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
144 |
+
agreed to in writing, Licensor provides the Work (and each
|
145 |
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
146 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
147 |
+
implied, including, without limitation, any warranties or conditions
|
148 |
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
149 |
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
150 |
+
appropriateness of using or redistributing the Work and assume any
|
151 |
+
risks associated with Your exercise of permissions under this License.
|
152 |
+
|
153 |
+
8. Limitation of Liability. In no event and under no legal theory,
|
154 |
+
whether in tort (including negligence), contract, or otherwise,
|
155 |
+
unless required by applicable law (such as deliberate and grossly
|
156 |
+
negligent acts) or agreed to in writing, shall any Contributor be
|
157 |
+
liable to You for damages, including any direct, indirect, special,
|
158 |
+
incidental, or consequential damages of any character arising as a
|
159 |
+
result of this License or out of the use or inability to use the
|
160 |
+
Work (including but not limited to damages for loss of goodwill,
|
161 |
+
work stoppage, computer failure or malfunction, or any and all
|
162 |
+
other commercial damages or losses), even if such Contributor
|
163 |
+
has been advised of the possibility of such damages.
|
164 |
+
|
165 |
+
9. Accepting Warranty or Additional Liability. While redistributing
|
166 |
+
the Work or Derivative Works thereof, You may choose to offer,
|
167 |
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
168 |
+
or other liability obligations and/or rights consistent with this
|
169 |
+
License. However, in accepting such obligations, You may act only
|
170 |
+
on Your own behalf and on Your sole responsibility, not on behalf
|
171 |
+
of any other Contributor, and only if You agree to indemnify,
|
172 |
+
defend, and hold each Contributor harmless for any liability
|
173 |
+
incurred by, or claims asserted against, such Contributor by reason
|
174 |
+
of your accepting any such warranty or additional liability.
|
175 |
+
|
176 |
+
END OF TERMS AND CONDITIONS
|
177 |
+
|
178 |
+
APPENDIX: How to apply the Apache License to your work.
|
179 |
+
|
180 |
+
To apply the Apache License to your work, attach the following
|
181 |
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
182 |
+
replaced with your own identifying information. (Don't include
|
183 |
+
the brackets!) The text should be enclosed in the appropriate
|
184 |
+
comment syntax for the file format. We also recommend that a
|
185 |
+
file or class name and description of purpose be included on the
|
186 |
+
same "printed page" as the copyright notice for easier
|
187 |
+
identification within third-party archives.
|
188 |
+
|
189 |
+
Copyright [yyyy] [name of copyright owner]
|
190 |
+
|
191 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
192 |
+
you may not use this file except in compliance with the License.
|
193 |
+
You may obtain a copy of the License at
|
194 |
+
|
195 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
196 |
+
|
197 |
+
Unless required by applicable law or agreed to in writing, software
|
198 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
199 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
200 |
+
See the License for the specific language governing permissions and
|
201 |
+
limitations under the License.
|
ComfyUI/custom_nodes/layerdiffuse/README.md
ADDED
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# ComfyUI-layerdiffuse
|
2 |
+
ComfyUI implementation of https://github.com/layerdiffusion/LayerDiffuse.
|
3 |
+
|
4 |
+
## Installation
|
5 |
+
Download the repository and unpack into the custom_nodes folder in the ComfyUI installation directory.
|
6 |
+
|
7 |
+
Or clone via GIT, starting from ComfyUI installation directory:
|
8 |
+
```bash
|
9 |
+
cd custom_nodes
|
10 |
+
git clone git@github.com:huchenlei/ComfyUI-layerdiffuse.git
|
11 |
+
```
|
12 |
+
|
13 |
+
Run `pip install -r requirements.txt` to install python dependencies. You might experience version conflict on diffusers if you have other extensions
|
14 |
+
that depends on other versions of diffusers. In this case, it is recommended to setup separate Python venvs.
|
15 |
+
|
16 |
+
## Workflows
|
17 |
+
### [Generate foreground](https://github.com/huchenlei/ComfyUI-layerdiffuse/blob/main/examples/layer_diffusion_fg_example_rgba.json)
|
18 |
+
![rgba](https://github.com/huchenlei/ComfyUI-layerdiffuse/assets/20929282/5e6085e5-d997-4a0a-b589-257d65eb1eb2)
|
19 |
+
|
20 |
+
### [Generate foreground (RGB + alpha)](https://github.com/huchenlei/ComfyUI-layerdiffuse/blob/main/examples/layer_diffusion_fg_example.json)
|
21 |
+
If you want more control of getting RGB image and alpha channel mask separately, you can use this workflow.
|
22 |
+
![readme1](https://github.com/huchenlei/ComfyUI-layerdiffuse/assets/20929282/4825b81c-7089-4806-bce7-777229421707)
|
23 |
+
|
24 |
+
### [Blending (FG/BG)](https://github.com/huchenlei/ComfyUI-layerdiffuse/blob/main/examples/layer_diffusion_cond_example.json)
|
25 |
+
Blending given FG
|
26 |
+
![fg_cond](https://github.com/huchenlei/ComfyUI-layerdiffuse/assets/20929282/7f7dee80-6e57-4570-b304-d1f7e5dc3aad)
|
27 |
+
|
28 |
+
Blending given BG
|
29 |
+
![bg_cond](https://github.com/huchenlei/ComfyUI-layerdiffuse/assets/20929282/e3a79218-6123-453b-a54b-2f338db1c12d)
|
30 |
+
|
31 |
+
### [Extract FG from Blended + BG](https://github.com/huchenlei/ComfyUI-layerdiffuse/blob/main/examples/layer_diffusion_diff_fg.json)
|
32 |
+
![diff_bg](https://github.com/huchenlei/ComfyUI-layerdiffuse/assets/20929282/45c7207d-72ff-4fb0-9c91-687040781837)
|
33 |
+
|
34 |
+
### [Extract BG from Blended + FG](https://github.com/huchenlei/ComfyUI-layerdiffuse/blob/main/examples/layer_diffusion_diff_bg.json)
|
35 |
+
[Forge impl's sanity check](https://github.com/layerdiffuse/sd-forge-layerdiffuse#sanity-check) sets `Stop at` to 0.5 to get better quality BG.
|
36 |
+
This workflow might be inferior comparing to other object removal workflows.
|
37 |
+
![diff_fg](https://github.com/huchenlei/ComfyUI-layerdiffuse/assets/20929282/05a10add-68b0-473a-acee-5853e4720322)
|
38 |
+
|
39 |
+
### [Extract BG from Blended + FG (Stop at 0.5)](https://github.com/huchenlei/ComfyUI-layerdiffuse/blob/main/examples/layer_diffusion_diff_bg_stop_at.json)
|
40 |
+
In [SD Forge impl](https://github.com/layerdiffuse/sd-forge-layerdiffuse), there is a `stop at` param that determines when
|
41 |
+
layer diffuse should stop in the denosing process. In the background, what this param does is unapply the LoRA and c_concat cond after a certain step
|
42 |
+
threshold. This is hard/risky to implement directly in ComfyUI as it requires manually load a model that has every changes except the layer diffusion
|
43 |
+
change applied. A workaround in ComfyUI is to have another img2img pass on the layer diffuse result to simulate the effect of `stop at` param.
|
44 |
+
![diff_fg_stop_at](https://github.com/huchenlei/ComfyUI-layerdiffuse/assets/20929282/e383c9d3-2d47-40c2-b764-b0bd48243ee8)
|
45 |
+
|
46 |
+
|
47 |
+
### [Generate FG from BG combined](https://github.com/huchenlei/ComfyUI-layerdiffuse/blob/main/examples/layer_diffusion_cond_fg_all.json)
|
48 |
+
Combines previous workflows to generate blended and FG given BG. We found that there are some color variations in the extracted FG. Need to confirm
|
49 |
+
with layer diffusion authors on whether this is expected.
|
50 |
+
![fg_all](https://github.com/huchenlei/ComfyUI-layerdiffuse/assets/20929282/f4c18585-961a-473a-a616-aa3776bacd41)
|
51 |
+
|
52 |
+
### [2024-3-9] [Generate FG + Blended given BG](https://github.com/huchenlei/ComfyUI-layerdiffuse/blob/main/examples/layer_diffusion_cond_joint_bg.json)
|
53 |
+
Need batch size = 2N. Currently only for SD15.
|
54 |
+
![sd15_cond_joint_bg](https://github.com/huchenlei/ComfyUI-layerdiffuse/assets/20929282/9bbfe5c1-14a0-421d-bf06-85e301bf8065)
|
55 |
+
|
56 |
+
### [2024-3-9] [Generate BG + Blended given FG](https://github.com/huchenlei/ComfyUI-layerdiffuse/blob/main/examples/layer_diffusion_cond_joint_fg.json)
|
57 |
+
Need batch size = 2N. Currently only for SD15.
|
58 |
+
![sd15_cond_joint_fg](https://github.com/huchenlei/ComfyUI-layerdiffuse/assets/20929282/65af8b38-cf4c-4667-b76f-3013a0be0a48)
|
59 |
+
|
60 |
+
### [2024-3-9] [Generate BG + FG + Blended together](https://github.com/huchenlei/ComfyUI-layerdiffuse/blob/main/examples/layer_diffusion_joint.json)
|
61 |
+
Need batch size = 3N. Currently only for SD15.
|
62 |
+
![sd15_joint](https://github.com/huchenlei/ComfyUI-layerdiffuse/assets/20929282/e5545809-e3fb-4683-acf5-8728195cb2bc)
|
63 |
+
|
64 |
+
## Note
|
65 |
+
- Currently only SDXL/SD15 are supported. See https://github.com/layerdiffuse/sd-forge-layerdiffuse#model-notes for more details.
|
66 |
+
- To decode RGBA result, the generation dimension must be multiple of 64. Otherwise, you will get decode error: ![image](https://github.com/huchenlei/ComfyUI-layerdiffuse/assets/20929282/ff055f99-9297-4ff1-9a33-065aaadcf98e)
|
ComfyUI/custom_nodes/layerdiffuse/__init__.py
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
from .layered_diffusion import NODE_CLASS_MAPPINGS, NODE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+
"mode": 0,
|
19 |
+
"outputs": [
|
20 |
+
{
|
21 |
+
"name": "MODEL",
|
22 |
+
"type": "MODEL",
|
23 |
+
"links": [
|
24 |
+
38
|
25 |
+
],
|
26 |
+
"slot_index": 0
|
27 |
+
},
|
28 |
+
{
|
29 |
+
"name": "CLIP",
|
30 |
+
"type": "CLIP",
|
31 |
+
"links": [
|
32 |
+
3,
|
33 |
+
5
|
34 |
+
],
|
35 |
+
"slot_index": 1
|
36 |
+
},
|
37 |
+
{
|
38 |
+
"name": "VAE",
|
39 |
+
"type": "VAE",
|
40 |
+
"links": [
|
41 |
+
22,
|
42 |
+
49
|
43 |
+
],
|
44 |
+
"slot_index": 2
|
45 |
+
}
|
46 |
+
],
|
47 |
+
"properties": {
|
48 |
+
"Node name for S&R": "CheckpointLoaderSimple"
|
49 |
+
},
|
50 |
+
"widgets_values": [
|
51 |
+
"juggernautXL_v8Rundiffusion.safetensors"
|
52 |
+
]
|
53 |
+
},
|
54 |
+
{
|
55 |
+
"id": 29,
|
56 |
+
"type": "VAEEncode",
|
57 |
+
"pos": [
|
58 |
+
212,
|
59 |
+
-22
|
60 |
+
],
|
61 |
+
"size": {
|
62 |
+
"0": 210,
|
63 |
+
"1": 46
|
64 |
+
},
|
65 |
+
"flags": {},
|
66 |
+
"order": 6,
|
67 |
+
"mode": 0,
|
68 |
+
"inputs": [
|
69 |
+
{
|
70 |
+
"name": "pixels",
|
71 |
+
"type": "IMAGE",
|
72 |
+
"link": 51
|
73 |
+
},
|
74 |
+
{
|
75 |
+
"name": "vae",
|
76 |
+
"type": "VAE",
|
77 |
+
"link": 49,
|
78 |
+
"slot_index": 1
|
79 |
+
}
|
80 |
+
],
|
81 |
+
"outputs": [
|
82 |
+
{
|
83 |
+
"name": "LATENT",
|
84 |
+
"type": "LATENT",
|
85 |
+
"links": [
|
86 |
+
47
|
87 |
+
],
|
88 |
+
"shape": 3,
|
89 |
+
"slot_index": 0
|
90 |
+
}
|
91 |
+
],
|
92 |
+
"properties": {
|
93 |
+
"Node name for S&R": "VAEEncode"
|
94 |
+
}
|
95 |
+
},
|
96 |
+
{
|
97 |
+
"id": 30,
|
98 |
+
"type": "LoadImage",
|
99 |
+
"pos": [
|
100 |
+
-363,
|
101 |
+
209
|
102 |
+
],
|
103 |
+
"size": {
|
104 |
+
"0": 315,
|
105 |
+
"1": 314
|
106 |
+
},
|
107 |
+
"flags": {},
|
108 |
+
"order": 1,
|
109 |
+
"mode": 0,
|
110 |
+
"outputs": [
|
111 |
+
{
|
112 |
+
"name": "IMAGE",
|
113 |
+
"type": "IMAGE",
|
114 |
+
"links": [
|
115 |
+
50
|
116 |
+
],
|
117 |
+
"shape": 3,
|
118 |
+
"slot_index": 0
|
119 |
+
},
|
120 |
+
{
|
121 |
+
"name": "MASK",
|
122 |
+
"type": "MASK",
|
123 |
+
"links": null,
|
124 |
+
"shape": 3
|
125 |
+
}
|
126 |
+
],
|
127 |
+
"properties": {
|
128 |
+
"Node name for S&R": "LoadImage"
|
129 |
+
},
|
130 |
+
"widgets_values": [
|
131 |
+
"309219693-e7e2d80e-ffbe-4724-812a-5139a88027e3.png",
|
132 |
+
"image"
|
133 |
+
]
|
134 |
+
},
|
135 |
+
{
|
136 |
+
"id": 20,
|
137 |
+
"type": "PreviewImage",
|
138 |
+
"pos": [
|
139 |
+
1556,
|
140 |
+
138
|
141 |
+
],
|
142 |
+
"size": {
|
143 |
+
"0": 611.2340087890625,
|
144 |
+
"1": 633.9354858398438
|
145 |
+
},
|
146 |
+
"flags": {},
|
147 |
+
"order": 11,
|
148 |
+
"mode": 0,
|
149 |
+
"inputs": [
|
150 |
+
{
|
151 |
+
"name": "images",
|
152 |
+
"type": "IMAGE",
|
153 |
+
"link": 29
|
154 |
+
}
|
155 |
+
],
|
156 |
+
"properties": {
|
157 |
+
"Node name for S&R": "PreviewImage"
|
158 |
+
}
|
159 |
+
},
|
160 |
+
{
|
161 |
+
"id": 6,
|
162 |
+
"type": "CLIPTextEncode",
|
163 |
+
"pos": [
|
164 |
+
415,
|
165 |
+
186
|
166 |
+
],
|
167 |
+
"size": {
|
168 |
+
"0": 422.84503173828125,
|
169 |
+
"1": 164.31304931640625
|
170 |
+
},
|
171 |
+
"flags": {},
|
172 |
+
"order": 3,
|
173 |
+
"mode": 0,
|
174 |
+
"inputs": [
|
175 |
+
{
|
176 |
+
"name": "clip",
|
177 |
+
"type": "CLIP",
|
178 |
+
"link": 3
|
179 |
+
}
|
180 |
+
],
|
181 |
+
"outputs": [
|
182 |
+
{
|
183 |
+
"name": "CONDITIONING",
|
184 |
+
"type": "CONDITIONING",
|
185 |
+
"links": [
|
186 |
+
39
|
187 |
+
],
|
188 |
+
"slot_index": 0
|
189 |
+
}
|
190 |
+
],
|
191 |
+
"properties": {
|
192 |
+
"Node name for S&R": "CLIPTextEncode"
|
193 |
+
},
|
194 |
+
"widgets_values": [
|
195 |
+
"old man sitting, high quality\n\n"
|
196 |
+
]
|
197 |
+
},
|
198 |
+
{
|
199 |
+
"id": 7,
|
200 |
+
"type": "CLIPTextEncode",
|
201 |
+
"pos": [
|
202 |
+
413,
|
203 |
+
389
|
204 |
+
],
|
205 |
+
"size": {
|
206 |
+
"0": 425.27801513671875,
|
207 |
+
"1": 180.6060791015625
|
208 |
+
},
|
209 |
+
"flags": {},
|
210 |
+
"order": 4,
|
211 |
+
"mode": 0,
|
212 |
+
"inputs": [
|
213 |
+
{
|
214 |
+
"name": "clip",
|
215 |
+
"type": "CLIP",
|
216 |
+
"link": 5
|
217 |
+
}
|
218 |
+
],
|
219 |
+
"outputs": [
|
220 |
+
{
|
221 |
+
"name": "CONDITIONING",
|
222 |
+
"type": "CONDITIONING",
|
223 |
+
"links": [
|
224 |
+
40
|
225 |
+
],
|
226 |
+
"slot_index": 0
|
227 |
+
}
|
228 |
+
],
|
229 |
+
"properties": {
|
230 |
+
"Node name for S&R": "CLIPTextEncode"
|
231 |
+
},
|
232 |
+
"widgets_values": [
|
233 |
+
"text, watermark"
|
234 |
+
]
|
235 |
+
},
|
236 |
+
{
|
237 |
+
"id": 34,
|
238 |
+
"type": "PreviewImage",
|
239 |
+
"pos": [
|
240 |
+
213,
|
241 |
+
-346
|
242 |
+
],
|
243 |
+
"size": {
|
244 |
+
"0": 210,
|
245 |
+
"1": 246
|
246 |
+
},
|
247 |
+
"flags": {},
|
248 |
+
"order": 7,
|
249 |
+
"mode": 0,
|
250 |
+
"inputs": [
|
251 |
+
{
|
252 |
+
"name": "images",
|
253 |
+
"type": "IMAGE",
|
254 |
+
"link": 52
|
255 |
+
}
|
256 |
+
],
|
257 |
+
"properties": {
|
258 |
+
"Node name for S&R": "PreviewImage"
|
259 |
+
}
|
260 |
+
},
|
261 |
+
{
|
262 |
+
"id": 14,
|
263 |
+
"type": "VAEDecode",
|
264 |
+
"pos": [
|
265 |
+
1275,
|
266 |
+
198
|
267 |
+
],
|
268 |
+
"size": {
|
269 |
+
"0": 210,
|
270 |
+
"1": 46
|
271 |
+
},
|
272 |
+
"flags": {},
|
273 |
+
"order": 10,
|
274 |
+
"mode": 0,
|
275 |
+
"inputs": [
|
276 |
+
{
|
277 |
+
"name": "samples",
|
278 |
+
"type": "LATENT",
|
279 |
+
"link": 21
|
280 |
+
},
|
281 |
+
{
|
282 |
+
"name": "vae",
|
283 |
+
"type": "VAE",
|
284 |
+
"link": 22,
|
285 |
+
"slot_index": 1
|
286 |
+
}
|
287 |
+
],
|
288 |
+
"outputs": [
|
289 |
+
{
|
290 |
+
"name": "IMAGE",
|
291 |
+
"type": "IMAGE",
|
292 |
+
"links": [
|
293 |
+
29
|
294 |
+
],
|
295 |
+
"shape": 3,
|
296 |
+
"slot_index": 0
|
297 |
+
}
|
298 |
+
],
|
299 |
+
"properties": {
|
300 |
+
"Node name for S&R": "VAEDecode"
|
301 |
+
}
|
302 |
+
},
|
303 |
+
{
|
304 |
+
"id": 3,
|
305 |
+
"type": "KSampler",
|
306 |
+
"pos": [
|
307 |
+
913,
|
308 |
+
181
|
309 |
+
],
|
310 |
+
"size": {
|
311 |
+
"0": 315,
|
312 |
+
"1": 262
|
313 |
+
},
|
314 |
+
"flags": {},
|
315 |
+
"order": 9,
|
316 |
+
"mode": 0,
|
317 |
+
"inputs": [
|
318 |
+
{
|
319 |
+
"name": "model",
|
320 |
+
"type": "MODEL",
|
321 |
+
"link": 41
|
322 |
+
},
|
323 |
+
{
|
324 |
+
"name": "positive",
|
325 |
+
"type": "CONDITIONING",
|
326 |
+
"link": 46
|
327 |
+
},
|
328 |
+
{
|
329 |
+
"name": "negative",
|
330 |
+
"type": "CONDITIONING",
|
331 |
+
"link": 45
|
332 |
+
},
|
333 |
+
{
|
334 |
+
"name": "latent_image",
|
335 |
+
"type": "LATENT",
|
336 |
+
"link": 2
|
337 |
+
}
|
338 |
+
],
|
339 |
+
"outputs": [
|
340 |
+
{
|
341 |
+
"name": "LATENT",
|
342 |
+
"type": "LATENT",
|
343 |
+
"links": [
|
344 |
+
21
|
345 |
+
],
|
346 |
+
"slot_index": 0
|
347 |
+
}
|
348 |
+
],
|
349 |
+
"properties": {
|
350 |
+
"Node name for S&R": "KSampler"
|
351 |
+
},
|
352 |
+
"widgets_values": [
|
353 |
+
100676796092754,
|
354 |
+
"randomize",
|
355 |
+
20,
|
356 |
+
8,
|
357 |
+
"euler",
|
358 |
+
"normal",
|
359 |
+
1
|
360 |
+
]
|
361 |
+
},
|
362 |
+
{
|
363 |
+
"id": 5,
|
364 |
+
"type": "EmptyLatentImage",
|
365 |
+
"pos": [
|
366 |
+
475,
|
367 |
+
666
|
368 |
+
],
|
369 |
+
"size": {
|
370 |
+
"0": 315,
|
371 |
+
"1": 106
|
372 |
+
},
|
373 |
+
"flags": {},
|
374 |
+
"order": 2,
|
375 |
+
"mode": 0,
|
376 |
+
"outputs": [
|
377 |
+
{
|
378 |
+
"name": "LATENT",
|
379 |
+
"type": "LATENT",
|
380 |
+
"links": [
|
381 |
+
2
|
382 |
+
],
|
383 |
+
"slot_index": 0
|
384 |
+
}
|
385 |
+
],
|
386 |
+
"properties": {
|
387 |
+
"Node name for S&R": "EmptyLatentImage"
|
388 |
+
},
|
389 |
+
"widgets_values": [
|
390 |
+
1024,
|
391 |
+
1024,
|
392 |
+
1
|
393 |
+
]
|
394 |
+
},
|
395 |
+
{
|
396 |
+
"id": 33,
|
397 |
+
"type": "ImageResize+",
|
398 |
+
"pos": [
|
399 |
+
-146,
|
400 |
+
-16
|
401 |
+
],
|
402 |
+
"size": {
|
403 |
+
"0": 315,
|
404 |
+
"1": 170
|
405 |
+
},
|
406 |
+
"flags": {},
|
407 |
+
"order": 5,
|
408 |
+
"mode": 0,
|
409 |
+
"inputs": [
|
410 |
+
{
|
411 |
+
"name": "image",
|
412 |
+
"type": "IMAGE",
|
413 |
+
"link": 50
|
414 |
+
}
|
415 |
+
],
|
416 |
+
"outputs": [
|
417 |
+
{
|
418 |
+
"name": "IMAGE",
|
419 |
+
"type": "IMAGE",
|
420 |
+
"links": [
|
421 |
+
51,
|
422 |
+
52
|
423 |
+
],
|
424 |
+
"shape": 3,
|
425 |
+
"slot_index": 0
|
426 |
+
},
|
427 |
+
{
|
428 |
+
"name": "width",
|
429 |
+
"type": "INT",
|
430 |
+
"links": null,
|
431 |
+
"shape": 3
|
432 |
+
},
|
433 |
+
{
|
434 |
+
"name": "height",
|
435 |
+
"type": "INT",
|
436 |
+
"links": null,
|
437 |
+
"shape": 3
|
438 |
+
}
|
439 |
+
],
|
440 |
+
"properties": {
|
441 |
+
"Node name for S&R": "ImageResize+"
|
442 |
+
},
|
443 |
+
"widgets_values": [
|
444 |
+
1024,
|
445 |
+
1024,
|
446 |
+
"nearest",
|
447 |
+
false
|
448 |
+
]
|
449 |
+
},
|
450 |
+
{
|
451 |
+
"id": 28,
|
452 |
+
"type": "LayeredDiffusionCondApply",
|
453 |
+
"pos": [
|
454 |
+
465,
|
455 |
+
-26
|
456 |
+
],
|
457 |
+
"size": {
|
458 |
+
"0": 315,
|
459 |
+
"1": 142
|
460 |
+
},
|
461 |
+
"flags": {},
|
462 |
+
"order": 8,
|
463 |
+
"mode": 0,
|
464 |
+
"inputs": [
|
465 |
+
{
|
466 |
+
"name": "model",
|
467 |
+
"type": "MODEL",
|
468 |
+
"link": 38
|
469 |
+
},
|
470 |
+
{
|
471 |
+
"name": "cond",
|
472 |
+
"type": "CONDITIONING",
|
473 |
+
"link": 39
|
474 |
+
},
|
475 |
+
{
|
476 |
+
"name": "uncond",
|
477 |
+
"type": "CONDITIONING",
|
478 |
+
"link": 40
|
479 |
+
},
|
480 |
+
{
|
481 |
+
"name": "latent",
|
482 |
+
"type": "LATENT",
|
483 |
+
"link": 47
|
484 |
+
}
|
485 |
+
],
|
486 |
+
"outputs": [
|
487 |
+
{
|
488 |
+
"name": "MODEL",
|
489 |
+
"type": "MODEL",
|
490 |
+
"links": [
|
491 |
+
41
|
492 |
+
],
|
493 |
+
"shape": 3,
|
494 |
+
"slot_index": 0
|
495 |
+
},
|
496 |
+
{
|
497 |
+
"name": "CONDITIONING",
|
498 |
+
"type": "CONDITIONING",
|
499 |
+
"links": [
|
500 |
+
46
|
501 |
+
],
|
502 |
+
"shape": 3,
|
503 |
+
"slot_index": 1
|
504 |
+
},
|
505 |
+
{
|
506 |
+
"name": "CONDITIONING",
|
507 |
+
"type": "CONDITIONING",
|
508 |
+
"links": [
|
509 |
+
45
|
510 |
+
],
|
511 |
+
"shape": 3,
|
512 |
+
"slot_index": 2
|
513 |
+
}
|
514 |
+
],
|
515 |
+
"properties": {
|
516 |
+
"Node name for S&R": "LayeredDiffusionCondApply"
|
517 |
+
},
|
518 |
+
"widgets_values": [
|
519 |
+
"SDXL, Background",
|
520 |
+
1
|
521 |
+
],
|
522 |
+
"color": "#232",
|
523 |
+
"bgcolor": "#353"
|
524 |
+
}
|
525 |
+
],
|
526 |
+
"links": [
|
527 |
+
[
|
528 |
+
2,
|
529 |
+
5,
|
530 |
+
0,
|
531 |
+
3,
|
532 |
+
3,
|
533 |
+
"LATENT"
|
534 |
+
],
|
535 |
+
[
|
536 |
+
3,
|
537 |
+
4,
|
538 |
+
1,
|
539 |
+
6,
|
540 |
+
0,
|
541 |
+
"CLIP"
|
542 |
+
],
|
543 |
+
[
|
544 |
+
5,
|
545 |
+
4,
|
546 |
+
1,
|
547 |
+
7,
|
548 |
+
0,
|
549 |
+
"CLIP"
|
550 |
+
],
|
551 |
+
[
|
552 |
+
21,
|
553 |
+
3,
|
554 |
+
0,
|
555 |
+
14,
|
556 |
+
0,
|
557 |
+
"LATENT"
|
558 |
+
],
|
559 |
+
[
|
560 |
+
22,
|
561 |
+
4,
|
562 |
+
2,
|
563 |
+
14,
|
564 |
+
1,
|
565 |
+
"VAE"
|
566 |
+
],
|
567 |
+
[
|
568 |
+
29,
|
569 |
+
14,
|
570 |
+
0,
|
571 |
+
20,
|
572 |
+
0,
|
573 |
+
"IMAGE"
|
574 |
+
],
|
575 |
+
[
|
576 |
+
38,
|
577 |
+
4,
|
578 |
+
0,
|
579 |
+
28,
|
580 |
+
0,
|
581 |
+
"MODEL"
|
582 |
+
],
|
583 |
+
[
|
584 |
+
39,
|
585 |
+
6,
|
586 |
+
0,
|
587 |
+
28,
|
588 |
+
1,
|
589 |
+
"CONDITIONING"
|
590 |
+
],
|
591 |
+
[
|
592 |
+
40,
|
593 |
+
7,
|
594 |
+
0,
|
595 |
+
28,
|
596 |
+
2,
|
597 |
+
"CONDITIONING"
|
598 |
+
],
|
599 |
+
[
|
600 |
+
41,
|
601 |
+
28,
|
602 |
+
0,
|
603 |
+
3,
|
604 |
+
0,
|
605 |
+
"MODEL"
|
606 |
+
],
|
607 |
+
[
|
608 |
+
45,
|
609 |
+
28,
|
610 |
+
2,
|
611 |
+
3,
|
612 |
+
2,
|
613 |
+
"CONDITIONING"
|
614 |
+
],
|
615 |
+
[
|
616 |
+
46,
|
617 |
+
28,
|
618 |
+
1,
|
619 |
+
3,
|
620 |
+
1,
|
621 |
+
"CONDITIONING"
|
622 |
+
],
|
623 |
+
[
|
624 |
+
47,
|
625 |
+
29,
|
626 |
+
0,
|
627 |
+
28,
|
628 |
+
3,
|
629 |
+
"LATENT"
|
630 |
+
],
|
631 |
+
[
|
632 |
+
49,
|
633 |
+
4,
|
634 |
+
2,
|
635 |
+
29,
|
636 |
+
1,
|
637 |
+
"VAE"
|
638 |
+
],
|
639 |
+
[
|
640 |
+
50,
|
641 |
+
30,
|
642 |
+
0,
|
643 |
+
33,
|
644 |
+
0,
|
645 |
+
"IMAGE"
|
646 |
+
],
|
647 |
+
[
|
648 |
+
51,
|
649 |
+
33,
|
650 |
+
0,
|
651 |
+
29,
|
652 |
+
0,
|
653 |
+
"IMAGE"
|
654 |
+
],
|
655 |
+
[
|
656 |
+
52,
|
657 |
+
33,
|
658 |
+
0,
|
659 |
+
34,
|
660 |
+
0,
|
661 |
+
"IMAGE"
|
662 |
+
]
|
663 |
+
],
|
664 |
+
"groups": [],
|
665 |
+
"config": {},
|
666 |
+
"extra": {},
|
667 |
+
"version": 0.4
|
668 |
+
}
|
ComfyUI/custom_nodes/layerdiffuse/examples/layer_diffusion_cond_fg_all.json
ADDED
@@ -0,0 +1,951 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"last_node_id": 56,
|
3 |
+
"last_link_id": 104,
|
4 |
+
"nodes": [
|
5 |
+
{
|
6 |
+
"id": 14,
|
7 |
+
"type": "VAEDecode",
|
8 |
+
"pos": [
|
9 |
+
1286,
|
10 |
+
187
|
11 |
+
],
|
12 |
+
"size": {
|
13 |
+
"0": 210,
|
14 |
+
"1": 46
|
15 |
+
},
|
16 |
+
"flags": {},
|
17 |
+
"order": 12,
|
18 |
+
"mode": 0,
|
19 |
+
"inputs": [
|
20 |
+
{
|
21 |
+
"name": "samples",
|
22 |
+
"type": "LATENT",
|
23 |
+
"link": 21
|
24 |
+
},
|
25 |
+
{
|
26 |
+
"name": "vae",
|
27 |
+
"type": "VAE",
|
28 |
+
"link": 22,
|
29 |
+
"slot_index": 1
|
30 |
+
}
|
31 |
+
],
|
32 |
+
"outputs": [
|
33 |
+
{
|
34 |
+
"name": "IMAGE",
|
35 |
+
"type": "IMAGE",
|
36 |
+
"links": [
|
37 |
+
65
|
38 |
+
],
|
39 |
+
"shape": 3,
|
40 |
+
"slot_index": 0
|
41 |
+
}
|
42 |
+
],
|
43 |
+
"properties": {
|
44 |
+
"Node name for S&R": "VAEDecode"
|
45 |
+
}
|
46 |
+
},
|
47 |
+
{
|
48 |
+
"id": 40,
|
49 |
+
"type": "LayeredDiffusionDecodeRGBA",
|
50 |
+
"pos": [
|
51 |
+
1533,
|
52 |
+
189
|
53 |
+
],
|
54 |
+
"size": {
|
55 |
+
"0": 243.60000610351562,
|
56 |
+
"1": 102
|
57 |
+
},
|
58 |
+
"flags": {},
|
59 |
+
"order": 13,
|
60 |
+
"mode": 0,
|
61 |
+
"inputs": [
|
62 |
+
{
|
63 |
+
"name": "samples",
|
64 |
+
"type": "LATENT",
|
65 |
+
"link": 67
|
66 |
+
},
|
67 |
+
{
|
68 |
+
"name": "images",
|
69 |
+
"type": "IMAGE",
|
70 |
+
"link": 65
|
71 |
+
}
|
72 |
+
],
|
73 |
+
"outputs": [
|
74 |
+
{
|
75 |
+
"name": "IMAGE",
|
76 |
+
"type": "IMAGE",
|
77 |
+
"links": [
|
78 |
+
66
|
79 |
+
],
|
80 |
+
"shape": 3,
|
81 |
+
"slot_index": 0
|
82 |
+
}
|
83 |
+
],
|
84 |
+
"properties": {
|
85 |
+
"Node name for S&R": "LayeredDiffusionDecodeRGBA"
|
86 |
+
},
|
87 |
+
"widgets_values": [
|
88 |
+
"SDXL",
|
89 |
+
16
|
90 |
+
],
|
91 |
+
"color": "#232",
|
92 |
+
"bgcolor": "#353"
|
93 |
+
},
|
94 |
+
{
|
95 |
+
"id": 47,
|
96 |
+
"type": "VAEDecode",
|
97 |
+
"pos": [
|
98 |
+
1360,
|
99 |
+
900
|
100 |
+
],
|
101 |
+
"size": {
|
102 |
+
"0": 210,
|
103 |
+
"1": 46
|
104 |
+
},
|
105 |
+
"flags": {},
|
106 |
+
"order": 8,
|
107 |
+
"mode": 0,
|
108 |
+
"inputs": [
|
109 |
+
{
|
110 |
+
"name": "samples",
|
111 |
+
"type": "LATENT",
|
112 |
+
"link": 74
|
113 |
+
},
|
114 |
+
{
|
115 |
+
"name": "vae",
|
116 |
+
"type": "VAE",
|
117 |
+
"link": 104,
|
118 |
+
"slot_index": 1
|
119 |
+
}
|
120 |
+
],
|
121 |
+
"outputs": [
|
122 |
+
{
|
123 |
+
"name": "IMAGE",
|
124 |
+
"type": "IMAGE",
|
125 |
+
"links": [
|
126 |
+
96
|
127 |
+
],
|
128 |
+
"shape": 3,
|
129 |
+
"slot_index": 0
|
130 |
+
}
|
131 |
+
],
|
132 |
+
"properties": {
|
133 |
+
"Node name for S&R": "VAEDecode"
|
134 |
+
}
|
135 |
+
},
|
136 |
+
{
|
137 |
+
"id": 49,
|
138 |
+
"type": "VAEEncode",
|
139 |
+
"pos": [
|
140 |
+
280,
|
141 |
+
690
|
142 |
+
],
|
143 |
+
"size": {
|
144 |
+
"0": 210,
|
145 |
+
"1": 46
|
146 |
+
},
|
147 |
+
"flags": {},
|
148 |
+
"order": 5,
|
149 |
+
"mode": 0,
|
150 |
+
"inputs": [
|
151 |
+
{
|
152 |
+
"name": "pixels",
|
153 |
+
"type": "IMAGE",
|
154 |
+
"link": 77
|
155 |
+
},
|
156 |
+
{
|
157 |
+
"name": "vae",
|
158 |
+
"type": "VAE",
|
159 |
+
"link": 102,
|
160 |
+
"slot_index": 1
|
161 |
+
}
|
162 |
+
],
|
163 |
+
"outputs": [
|
164 |
+
{
|
165 |
+
"name": "LATENT",
|
166 |
+
"type": "LATENT",
|
167 |
+
"links": [
|
168 |
+
89,
|
169 |
+
97
|
170 |
+
],
|
171 |
+
"shape": 3,
|
172 |
+
"slot_index": 0
|
173 |
+
}
|
174 |
+
],
|
175 |
+
"properties": {
|
176 |
+
"Node name for S&R": "VAEEncode"
|
177 |
+
}
|
178 |
+
},
|
179 |
+
{
|
180 |
+
"id": 56,
|
181 |
+
"type": "PreviewImage",
|
182 |
+
"pos": [
|
183 |
+
1800,
|
184 |
+
900
|
185 |
+
],
|
186 |
+
"size": {
|
187 |
+
"0": 611.2340087890625,
|
188 |
+
"1": 633.9354858398438
|
189 |
+
},
|
190 |
+
"flags": {},
|
191 |
+
"order": 10,
|
192 |
+
"mode": 0,
|
193 |
+
"inputs": [
|
194 |
+
{
|
195 |
+
"name": "images",
|
196 |
+
"type": "IMAGE",
|
197 |
+
"link": 96
|
198 |
+
}
|
199 |
+
],
|
200 |
+
"properties": {
|
201 |
+
"Node name for S&R": "PreviewImage"
|
202 |
+
}
|
203 |
+
},
|
204 |
+
{
|
205 |
+
"id": 6,
|
206 |
+
"type": "CLIPTextEncode",
|
207 |
+
"pos": [
|
208 |
+
415,
|
209 |
+
186
|
210 |
+
],
|
211 |
+
"size": {
|
212 |
+
"0": 422.84503173828125,
|
213 |
+
"1": 164.31304931640625
|
214 |
+
},
|
215 |
+
"flags": {},
|
216 |
+
"order": 3,
|
217 |
+
"mode": 0,
|
218 |
+
"inputs": [
|
219 |
+
{
|
220 |
+
"name": "clip",
|
221 |
+
"type": "CLIP",
|
222 |
+
"link": 3
|
223 |
+
}
|
224 |
+
],
|
225 |
+
"outputs": [
|
226 |
+
{
|
227 |
+
"name": "CONDITIONING",
|
228 |
+
"type": "CONDITIONING",
|
229 |
+
"links": [
|
230 |
+
56,
|
231 |
+
99
|
232 |
+
],
|
233 |
+
"slot_index": 0
|
234 |
+
}
|
235 |
+
],
|
236 |
+
"properties": {
|
237 |
+
"Node name for S&R": "CLIPTextEncode"
|
238 |
+
},
|
239 |
+
"widgets_values": [
|
240 |
+
"an old man sitting, high quality\n\n"
|
241 |
+
]
|
242 |
+
},
|
243 |
+
{
|
244 |
+
"id": 7,
|
245 |
+
"type": "CLIPTextEncode",
|
246 |
+
"pos": [
|
247 |
+
413,
|
248 |
+
389
|
249 |
+
],
|
250 |
+
"size": {
|
251 |
+
"0": 425.27801513671875,
|
252 |
+
"1": 180.6060791015625
|
253 |
+
},
|
254 |
+
"flags": {},
|
255 |
+
"order": 4,
|
256 |
+
"mode": 0,
|
257 |
+
"inputs": [
|
258 |
+
{
|
259 |
+
"name": "clip",
|
260 |
+
"type": "CLIP",
|
261 |
+
"link": 5
|
262 |
+
}
|
263 |
+
],
|
264 |
+
"outputs": [
|
265 |
+
{
|
266 |
+
"name": "CONDITIONING",
|
267 |
+
"type": "CONDITIONING",
|
268 |
+
"links": [
|
269 |
+
57,
|
270 |
+
100
|
271 |
+
],
|
272 |
+
"slot_index": 0
|
273 |
+
}
|
274 |
+
],
|
275 |
+
"properties": {
|
276 |
+
"Node name for S&R": "CLIPTextEncode"
|
277 |
+
},
|
278 |
+
"widgets_values": [
|
279 |
+
"text, watermark"
|
280 |
+
]
|
281 |
+
},
|
282 |
+
{
|
283 |
+
"id": 42,
|
284 |
+
"type": "KSampler",
|
285 |
+
"pos": [
|
286 |
+
990,
|
287 |
+
850
|
288 |
+
],
|
289 |
+
"size": {
|
290 |
+
"0": 315,
|
291 |
+
"1": 262
|
292 |
+
},
|
293 |
+
"flags": {},
|
294 |
+
"order": 7,
|
295 |
+
"mode": 0,
|
296 |
+
"inputs": [
|
297 |
+
{
|
298 |
+
"name": "model",
|
299 |
+
"type": "MODEL",
|
300 |
+
"link": 93
|
301 |
+
},
|
302 |
+
{
|
303 |
+
"name": "positive",
|
304 |
+
"type": "CONDITIONING",
|
305 |
+
"link": 94
|
306 |
+
},
|
307 |
+
{
|
308 |
+
"name": "negative",
|
309 |
+
"type": "CONDITIONING",
|
310 |
+
"link": 95
|
311 |
+
},
|
312 |
+
{
|
313 |
+
"name": "latent_image",
|
314 |
+
"type": "LATENT",
|
315 |
+
"link": 71
|
316 |
+
}
|
317 |
+
],
|
318 |
+
"outputs": [
|
319 |
+
{
|
320 |
+
"name": "LATENT",
|
321 |
+
"type": "LATENT",
|
322 |
+
"links": [
|
323 |
+
74,
|
324 |
+
98
|
325 |
+
],
|
326 |
+
"slot_index": 0
|
327 |
+
}
|
328 |
+
],
|
329 |
+
"properties": {
|
330 |
+
"Node name for S&R": "KSampler"
|
331 |
+
},
|
332 |
+
"widgets_values": [
|
333 |
+
216474886443753,
|
334 |
+
"randomize",
|
335 |
+
20,
|
336 |
+
8,
|
337 |
+
"euler",
|
338 |
+
"normal",
|
339 |
+
1
|
340 |
+
]
|
341 |
+
},
|
342 |
+
{
|
343 |
+
"id": 3,
|
344 |
+
"type": "KSampler",
|
345 |
+
"pos": [
|
346 |
+
913,
|
347 |
+
182
|
348 |
+
],
|
349 |
+
"size": {
|
350 |
+
"0": 315,
|
351 |
+
"1": 262
|
352 |
+
},
|
353 |
+
"flags": {},
|
354 |
+
"order": 11,
|
355 |
+
"mode": 0,
|
356 |
+
"inputs": [
|
357 |
+
{
|
358 |
+
"name": "model",
|
359 |
+
"type": "MODEL",
|
360 |
+
"link": 62
|
361 |
+
},
|
362 |
+
{
|
363 |
+
"name": "positive",
|
364 |
+
"type": "CONDITIONING",
|
365 |
+
"link": 63
|
366 |
+
},
|
367 |
+
{
|
368 |
+
"name": "negative",
|
369 |
+
"type": "CONDITIONING",
|
370 |
+
"link": 64
|
371 |
+
},
|
372 |
+
{
|
373 |
+
"name": "latent_image",
|
374 |
+
"type": "LATENT",
|
375 |
+
"link": 101,
|
376 |
+
"slot_index": 3
|
377 |
+
}
|
378 |
+
],
|
379 |
+
"outputs": [
|
380 |
+
{
|
381 |
+
"name": "LATENT",
|
382 |
+
"type": "LATENT",
|
383 |
+
"links": [
|
384 |
+
21,
|
385 |
+
67
|
386 |
+
],
|
387 |
+
"slot_index": 0
|
388 |
+
}
|
389 |
+
],
|
390 |
+
"properties": {
|
391 |
+
"Node name for S&R": "KSampler"
|
392 |
+
},
|
393 |
+
"widgets_values": [
|
394 |
+
137168876920770,
|
395 |
+
"randomize",
|
396 |
+
20,
|
397 |
+
8,
|
398 |
+
"euler",
|
399 |
+
"normal",
|
400 |
+
1
|
401 |
+
]
|
402 |
+
},
|
403 |
+
{
|
404 |
+
"id": 4,
|
405 |
+
"type": "CheckpointLoaderSimple",
|
406 |
+
"pos": [
|
407 |
+
-54,
|
408 |
+
488
|
409 |
+
],
|
410 |
+
"size": {
|
411 |
+
"0": 315,
|
412 |
+
"1": 98
|
413 |
+
},
|
414 |
+
"flags": {},
|
415 |
+
"order": 0,
|
416 |
+
"mode": 0,
|
417 |
+
"outputs": [
|
418 |
+
{
|
419 |
+
"name": "MODEL",
|
420 |
+
"type": "MODEL",
|
421 |
+
"links": [
|
422 |
+
55,
|
423 |
+
103
|
424 |
+
],
|
425 |
+
"slot_index": 0
|
426 |
+
},
|
427 |
+
{
|
428 |
+
"name": "CLIP",
|
429 |
+
"type": "CLIP",
|
430 |
+
"links": [
|
431 |
+
3,
|
432 |
+
5
|
433 |
+
],
|
434 |
+
"slot_index": 1
|
435 |
+
},
|
436 |
+
{
|
437 |
+
"name": "VAE",
|
438 |
+
"type": "VAE",
|
439 |
+
"links": [
|
440 |
+
22,
|
441 |
+
102,
|
442 |
+
104
|
443 |
+
],
|
444 |
+
"slot_index": 2
|
445 |
+
}
|
446 |
+
],
|
447 |
+
"properties": {
|
448 |
+
"Node name for S&R": "CheckpointLoaderSimple"
|
449 |
+
},
|
450 |
+
"widgets_values": [
|
451 |
+
"juggernautXL_v8Rundiffusion.safetensors"
|
452 |
+
]
|
453 |
+
},
|
454 |
+
{
|
455 |
+
"id": 50,
|
456 |
+
"type": "LoadImage",
|
457 |
+
"pos": [
|
458 |
+
-59,
|
459 |
+
686
|
460 |
+
],
|
461 |
+
"size": {
|
462 |
+
"0": 315,
|
463 |
+
"1": 314
|
464 |
+
},
|
465 |
+
"flags": {},
|
466 |
+
"order": 1,
|
467 |
+
"mode": 0,
|
468 |
+
"outputs": [
|
469 |
+
{
|
470 |
+
"name": "IMAGE",
|
471 |
+
"type": "IMAGE",
|
472 |
+
"links": [
|
473 |
+
77
|
474 |
+
],
|
475 |
+
"shape": 3,
|
476 |
+
"slot_index": 0
|
477 |
+
},
|
478 |
+
{
|
479 |
+
"name": "MASK",
|
480 |
+
"type": "MASK",
|
481 |
+
"links": null,
|
482 |
+
"shape": 3
|
483 |
+
}
|
484 |
+
],
|
485 |
+
"properties": {
|
486 |
+
"Node name for S&R": "LoadImage"
|
487 |
+
},
|
488 |
+
"widgets_values": [
|
489 |
+
"chair.png",
|
490 |
+
"image"
|
491 |
+
]
|
492 |
+
},
|
493 |
+
{
|
494 |
+
"id": 44,
|
495 |
+
"type": "EmptyLatentImage",
|
496 |
+
"pos": [
|
497 |
+
524,
|
498 |
+
944
|
499 |
+
],
|
500 |
+
"size": {
|
501 |
+
"0": 315,
|
502 |
+
"1": 106
|
503 |
+
},
|
504 |
+
"flags": {},
|
505 |
+
"order": 2,
|
506 |
+
"mode": 0,
|
507 |
+
"outputs": [
|
508 |
+
{
|
509 |
+
"name": "LATENT",
|
510 |
+
"type": "LATENT",
|
511 |
+
"links": [
|
512 |
+
71,
|
513 |
+
101
|
514 |
+
],
|
515 |
+
"slot_index": 0
|
516 |
+
}
|
517 |
+
],
|
518 |
+
"properties": {
|
519 |
+
"Node name for S&R": "EmptyLatentImage"
|
520 |
+
},
|
521 |
+
"widgets_values": [
|
522 |
+
1024,
|
523 |
+
1024,
|
524 |
+
1
|
525 |
+
]
|
526 |
+
},
|
527 |
+
{
|
528 |
+
"id": 55,
|
529 |
+
"type": "LayeredDiffusionCondApply",
|
530 |
+
"pos": [
|
531 |
+
530,
|
532 |
+
680
|
533 |
+
],
|
534 |
+
"size": {
|
535 |
+
"0": 315,
|
536 |
+
"1": 142
|
537 |
+
},
|
538 |
+
"flags": {},
|
539 |
+
"order": 6,
|
540 |
+
"mode": 0,
|
541 |
+
"inputs": [
|
542 |
+
{
|
543 |
+
"name": "model",
|
544 |
+
"type": "MODEL",
|
545 |
+
"link": 103,
|
546 |
+
"slot_index": 0
|
547 |
+
},
|
548 |
+
{
|
549 |
+
"name": "cond",
|
550 |
+
"type": "CONDITIONING",
|
551 |
+
"link": 99
|
552 |
+
},
|
553 |
+
{
|
554 |
+
"name": "uncond",
|
555 |
+
"type": "CONDITIONING",
|
556 |
+
"link": 100
|
557 |
+
},
|
558 |
+
{
|
559 |
+
"name": "latent",
|
560 |
+
"type": "LATENT",
|
561 |
+
"link": 89,
|
562 |
+
"slot_index": 3
|
563 |
+
}
|
564 |
+
],
|
565 |
+
"outputs": [
|
566 |
+
{
|
567 |
+
"name": "MODEL",
|
568 |
+
"type": "MODEL",
|
569 |
+
"links": [
|
570 |
+
93
|
571 |
+
],
|
572 |
+
"shape": 3,
|
573 |
+
"slot_index": 0
|
574 |
+
},
|
575 |
+
{
|
576 |
+
"name": "CONDITIONING",
|
577 |
+
"type": "CONDITIONING",
|
578 |
+
"links": [
|
579 |
+
94
|
580 |
+
],
|
581 |
+
"shape": 3,
|
582 |
+
"slot_index": 1
|
583 |
+
},
|
584 |
+
{
|
585 |
+
"name": "CONDITIONING",
|
586 |
+
"type": "CONDITIONING",
|
587 |
+
"links": [
|
588 |
+
95
|
589 |
+
],
|
590 |
+
"shape": 3,
|
591 |
+
"slot_index": 2
|
592 |
+
}
|
593 |
+
],
|
594 |
+
"properties": {
|
595 |
+
"Node name for S&R": "LayeredDiffusionCondApply"
|
596 |
+
},
|
597 |
+
"widgets_values": [
|
598 |
+
"SDXL, Background",
|
599 |
+
1
|
600 |
+
],
|
601 |
+
"color": "#232",
|
602 |
+
"bgcolor": "#353"
|
603 |
+
},
|
604 |
+
{
|
605 |
+
"id": 37,
|
606 |
+
"type": "LayeredDiffusionDiffApply",
|
607 |
+
"pos": [
|
608 |
+
457,
|
609 |
+
-37
|
610 |
+
],
|
611 |
+
"size": {
|
612 |
+
"0": 342.5999755859375,
|
613 |
+
"1": 162
|
614 |
+
},
|
615 |
+
"flags": {},
|
616 |
+
"order": 9,
|
617 |
+
"mode": 0,
|
618 |
+
"inputs": [
|
619 |
+
{
|
620 |
+
"name": "model",
|
621 |
+
"type": "MODEL",
|
622 |
+
"link": 55,
|
623 |
+
"slot_index": 0
|
624 |
+
},
|
625 |
+
{
|
626 |
+
"name": "cond",
|
627 |
+
"type": "CONDITIONING",
|
628 |
+
"link": 56,
|
629 |
+
"slot_index": 1
|
630 |
+
},
|
631 |
+
{
|
632 |
+
"name": "uncond",
|
633 |
+
"type": "CONDITIONING",
|
634 |
+
"link": 57,
|
635 |
+
"slot_index": 2
|
636 |
+
},
|
637 |
+
{
|
638 |
+
"name": "blended_latent",
|
639 |
+
"type": "LATENT",
|
640 |
+
"link": 98
|
641 |
+
},
|
642 |
+
{
|
643 |
+
"name": "latent",
|
644 |
+
"type": "LATENT",
|
645 |
+
"link": 97
|
646 |
+
}
|
647 |
+
],
|
648 |
+
"outputs": [
|
649 |
+
{
|
650 |
+
"name": "MODEL",
|
651 |
+
"type": "MODEL",
|
652 |
+
"links": [
|
653 |
+
62
|
654 |
+
],
|
655 |
+
"shape": 3,
|
656 |
+
"slot_index": 0
|
657 |
+
},
|
658 |
+
{
|
659 |
+
"name": "CONDITIONING",
|
660 |
+
"type": "CONDITIONING",
|
661 |
+
"links": [
|
662 |
+
63
|
663 |
+
],
|
664 |
+
"shape": 3,
|
665 |
+
"slot_index": 1
|
666 |
+
},
|
667 |
+
{
|
668 |
+
"name": "CONDITIONING",
|
669 |
+
"type": "CONDITIONING",
|
670 |
+
"links": [
|
671 |
+
64
|
672 |
+
],
|
673 |
+
"shape": 3,
|
674 |
+
"slot_index": 2
|
675 |
+
}
|
676 |
+
],
|
677 |
+
"properties": {
|
678 |
+
"Node name for S&R": "LayeredDiffusionDiffApply"
|
679 |
+
},
|
680 |
+
"widgets_values": [
|
681 |
+
"SDXL, Background",
|
682 |
+
1
|
683 |
+
],
|
684 |
+
"color": "#232",
|
685 |
+
"bgcolor": "#353"
|
686 |
+
},
|
687 |
+
{
|
688 |
+
"id": 20,
|
689 |
+
"type": "PreviewImage",
|
690 |
+
"pos": [
|
691 |
+
1815,
|
692 |
+
194
|
693 |
+
],
|
694 |
+
"size": {
|
695 |
+
"0": 611.2340087890625,
|
696 |
+
"1": 633.9354858398438
|
697 |
+
},
|
698 |
+
"flags": {},
|
699 |
+
"order": 14,
|
700 |
+
"mode": 0,
|
701 |
+
"inputs": [
|
702 |
+
{
|
703 |
+
"name": "images",
|
704 |
+
"type": "IMAGE",
|
705 |
+
"link": 66
|
706 |
+
}
|
707 |
+
],
|
708 |
+
"properties": {
|
709 |
+
"Node name for S&R": "PreviewImage"
|
710 |
+
}
|
711 |
+
}
|
712 |
+
],
|
713 |
+
"links": [
|
714 |
+
[
|
715 |
+
3,
|
716 |
+
4,
|
717 |
+
1,
|
718 |
+
6,
|
719 |
+
0,
|
720 |
+
"CLIP"
|
721 |
+
],
|
722 |
+
[
|
723 |
+
5,
|
724 |
+
4,
|
725 |
+
1,
|
726 |
+
7,
|
727 |
+
0,
|
728 |
+
"CLIP"
|
729 |
+
],
|
730 |
+
[
|
731 |
+
21,
|
732 |
+
3,
|
733 |
+
0,
|
734 |
+
14,
|
735 |
+
0,
|
736 |
+
"LATENT"
|
737 |
+
],
|
738 |
+
[
|
739 |
+
22,
|
740 |
+
4,
|
741 |
+
2,
|
742 |
+
14,
|
743 |
+
1,
|
744 |
+
"VAE"
|
745 |
+
],
|
746 |
+
[
|
747 |
+
55,
|
748 |
+
4,
|
749 |
+
0,
|
750 |
+
37,
|
751 |
+
0,
|
752 |
+
"MODEL"
|
753 |
+
],
|
754 |
+
[
|
755 |
+
56,
|
756 |
+
6,
|
757 |
+
0,
|
758 |
+
37,
|
759 |
+
1,
|
760 |
+
"CONDITIONING"
|
761 |
+
],
|
762 |
+
[
|
763 |
+
57,
|
764 |
+
7,
|
765 |
+
0,
|
766 |
+
37,
|
767 |
+
2,
|
768 |
+
"CONDITIONING"
|
769 |
+
],
|
770 |
+
[
|
771 |
+
62,
|
772 |
+
37,
|
773 |
+
0,
|
774 |
+
3,
|
775 |
+
0,
|
776 |
+
"MODEL"
|
777 |
+
],
|
778 |
+
[
|
779 |
+
63,
|
780 |
+
37,
|
781 |
+
1,
|
782 |
+
3,
|
783 |
+
1,
|
784 |
+
"CONDITIONING"
|
785 |
+
],
|
786 |
+
[
|
787 |
+
64,
|
788 |
+
37,
|
789 |
+
2,
|
790 |
+
3,
|
791 |
+
2,
|
792 |
+
"CONDITIONING"
|
793 |
+
],
|
794 |
+
[
|
795 |
+
65,
|
796 |
+
14,
|
797 |
+
0,
|
798 |
+
40,
|
799 |
+
1,
|
800 |
+
"IMAGE"
|
801 |
+
],
|
802 |
+
[
|
803 |
+
66,
|
804 |
+
40,
|
805 |
+
0,
|
806 |
+
20,
|
807 |
+
0,
|
808 |
+
"IMAGE"
|
809 |
+
],
|
810 |
+
[
|
811 |
+
67,
|
812 |
+
3,
|
813 |
+
0,
|
814 |
+
40,
|
815 |
+
0,
|
816 |
+
"LATENT"
|
817 |
+
],
|
818 |
+
[
|
819 |
+
71,
|
820 |
+
44,
|
821 |
+
0,
|
822 |
+
42,
|
823 |
+
3,
|
824 |
+
"LATENT"
|
825 |
+
],
|
826 |
+
[
|
827 |
+
74,
|
828 |
+
42,
|
829 |
+
0,
|
830 |
+
47,
|
831 |
+
0,
|
832 |
+
"LATENT"
|
833 |
+
],
|
834 |
+
[
|
835 |
+
77,
|
836 |
+
50,
|
837 |
+
0,
|
838 |
+
49,
|
839 |
+
0,
|
840 |
+
"IMAGE"
|
841 |
+
],
|
842 |
+
[
|
843 |
+
89,
|
844 |
+
49,
|
845 |
+
0,
|
846 |
+
55,
|
847 |
+
3,
|
848 |
+
"LATENT"
|
849 |
+
],
|
850 |
+
[
|
851 |
+
93,
|
852 |
+
55,
|
853 |
+
0,
|
854 |
+
42,
|
855 |
+
0,
|
856 |
+
"MODEL"
|
857 |
+
],
|
858 |
+
[
|
859 |
+
94,
|
860 |
+
55,
|
861 |
+
1,
|
862 |
+
42,
|
863 |
+
1,
|
864 |
+
"CONDITIONING"
|
865 |
+
],
|
866 |
+
[
|
867 |
+
95,
|
868 |
+
55,
|
869 |
+
2,
|
870 |
+
42,
|
871 |
+
2,
|
872 |
+
"CONDITIONING"
|
873 |
+
],
|
874 |
+
[
|
875 |
+
96,
|
876 |
+
47,
|
877 |
+
0,
|
878 |
+
56,
|
879 |
+
0,
|
880 |
+
"IMAGE"
|
881 |
+
],
|
882 |
+
[
|
883 |
+
97,
|
884 |
+
49,
|
885 |
+
0,
|
886 |
+
37,
|
887 |
+
4,
|
888 |
+
"LATENT"
|
889 |
+
],
|
890 |
+
[
|
891 |
+
98,
|
892 |
+
42,
|
893 |
+
0,
|
894 |
+
37,
|
895 |
+
3,
|
896 |
+
"LATENT"
|
897 |
+
],
|
898 |
+
[
|
899 |
+
99,
|
900 |
+
6,
|
901 |
+
0,
|
902 |
+
55,
|
903 |
+
1,
|
904 |
+
"CONDITIONING"
|
905 |
+
],
|
906 |
+
[
|
907 |
+
100,
|
908 |
+
7,
|
909 |
+
0,
|
910 |
+
55,
|
911 |
+
2,
|
912 |
+
"CONDITIONING"
|
913 |
+
],
|
914 |
+
[
|
915 |
+
101,
|
916 |
+
44,
|
917 |
+
0,
|
918 |
+
3,
|
919 |
+
3,
|
920 |
+
"LATENT"
|
921 |
+
],
|
922 |
+
[
|
923 |
+
102,
|
924 |
+
4,
|
925 |
+
2,
|
926 |
+
49,
|
927 |
+
1,
|
928 |
+
"VAE"
|
929 |
+
],
|
930 |
+
[
|
931 |
+
103,
|
932 |
+
4,
|
933 |
+
0,
|
934 |
+
55,
|
935 |
+
0,
|
936 |
+
"MODEL"
|
937 |
+
],
|
938 |
+
[
|
939 |
+
104,
|
940 |
+
4,
|
941 |
+
2,
|
942 |
+
47,
|
943 |
+
1,
|
944 |
+
"VAE"
|
945 |
+
]
|
946 |
+
],
|
947 |
+
"groups": [],
|
948 |
+
"config": {},
|
949 |
+
"extra": {},
|
950 |
+
"version": 0.4
|
951 |
+
}
|
ComfyUI/custom_nodes/layerdiffuse/examples/layer_diffusion_cond_joint_bg.json
ADDED
@@ -0,0 +1,723 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"last_node_id": 53,
|
3 |
+
"last_link_id": 88,
|
4 |
+
"nodes": [
|
5 |
+
{
|
6 |
+
"id": 33,
|
7 |
+
"type": "ImageResize+",
|
8 |
+
"pos": [
|
9 |
+
50,
|
10 |
+
-10
|
11 |
+
],
|
12 |
+
"size": {
|
13 |
+
"0": 315,
|
14 |
+
"1": 170
|
15 |
+
},
|
16 |
+
"flags": {},
|
17 |
+
"order": 5,
|
18 |
+
"mode": 0,
|
19 |
+
"inputs": [
|
20 |
+
{
|
21 |
+
"name": "image",
|
22 |
+
"type": "IMAGE",
|
23 |
+
"link": 50
|
24 |
+
}
|
25 |
+
],
|
26 |
+
"outputs": [
|
27 |
+
{
|
28 |
+
"name": "IMAGE",
|
29 |
+
"type": "IMAGE",
|
30 |
+
"links": [
|
31 |
+
52,
|
32 |
+
54
|
33 |
+
],
|
34 |
+
"shape": 3,
|
35 |
+
"slot_index": 0
|
36 |
+
},
|
37 |
+
{
|
38 |
+
"name": "width",
|
39 |
+
"type": "INT",
|
40 |
+
"links": null,
|
41 |
+
"shape": 3
|
42 |
+
},
|
43 |
+
{
|
44 |
+
"name": "height",
|
45 |
+
"type": "INT",
|
46 |
+
"links": null,
|
47 |
+
"shape": 3
|
48 |
+
}
|
49 |
+
],
|
50 |
+
"properties": {
|
51 |
+
"Node name for S&R": "ImageResize+"
|
52 |
+
},
|
53 |
+
"widgets_values": [
|
54 |
+
512,
|
55 |
+
512,
|
56 |
+
"nearest",
|
57 |
+
false
|
58 |
+
]
|
59 |
+
},
|
60 |
+
{
|
61 |
+
"id": 6,
|
62 |
+
"type": "CLIPTextEncode",
|
63 |
+
"pos": [
|
64 |
+
415,
|
65 |
+
186
|
66 |
+
],
|
67 |
+
"size": {
|
68 |
+
"0": 422.84503173828125,
|
69 |
+
"1": 164.31304931640625
|
70 |
+
},
|
71 |
+
"flags": {},
|
72 |
+
"order": 3,
|
73 |
+
"mode": 0,
|
74 |
+
"inputs": [
|
75 |
+
{
|
76 |
+
"name": "clip",
|
77 |
+
"type": "CLIP",
|
78 |
+
"link": 3
|
79 |
+
}
|
80 |
+
],
|
81 |
+
"outputs": [
|
82 |
+
{
|
83 |
+
"name": "CONDITIONING",
|
84 |
+
"type": "CONDITIONING",
|
85 |
+
"links": [
|
86 |
+
64
|
87 |
+
],
|
88 |
+
"slot_index": 0
|
89 |
+
}
|
90 |
+
],
|
91 |
+
"properties": {
|
92 |
+
"Node name for S&R": "CLIPTextEncode"
|
93 |
+
},
|
94 |
+
"widgets_values": [
|
95 |
+
"old man sitting, high quality\n\n"
|
96 |
+
]
|
97 |
+
},
|
98 |
+
{
|
99 |
+
"id": 7,
|
100 |
+
"type": "CLIPTextEncode",
|
101 |
+
"pos": [
|
102 |
+
413,
|
103 |
+
389
|
104 |
+
],
|
105 |
+
"size": {
|
106 |
+
"0": 425.27801513671875,
|
107 |
+
"1": 180.6060791015625
|
108 |
+
},
|
109 |
+
"flags": {},
|
110 |
+
"order": 4,
|
111 |
+
"mode": 0,
|
112 |
+
"inputs": [
|
113 |
+
{
|
114 |
+
"name": "clip",
|
115 |
+
"type": "CLIP",
|
116 |
+
"link": 5
|
117 |
+
}
|
118 |
+
],
|
119 |
+
"outputs": [
|
120 |
+
{
|
121 |
+
"name": "CONDITIONING",
|
122 |
+
"type": "CONDITIONING",
|
123 |
+
"links": [
|
124 |
+
65
|
125 |
+
],
|
126 |
+
"slot_index": 0
|
127 |
+
}
|
128 |
+
],
|
129 |
+
"properties": {
|
130 |
+
"Node name for S&R": "CLIPTextEncode"
|
131 |
+
},
|
132 |
+
"widgets_values": [
|
133 |
+
"text, watermark"
|
134 |
+
]
|
135 |
+
},
|
136 |
+
{
|
137 |
+
"id": 3,
|
138 |
+
"type": "KSampler",
|
139 |
+
"pos": [
|
140 |
+
915,
|
141 |
+
176
|
142 |
+
],
|
143 |
+
"size": {
|
144 |
+
"0": 315,
|
145 |
+
"1": 262
|
146 |
+
},
|
147 |
+
"flags": {},
|
148 |
+
"order": 8,
|
149 |
+
"mode": 0,
|
150 |
+
"inputs": [
|
151 |
+
{
|
152 |
+
"name": "model",
|
153 |
+
"type": "MODEL",
|
154 |
+
"link": 56
|
155 |
+
},
|
156 |
+
{
|
157 |
+
"name": "positive",
|
158 |
+
"type": "CONDITIONING",
|
159 |
+
"link": 64
|
160 |
+
},
|
161 |
+
{
|
162 |
+
"name": "negative",
|
163 |
+
"type": "CONDITIONING",
|
164 |
+
"link": 65
|
165 |
+
},
|
166 |
+
{
|
167 |
+
"name": "latent_image",
|
168 |
+
"type": "LATENT",
|
169 |
+
"link": 2
|
170 |
+
}
|
171 |
+
],
|
172 |
+
"outputs": [
|
173 |
+
{
|
174 |
+
"name": "LATENT",
|
175 |
+
"type": "LATENT",
|
176 |
+
"links": [
|
177 |
+
70,
|
178 |
+
84
|
179 |
+
],
|
180 |
+
"slot_index": 0
|
181 |
+
}
|
182 |
+
],
|
183 |
+
"properties": {
|
184 |
+
"Node name for S&R": "KSampler"
|
185 |
+
},
|
186 |
+
"widgets_values": [
|
187 |
+
674865838825506,
|
188 |
+
"randomize",
|
189 |
+
20,
|
190 |
+
8,
|
191 |
+
"euler",
|
192 |
+
"normal",
|
193 |
+
1
|
194 |
+
]
|
195 |
+
},
|
196 |
+
{
|
197 |
+
"id": 50,
|
198 |
+
"type": "PreviewImage",
|
199 |
+
"pos": [
|
200 |
+
2040,
|
201 |
+
-120
|
202 |
+
],
|
203 |
+
"size": {
|
204 |
+
"0": 210,
|
205 |
+
"1": 246
|
206 |
+
},
|
207 |
+
"flags": {},
|
208 |
+
"order": 12,
|
209 |
+
"mode": 0,
|
210 |
+
"inputs": [
|
211 |
+
{
|
212 |
+
"name": "images",
|
213 |
+
"type": "IMAGE",
|
214 |
+
"link": 85
|
215 |
+
}
|
216 |
+
],
|
217 |
+
"properties": {
|
218 |
+
"Node name for S&R": "PreviewImage"
|
219 |
+
}
|
220 |
+
},
|
221 |
+
{
|
222 |
+
"id": 5,
|
223 |
+
"type": "EmptyLatentImage",
|
224 |
+
"pos": [
|
225 |
+
475,
|
226 |
+
666
|
227 |
+
],
|
228 |
+
"size": {
|
229 |
+
"0": 315,
|
230 |
+
"1": 106
|
231 |
+
},
|
232 |
+
"flags": {},
|
233 |
+
"order": 0,
|
234 |
+
"mode": 0,
|
235 |
+
"outputs": [
|
236 |
+
{
|
237 |
+
"name": "LATENT",
|
238 |
+
"type": "LATENT",
|
239 |
+
"links": [
|
240 |
+
2
|
241 |
+
],
|
242 |
+
"slot_index": 0
|
243 |
+
}
|
244 |
+
],
|
245 |
+
"properties": {
|
246 |
+
"Node name for S&R": "EmptyLatentImage"
|
247 |
+
},
|
248 |
+
"widgets_values": [
|
249 |
+
512,
|
250 |
+
512,
|
251 |
+
4
|
252 |
+
]
|
253 |
+
},
|
254 |
+
{
|
255 |
+
"id": 44,
|
256 |
+
"type": "VAEDecode",
|
257 |
+
"pos": [
|
258 |
+
1260,
|
259 |
+
180
|
260 |
+
],
|
261 |
+
"size": {
|
262 |
+
"0": 210,
|
263 |
+
"1": 46
|
264 |
+
},
|
265 |
+
"flags": {},
|
266 |
+
"order": 9,
|
267 |
+
"mode": 0,
|
268 |
+
"inputs": [
|
269 |
+
{
|
270 |
+
"name": "samples",
|
271 |
+
"type": "LATENT",
|
272 |
+
"link": 70
|
273 |
+
},
|
274 |
+
{
|
275 |
+
"name": "vae",
|
276 |
+
"type": "VAE",
|
277 |
+
"link": 88,
|
278 |
+
"slot_index": 1
|
279 |
+
}
|
280 |
+
],
|
281 |
+
"outputs": [
|
282 |
+
{
|
283 |
+
"name": "IMAGE",
|
284 |
+
"type": "IMAGE",
|
285 |
+
"links": [
|
286 |
+
75,
|
287 |
+
83
|
288 |
+
],
|
289 |
+
"shape": 3,
|
290 |
+
"slot_index": 0
|
291 |
+
}
|
292 |
+
],
|
293 |
+
"properties": {
|
294 |
+
"Node name for S&R": "VAEDecode"
|
295 |
+
}
|
296 |
+
},
|
297 |
+
{
|
298 |
+
"id": 4,
|
299 |
+
"type": "CheckpointLoaderSimple",
|
300 |
+
"pos": [
|
301 |
+
5,
|
302 |
+
479
|
303 |
+
],
|
304 |
+
"size": {
|
305 |
+
"0": 315,
|
306 |
+
"1": 98
|
307 |
+
},
|
308 |
+
"flags": {},
|
309 |
+
"order": 1,
|
310 |
+
"mode": 0,
|
311 |
+
"outputs": [
|
312 |
+
{
|
313 |
+
"name": "MODEL",
|
314 |
+
"type": "MODEL",
|
315 |
+
"links": [
|
316 |
+
55
|
317 |
+
],
|
318 |
+
"slot_index": 0
|
319 |
+
},
|
320 |
+
{
|
321 |
+
"name": "CLIP",
|
322 |
+
"type": "CLIP",
|
323 |
+
"links": [
|
324 |
+
3,
|
325 |
+
5
|
326 |
+
],
|
327 |
+
"slot_index": 1
|
328 |
+
},
|
329 |
+
{
|
330 |
+
"name": "VAE",
|
331 |
+
"type": "VAE",
|
332 |
+
"links": [
|
333 |
+
88
|
334 |
+
],
|
335 |
+
"slot_index": 2
|
336 |
+
}
|
337 |
+
],
|
338 |
+
"properties": {
|
339 |
+
"Node name for S&R": "CheckpointLoaderSimple"
|
340 |
+
},
|
341 |
+
"widgets_values": [
|
342 |
+
"realisticVisionV20_v20.safetensors"
|
343 |
+
]
|
344 |
+
},
|
345 |
+
{
|
346 |
+
"id": 46,
|
347 |
+
"type": "PreviewImage",
|
348 |
+
"pos": [
|
349 |
+
1460,
|
350 |
+
410
|
351 |
+
],
|
352 |
+
"size": [
|
353 |
+
406.59525756835933,
|
354 |
+
340.5699157714844
|
355 |
+
],
|
356 |
+
"flags": {},
|
357 |
+
"order": 10,
|
358 |
+
"mode": 0,
|
359 |
+
"inputs": [
|
360 |
+
{
|
361 |
+
"name": "images",
|
362 |
+
"type": "IMAGE",
|
363 |
+
"link": 75
|
364 |
+
}
|
365 |
+
],
|
366 |
+
"properties": {
|
367 |
+
"Node name for S&R": "PreviewImage"
|
368 |
+
}
|
369 |
+
},
|
370 |
+
{
|
371 |
+
"id": 34,
|
372 |
+
"type": "PreviewImage",
|
373 |
+
"pos": [
|
374 |
+
471,
|
375 |
+
-337
|
376 |
+
],
|
377 |
+
"size": {
|
378 |
+
"0": 210,
|
379 |
+
"1": 246
|
380 |
+
},
|
381 |
+
"flags": {},
|
382 |
+
"order": 6,
|
383 |
+
"mode": 0,
|
384 |
+
"inputs": [
|
385 |
+
{
|
386 |
+
"name": "images",
|
387 |
+
"type": "IMAGE",
|
388 |
+
"link": 52
|
389 |
+
}
|
390 |
+
],
|
391 |
+
"properties": {
|
392 |
+
"Node name for S&R": "PreviewImage"
|
393 |
+
}
|
394 |
+
},
|
395 |
+
{
|
396 |
+
"id": 37,
|
397 |
+
"type": "LayeredDiffusionCondJointApply",
|
398 |
+
"pos": [
|
399 |
+
429,
|
400 |
+
-13
|
401 |
+
],
|
402 |
+
"size": {
|
403 |
+
"0": 388,
|
404 |
+
"1": 138
|
405 |
+
},
|
406 |
+
"flags": {},
|
407 |
+
"order": 7,
|
408 |
+
"mode": 0,
|
409 |
+
"inputs": [
|
410 |
+
{
|
411 |
+
"name": "model",
|
412 |
+
"type": "MODEL",
|
413 |
+
"link": 55,
|
414 |
+
"slot_index": 0
|
415 |
+
},
|
416 |
+
{
|
417 |
+
"name": "image",
|
418 |
+
"type": "IMAGE",
|
419 |
+
"link": 54,
|
420 |
+
"slot_index": 1
|
421 |
+
},
|
422 |
+
{
|
423 |
+
"name": "cond",
|
424 |
+
"type": "CONDITIONING",
|
425 |
+
"link": null
|
426 |
+
},
|
427 |
+
{
|
428 |
+
"name": "blended_cond",
|
429 |
+
"type": "CONDITIONING",
|
430 |
+
"link": null
|
431 |
+
}
|
432 |
+
],
|
433 |
+
"outputs": [
|
434 |
+
{
|
435 |
+
"name": "MODEL",
|
436 |
+
"type": "MODEL",
|
437 |
+
"links": [
|
438 |
+
56
|
439 |
+
],
|
440 |
+
"shape": 3,
|
441 |
+
"slot_index": 0
|
442 |
+
}
|
443 |
+
],
|
444 |
+
"properties": {
|
445 |
+
"Node name for S&R": "LayeredDiffusionCondJointApply"
|
446 |
+
},
|
447 |
+
"widgets_values": [
|
448 |
+
"SD15, Background, attn_sharing, Batch size (2N)"
|
449 |
+
],
|
450 |
+
"color": "#232",
|
451 |
+
"bgcolor": "#353"
|
452 |
+
},
|
453 |
+
{
|
454 |
+
"id": 52,
|
455 |
+
"type": "LayeredDiffusionDecodeSplit",
|
456 |
+
"pos": [
|
457 |
+
1544,
|
458 |
+
177
|
459 |
+
],
|
460 |
+
"size": {
|
461 |
+
"0": 315,
|
462 |
+
"1": 146
|
463 |
+
},
|
464 |
+
"flags": {},
|
465 |
+
"order": 11,
|
466 |
+
"mode": 0,
|
467 |
+
"inputs": [
|
468 |
+
{
|
469 |
+
"name": "samples",
|
470 |
+
"type": "LATENT",
|
471 |
+
"link": 84
|
472 |
+
},
|
473 |
+
{
|
474 |
+
"name": "images",
|
475 |
+
"type": "IMAGE",
|
476 |
+
"link": 83
|
477 |
+
}
|
478 |
+
],
|
479 |
+
"outputs": [
|
480 |
+
{
|
481 |
+
"name": "IMAGE",
|
482 |
+
"type": "IMAGE",
|
483 |
+
"links": [
|
484 |
+
85
|
485 |
+
],
|
486 |
+
"shape": 3,
|
487 |
+
"slot_index": 0
|
488 |
+
},
|
489 |
+
{
|
490 |
+
"name": "IMAGE",
|
491 |
+
"type": "IMAGE",
|
492 |
+
"links": [
|
493 |
+
86
|
494 |
+
],
|
495 |
+
"shape": 3,
|
496 |
+
"slot_index": 1
|
497 |
+
},
|
498 |
+
{
|
499 |
+
"name": "IMAGE",
|
500 |
+
"type": "IMAGE",
|
501 |
+
"links": null,
|
502 |
+
"shape": 3
|
503 |
+
}
|
504 |
+
],
|
505 |
+
"properties": {
|
506 |
+
"Node name for S&R": "LayeredDiffusionDecodeSplit"
|
507 |
+
},
|
508 |
+
"widgets_values": [
|
509 |
+
2,
|
510 |
+
"SDXL",
|
511 |
+
16
|
512 |
+
],
|
513 |
+
"color": "#232",
|
514 |
+
"bgcolor": "#353"
|
515 |
+
},
|
516 |
+
{
|
517 |
+
"id": 51,
|
518 |
+
"type": "PreviewImage",
|
519 |
+
"pos": [
|
520 |
+
2040,
|
521 |
+
201
|
522 |
+
],
|
523 |
+
"size": {
|
524 |
+
"0": 210,
|
525 |
+
"1": 246
|
526 |
+
},
|
527 |
+
"flags": {},
|
528 |
+
"order": 13,
|
529 |
+
"mode": 0,
|
530 |
+
"inputs": [
|
531 |
+
{
|
532 |
+
"name": "images",
|
533 |
+
"type": "IMAGE",
|
534 |
+
"link": 86
|
535 |
+
}
|
536 |
+
],
|
537 |
+
"properties": {
|
538 |
+
"Node name for S&R": "PreviewImage"
|
539 |
+
}
|
540 |
+
},
|
541 |
+
{
|
542 |
+
"id": 30,
|
543 |
+
"type": "LoadImage",
|
544 |
+
"pos": [
|
545 |
+
-313,
|
546 |
+
-10
|
547 |
+
],
|
548 |
+
"size": {
|
549 |
+
"0": 315,
|
550 |
+
"1": 314
|
551 |
+
},
|
552 |
+
"flags": {},
|
553 |
+
"order": 2,
|
554 |
+
"mode": 0,
|
555 |
+
"outputs": [
|
556 |
+
{
|
557 |
+
"name": "IMAGE",
|
558 |
+
"type": "IMAGE",
|
559 |
+
"links": [
|
560 |
+
50
|
561 |
+
],
|
562 |
+
"shape": 3,
|
563 |
+
"slot_index": 0
|
564 |
+
},
|
565 |
+
{
|
566 |
+
"name": "MASK",
|
567 |
+
"type": "MASK",
|
568 |
+
"links": null,
|
569 |
+
"shape": 3
|
570 |
+
}
|
571 |
+
],
|
572 |
+
"properties": {
|
573 |
+
"Node name for S&R": "LoadImage"
|
574 |
+
},
|
575 |
+
"widgets_values": [
|
576 |
+
"309219693-e7e2d80e-ffbe-4724-812a-5139a88027e3.png",
|
577 |
+
"image"
|
578 |
+
]
|
579 |
+
}
|
580 |
+
],
|
581 |
+
"links": [
|
582 |
+
[
|
583 |
+
2,
|
584 |
+
5,
|
585 |
+
0,
|
586 |
+
3,
|
587 |
+
3,
|
588 |
+
"LATENT"
|
589 |
+
],
|
590 |
+
[
|
591 |
+
3,
|
592 |
+
4,
|
593 |
+
1,
|
594 |
+
6,
|
595 |
+
0,
|
596 |
+
"CLIP"
|
597 |
+
],
|
598 |
+
[
|
599 |
+
5,
|
600 |
+
4,
|
601 |
+
1,
|
602 |
+
7,
|
603 |
+
0,
|
604 |
+
"CLIP"
|
605 |
+
],
|
606 |
+
[
|
607 |
+
50,
|
608 |
+
30,
|
609 |
+
0,
|
610 |
+
33,
|
611 |
+
0,
|
612 |
+
"IMAGE"
|
613 |
+
],
|
614 |
+
[
|
615 |
+
52,
|
616 |
+
33,
|
617 |
+
0,
|
618 |
+
34,
|
619 |
+
0,
|
620 |
+
"IMAGE"
|
621 |
+
],
|
622 |
+
[
|
623 |
+
54,
|
624 |
+
33,
|
625 |
+
0,
|
626 |
+
37,
|
627 |
+
1,
|
628 |
+
"IMAGE"
|
629 |
+
],
|
630 |
+
[
|
631 |
+
55,
|
632 |
+
4,
|
633 |
+
0,
|
634 |
+
37,
|
635 |
+
0,
|
636 |
+
"MODEL"
|
637 |
+
],
|
638 |
+
[
|
639 |
+
56,
|
640 |
+
37,
|
641 |
+
0,
|
642 |
+
3,
|
643 |
+
0,
|
644 |
+
"MODEL"
|
645 |
+
],
|
646 |
+
[
|
647 |
+
64,
|
648 |
+
6,
|
649 |
+
0,
|
650 |
+
3,
|
651 |
+
1,
|
652 |
+
"CONDITIONING"
|
653 |
+
],
|
654 |
+
[
|
655 |
+
65,
|
656 |
+
7,
|
657 |
+
0,
|
658 |
+
3,
|
659 |
+
2,
|
660 |
+
"CONDITIONING"
|
661 |
+
],
|
662 |
+
[
|
663 |
+
70,
|
664 |
+
3,
|
665 |
+
0,
|
666 |
+
44,
|
667 |
+
0,
|
668 |
+
"LATENT"
|
669 |
+
],
|
670 |
+
[
|
671 |
+
75,
|
672 |
+
44,
|
673 |
+
0,
|
674 |
+
46,
|
675 |
+
0,
|
676 |
+
"IMAGE"
|
677 |
+
],
|
678 |
+
[
|
679 |
+
83,
|
680 |
+
44,
|
681 |
+
0,
|
682 |
+
52,
|
683 |
+
1,
|
684 |
+
"IMAGE"
|
685 |
+
],
|
686 |
+
[
|
687 |
+
84,
|
688 |
+
3,
|
689 |
+
0,
|
690 |
+
52,
|
691 |
+
0,
|
692 |
+
"LATENT"
|
693 |
+
],
|
694 |
+
[
|
695 |
+
85,
|
696 |
+
52,
|
697 |
+
0,
|
698 |
+
50,
|
699 |
+
0,
|
700 |
+
"IMAGE"
|
701 |
+
],
|
702 |
+
[
|
703 |
+
86,
|
704 |
+
52,
|
705 |
+
1,
|
706 |
+
51,
|
707 |
+
0,
|
708 |
+
"IMAGE"
|
709 |
+
],
|
710 |
+
[
|
711 |
+
88,
|
712 |
+
4,
|
713 |
+
2,
|
714 |
+
44,
|
715 |
+
1,
|
716 |
+
"VAE"
|
717 |
+
]
|
718 |
+
],
|
719 |
+
"groups": [],
|
720 |
+
"config": {},
|
721 |
+
"extra": {},
|
722 |
+
"version": 0.4
|
723 |
+
}
|
ComfyUI/custom_nodes/layerdiffuse/examples/layer_di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|
7 |
+
"type": "CLIPTextEncode",
|
8 |
+
"pos": [
|
9 |
+
413,
|
10 |
+
389
|
11 |
+
],
|
12 |
+
"size": {
|
13 |
+
"0": 425.27801513671875,
|
14 |
+
"1": 180.6060791015625
|
15 |
+
},
|
16 |
+
"flags": {},
|
17 |
+
"order": 4,
|
18 |
+
"mode": 0,
|
19 |
+
"inputs": [
|
20 |
+
{
|
21 |
+
"name": "clip",
|
22 |
+
"type": "CLIP",
|
23 |
+
"link": 5
|
24 |
+
}
|
25 |
+
],
|
26 |
+
"outputs": [
|
27 |
+
{
|
28 |
+
"name": "CONDITIONING",
|
29 |
+
"type": "CONDITIONING",
|
30 |
+
"links": [
|
31 |
+
65
|
32 |
+
],
|
33 |
+
"slot_index": 0
|
34 |
+
}
|
35 |
+
],
|
36 |
+
"properties": {
|
37 |
+
"Node name for S&R": "CLIPTextEncode"
|
38 |
+
},
|
39 |
+
"widgets_values": [
|
40 |
+
"text, watermark"
|
41 |
+
]
|
42 |
+
},
|
43 |
+
{
|
44 |
+
"id": 4,
|
45 |
+
"type": "CheckpointLoaderSimple",
|
46 |
+
"pos": [
|
47 |
+
5,
|
48 |
+
479
|
49 |
+
],
|
50 |
+
"size": {
|
51 |
+
"0": 315,
|
52 |
+
"1": 98
|
53 |
+
},
|
54 |
+
"flags": {},
|
55 |
+
"order": 0,
|
56 |
+
"mode": 0,
|
57 |
+
"outputs": [
|
58 |
+
{
|
59 |
+
"name": "MODEL",
|
60 |
+
"type": "MODEL",
|
61 |
+
"links": [
|
62 |
+
55
|
63 |
+
],
|
64 |
+
"slot_index": 0
|
65 |
+
},
|
66 |
+
{
|
67 |
+
"name": "CLIP",
|
68 |
+
"type": "CLIP",
|
69 |
+
"links": [
|
70 |
+
3,
|
71 |
+
5
|
72 |
+
],
|
73 |
+
"slot_index": 1
|
74 |
+
},
|
75 |
+
{
|
76 |
+
"name": "VAE",
|
77 |
+
"type": "VAE",
|
78 |
+
"links": [
|
79 |
+
88
|
80 |
+
],
|
81 |
+
"slot_index": 2
|
82 |
+
}
|
83 |
+
],
|
84 |
+
"properties": {
|
85 |
+
"Node name for S&R": "CheckpointLoaderSimple"
|
86 |
+
},
|
87 |
+
"widgets_values": [
|
88 |
+
"realisticVisionV20_v20.safetensors"
|
89 |
+
]
|
90 |
+
},
|
91 |
+
{
|
92 |
+
"id": 46,
|
93 |
+
"type": "PreviewImage",
|
94 |
+
"pos": [
|
95 |
+
1525,
|
96 |
+
183
|
97 |
+
],
|
98 |
+
"size": [
|
99 |
+
406.59525756835933,
|
100 |
+
340.5699157714844
|
101 |
+
],
|
102 |
+
"flags": {},
|
103 |
+
"order": 8,
|
104 |
+
"mode": 0,
|
105 |
+
"inputs": [
|
106 |
+
{
|
107 |
+
"name": "images",
|
108 |
+
"type": "IMAGE",
|
109 |
+
"link": 75
|
110 |
+
}
|
111 |
+
],
|
112 |
+
"properties": {
|
113 |
+
"Node name for S&R": "PreviewImage"
|
114 |
+
}
|
115 |
+
},
|
116 |
+
{
|
117 |
+
"id": 37,
|
118 |
+
"type": "LayeredDiffusionCondJointApply",
|
119 |
+
"pos": [
|
120 |
+
436,
|
121 |
+
-13
|
122 |
+
],
|
123 |
+
"size": {
|
124 |
+
"0": 388,
|
125 |
+
"1": 138
|
126 |
+
},
|
127 |
+
"flags": {},
|
128 |
+
"order": 5,
|
129 |
+
"mode": 0,
|
130 |
+
"inputs": [
|
131 |
+
{
|
132 |
+
"name": "model",
|
133 |
+
"type": "MODEL",
|
134 |
+
"link": 55,
|
135 |
+
"slot_index": 0
|
136 |
+
},
|
137 |
+
{
|
138 |
+
"name": "image",
|
139 |
+
"type": "IMAGE",
|
140 |
+
"link": 90,
|
141 |
+
"slot_index": 1
|
142 |
+
},
|
143 |
+
{
|
144 |
+
"name": "cond",
|
145 |
+
"type": "CONDITIONING",
|
146 |
+
"link": null
|
147 |
+
},
|
148 |
+
{
|
149 |
+
"name": "blended_cond",
|
150 |
+
"type": "CONDITIONING",
|
151 |
+
"link": null
|
152 |
+
}
|
153 |
+
],
|
154 |
+
"outputs": [
|
155 |
+
{
|
156 |
+
"name": "MODEL",
|
157 |
+
"type": "MODEL",
|
158 |
+
"links": [
|
159 |
+
56
|
160 |
+
],
|
161 |
+
"shape": 3,
|
162 |
+
"slot_index": 0
|
163 |
+
}
|
164 |
+
],
|
165 |
+
"properties": {
|
166 |
+
"Node name for S&R": "LayeredDiffusionCondJointApply"
|
167 |
+
},
|
168 |
+
"widgets_values": [
|
169 |
+
"SD15, Foreground, attn_sharing, Batch size (2N)"
|
170 |
+
],
|
171 |
+
"color": "#232",
|
172 |
+
"bgcolor": "#353"
|
173 |
+
},
|
174 |
+
{
|
175 |
+
"id": 5,
|
176 |
+
"type": "EmptyLatentImage",
|
177 |
+
"pos": [
|
178 |
+
465,
|
179 |
+
671
|
180 |
+
],
|
181 |
+
"size": {
|
182 |
+
"0": 315,
|
183 |
+
"1": 106
|
184 |
+
},
|
185 |
+
"flags": {},
|
186 |
+
"order": 1,
|
187 |
+
"mode": 0,
|
188 |
+
"outputs": [
|
189 |
+
{
|
190 |
+
"name": "LATENT",
|
191 |
+
"type": "LATENT",
|
192 |
+
"links": [
|
193 |
+
2
|
194 |
+
],
|
195 |
+
"slot_index": 0
|
196 |
+
}
|
197 |
+
],
|
198 |
+
"properties": {
|
199 |
+
"Node name for S&R": "EmptyLatentImage"
|
200 |
+
},
|
201 |
+
"widgets_values": [
|
202 |
+
512,
|
203 |
+
512,
|
204 |
+
4
|
205 |
+
]
|
206 |
+
},
|
207 |
+
{
|
208 |
+
"id": 6,
|
209 |
+
"type": "CLIPTextEncode",
|
210 |
+
"pos": [
|
211 |
+
415,
|
212 |
+
186
|
213 |
+
],
|
214 |
+
"size": {
|
215 |
+
"0": 422.84503173828125,
|
216 |
+
"1": 164.31304931640625
|
217 |
+
},
|
218 |
+
"flags": {},
|
219 |
+
"order": 3,
|
220 |
+
"mode": 0,
|
221 |
+
"inputs": [
|
222 |
+
{
|
223 |
+
"name": "clip",
|
224 |
+
"type": "CLIP",
|
225 |
+
"link": 3
|
226 |
+
}
|
227 |
+
],
|
228 |
+
"outputs": [
|
229 |
+
{
|
230 |
+
"name": "CONDITIONING",
|
231 |
+
"type": "CONDITIONING",
|
232 |
+
"links": [
|
233 |
+
64
|
234 |
+
],
|
235 |
+
"slot_index": 0
|
236 |
+
}
|
237 |
+
],
|
238 |
+
"properties": {
|
239 |
+
"Node name for S&R": "CLIPTextEncode"
|
240 |
+
},
|
241 |
+
"widgets_values": [
|
242 |
+
"\n"
|
243 |
+
]
|
244 |
+
},
|
245 |
+
{
|
246 |
+
"id": 3,
|
247 |
+
"type": "KSampler",
|
248 |
+
"pos": [
|
249 |
+
903,
|
250 |
+
180
|
251 |
+
],
|
252 |
+
"size": {
|
253 |
+
"0": 315,
|
254 |
+
"1": 262
|
255 |
+
},
|
256 |
+
"flags": {},
|
257 |
+
"order": 6,
|
258 |
+
"mode": 0,
|
259 |
+
"inputs": [
|
260 |
+
{
|
261 |
+
"name": "model",
|
262 |
+
"type": "MODEL",
|
263 |
+
"link": 56
|
264 |
+
},
|
265 |
+
{
|
266 |
+
"name": "positive",
|
267 |
+
"type": "CONDITIONING",
|
268 |
+
"link": 64
|
269 |
+
},
|
270 |
+
{
|
271 |
+
"name": "negative",
|
272 |
+
"type": "CONDITIONING",
|
273 |
+
"link": 65
|
274 |
+
},
|
275 |
+
{
|
276 |
+
"name": "latent_image",
|
277 |
+
"type": "LATENT",
|
278 |
+
"link": 2
|
279 |
+
}
|
280 |
+
],
|
281 |
+
"outputs": [
|
282 |
+
{
|
283 |
+
"name": "LATENT",
|
284 |
+
"type": "LATENT",
|
285 |
+
"links": [
|
286 |
+
70
|
287 |
+
],
|
288 |
+
"slot_index": 0
|
289 |
+
}
|
290 |
+
],
|
291 |
+
"properties": {
|
292 |
+
"Node name for S&R": "KSampler"
|
293 |
+
},
|
294 |
+
"widgets_values": [
|
295 |
+
748570836161213,
|
296 |
+
"randomize",
|
297 |
+
20,
|
298 |
+
8,
|
299 |
+
"euler",
|
300 |
+
"normal",
|
301 |
+
1
|
302 |
+
]
|
303 |
+
},
|
304 |
+
{
|
305 |
+
"id": 44,
|
306 |
+
"type": "VAEDecode",
|
307 |
+
"pos": [
|
308 |
+
1258,
|
309 |
+
184
|
310 |
+
],
|
311 |
+
"size": {
|
312 |
+
"0": 210,
|
313 |
+
"1": 46
|
314 |
+
},
|
315 |
+
"flags": {},
|
316 |
+
"order": 7,
|
317 |
+
"mode": 0,
|
318 |
+
"inputs": [
|
319 |
+
{
|
320 |
+
"name": "samples",
|
321 |
+
"type": "LATENT",
|
322 |
+
"link": 70
|
323 |
+
},
|
324 |
+
{
|
325 |
+
"name": "vae",
|
326 |
+
"type": "VAE",
|
327 |
+
"link": 88,
|
328 |
+
"slot_index": 1
|
329 |
+
}
|
330 |
+
],
|
331 |
+
"outputs": [
|
332 |
+
{
|
333 |
+
"name": "IMAGE",
|
334 |
+
"type": "IMAGE",
|
335 |
+
"links": [
|
336 |
+
75
|
337 |
+
],
|
338 |
+
"shape": 3,
|
339 |
+
"slot_index": 0
|
340 |
+
}
|
341 |
+
],
|
342 |
+
"properties": {
|
343 |
+
"Node name for S&R": "VAEDecode"
|
344 |
+
}
|
345 |
+
},
|
346 |
+
{
|
347 |
+
"id": 30,
|
348 |
+
"type": "LoadImage",
|
349 |
+
"pos": [
|
350 |
+
6,
|
351 |
+
5
|
352 |
+
],
|
353 |
+
"size": {
|
354 |
+
"0": 315,
|
355 |
+
"1": 314
|
356 |
+
},
|
357 |
+
"flags": {},
|
358 |
+
"order": 2,
|
359 |
+
"mode": 0,
|
360 |
+
"outputs": [
|
361 |
+
{
|
362 |
+
"name": "IMAGE",
|
363 |
+
"type": "IMAGE",
|
364 |
+
"links": [
|
365 |
+
90
|
366 |
+
],
|
367 |
+
"shape": 3,
|
368 |
+
"slot_index": 0
|
369 |
+
},
|
370 |
+
{
|
371 |
+
"name": "MASK",
|
372 |
+
"type": "MASK",
|
373 |
+
"links": null,
|
374 |
+
"shape": 3
|
375 |
+
}
|
376 |
+
],
|
377 |
+
"properties": {
|
378 |
+
"Node name for S&R": "LoadImage"
|
379 |
+
},
|
380 |
+
"widgets_values": [
|
381 |
+
"dog (2).png",
|
382 |
+
"image"
|
383 |
+
]
|
384 |
+
}
|
385 |
+
],
|
386 |
+
"links": [
|
387 |
+
[
|
388 |
+
2,
|
389 |
+
5,
|
390 |
+
0,
|
391 |
+
3,
|
392 |
+
3,
|
393 |
+
"LATENT"
|
394 |
+
],
|
395 |
+
[
|
396 |
+
3,
|
397 |
+
4,
|
398 |
+
1,
|
399 |
+
6,
|
400 |
+
0,
|
401 |
+
"CLIP"
|
402 |
+
],
|
403 |
+
[
|
404 |
+
5,
|
405 |
+
4,
|
406 |
+
1,
|
407 |
+
7,
|
408 |
+
0,
|
409 |
+
"CLIP"
|
410 |
+
],
|
411 |
+
[
|
412 |
+
55,
|
413 |
+
4,
|
414 |
+
0,
|
415 |
+
37,
|
416 |
+
0,
|
417 |
+
"MODEL"
|
418 |
+
],
|
419 |
+
[
|
420 |
+
56,
|
421 |
+
37,
|
422 |
+
0,
|
423 |
+
3,
|
424 |
+
0,
|
425 |
+
"MODEL"
|
426 |
+
],
|
427 |
+
[
|
428 |
+
64,
|
429 |
+
6,
|
430 |
+
0,
|
431 |
+
3,
|
432 |
+
1,
|
433 |
+
"CONDITIONING"
|
434 |
+
],
|
435 |
+
[
|
436 |
+
65,
|
437 |
+
7,
|
438 |
+
0,
|
439 |
+
3,
|
440 |
+
2,
|
441 |
+
"CONDITIONING"
|
442 |
+
],
|
443 |
+
[
|
444 |
+
70,
|
445 |
+
3,
|
446 |
+
0,
|
447 |
+
44,
|
448 |
+
0,
|
449 |
+
"LATENT"
|
450 |
+
],
|
451 |
+
[
|
452 |
+
75,
|
453 |
+
44,
|
454 |
+
0,
|
455 |
+
46,
|
456 |
+
0,
|
457 |
+
"IMAGE"
|
458 |
+
],
|
459 |
+
[
|
460 |
+
88,
|
461 |
+
4,
|
462 |
+
2,
|
463 |
+
44,
|
464 |
+
1,
|
465 |
+
"VAE"
|
466 |
+
],
|
467 |
+
[
|
468 |
+
90,
|
469 |
+
30,
|
470 |
+
0,
|
471 |
+
37,
|
472 |
+
1,
|
473 |
+
"IMAGE"
|
474 |
+
]
|
475 |
+
],
|
476 |
+
"groups": [],
|
477 |
+
"config": {},
|
478 |
+
"extra": {},
|
479 |
+
"version": 0.4
|
480 |
+
}
|
ComfyUI/custom_nodes/layerdiffuse/examples/layer_diffusion_diff_bg.json
ADDED
@@ -0,0 +1,750 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"last_node_id": 40,
|
3 |
+
"last_link_id": 67,
|
4 |
+
"nodes": [
|
5 |
+
{
|
6 |
+
"id": 4,
|
7 |
+
"type": "CheckpointLoaderSimple",
|
8 |
+
"pos": [
|
9 |
+
5,
|
10 |
+
479
|
11 |
+
],
|
12 |
+
"size": {
|
13 |
+
"0": 315,
|
14 |
+
"1": 98
|
15 |
+
},
|
16 |
+
"flags": {},
|
17 |
+
"order": 0,
|
18 |
+
"mode": 0,
|
19 |
+
"outputs": [
|
20 |
+
{
|
21 |
+
"name": "MODEL",
|
22 |
+
"type": "MODEL",
|
23 |
+
"links": [
|
24 |
+
55
|
25 |
+
],
|
26 |
+
"slot_index": 0
|
27 |
+
},
|
28 |
+
{
|
29 |
+
"name": "CLIP",
|
30 |
+
"type": "CLIP",
|
31 |
+
"links": [
|
32 |
+
3,
|
33 |
+
5
|
34 |
+
],
|
35 |
+
"slot_index": 1
|
36 |
+
},
|
37 |
+
{
|
38 |
+
"name": "VAE",
|
39 |
+
"type": "VAE",
|
40 |
+
"links": [
|
41 |
+
22,
|
42 |
+
49,
|
43 |
+
58
|
44 |
+
],
|
45 |
+
"slot_index": 2
|
46 |
+
}
|
47 |
+
],
|
48 |
+
"properties": {
|
49 |
+
"Node name for S&R": "CheckpointLoaderSimple"
|
50 |
+
},
|
51 |
+
"widgets_values": [
|
52 |
+
"juggernautXL_v8Rundiffusion.safetensors"
|
53 |
+
]
|
54 |
+
},
|
55 |
+
{
|
56 |
+
"id": 7,
|
57 |
+
"type": "CLIPTextEncode",
|
58 |
+
"pos": [
|
59 |
+
413,
|
60 |
+
389
|
61 |
+
],
|
62 |
+
"size": {
|
63 |
+
"0": 425.27801513671875,
|
64 |
+
"1": 180.6060791015625
|
65 |
+
},
|
66 |
+
"flags": {},
|
67 |
+
"order": 5,
|
68 |
+
"mode": 0,
|
69 |
+
"inputs": [
|
70 |
+
{
|
71 |
+
"name": "clip",
|
72 |
+
"type": "CLIP",
|
73 |
+
"link": 5
|
74 |
+
}
|
75 |
+
],
|
76 |
+
"outputs": [
|
77 |
+
{
|
78 |
+
"name": "CONDITIONING",
|
79 |
+
"type": "CONDITIONING",
|
80 |
+
"links": [
|
81 |
+
57
|
82 |
+
],
|
83 |
+
"slot_index": 0
|
84 |
+
}
|
85 |
+
],
|
86 |
+
"properties": {
|
87 |
+
"Node name for S&R": "CLIPTextEncode"
|
88 |
+
},
|
89 |
+
"widgets_values": [
|
90 |
+
"text, watermark"
|
91 |
+
]
|
92 |
+
},
|
93 |
+
{
|
94 |
+
"id": 5,
|
95 |
+
"type": "EmptyLatentImage",
|
96 |
+
"pos": [
|
97 |
+
475,
|
98 |
+
666
|
99 |
+
],
|
100 |
+
"size": {
|
101 |
+
"0": 315,
|
102 |
+
"1": 106
|
103 |
+
},
|
104 |
+
"flags": {},
|
105 |
+
"order": 1,
|
106 |
+
"mode": 0,
|
107 |
+
"outputs": [
|
108 |
+
{
|
109 |
+
"name": "LATENT",
|
110 |
+
"type": "LATENT",
|
111 |
+
"links": [
|
112 |
+
2
|
113 |
+
],
|
114 |
+
"slot_index": 0
|
115 |
+
}
|
116 |
+
],
|
117 |
+
"properties": {
|
118 |
+
"Node name for S&R": "EmptyLatentImage"
|
119 |
+
},
|
120 |
+
"widgets_values": [
|
121 |
+
1024,
|
122 |
+
1024,
|
123 |
+
1
|
124 |
+
]
|
125 |
+
},
|
126 |
+
{
|
127 |
+
"id": 39,
|
128 |
+
"type": "VAEEncode",
|
129 |
+
"pos": [
|
130 |
+
201,
|
131 |
+
-391
|
132 |
+
],
|
133 |
+
"size": {
|
134 |
+
"0": 210,
|
135 |
+
"1": 46
|
136 |
+
},
|
137 |
+
"flags": {},
|
138 |
+
"order": 6,
|
139 |
+
"mode": 0,
|
140 |
+
"inputs": [
|
141 |
+
{
|
142 |
+
"name": "pixels",
|
143 |
+
"type": "IMAGE",
|
144 |
+
"link": 59,
|
145 |
+
"slot_index": 0
|
146 |
+
},
|
147 |
+
{
|
148 |
+
"name": "vae",
|
149 |
+
"type": "VAE",
|
150 |
+
"link": 58,
|
151 |
+
"slot_index": 1
|
152 |
+
}
|
153 |
+
],
|
154 |
+
"outputs": [
|
155 |
+
{
|
156 |
+
"name": "LATENT",
|
157 |
+
"type": "LATENT",
|
158 |
+
"links": [
|
159 |
+
60
|
160 |
+
],
|
161 |
+
"shape": 3,
|
162 |
+
"slot_index": 0
|
163 |
+
}
|
164 |
+
],
|
165 |
+
"properties": {
|
166 |
+
"Node name for S&R": "VAEEncode"
|
167 |
+
}
|
168 |
+
},
|
169 |
+
{
|
170 |
+
"id": 29,
|
171 |
+
"type": "VAEEncode",
|
172 |
+
"pos": [
|
173 |
+
210,
|
174 |
+
-20
|
175 |
+
],
|
176 |
+
"size": {
|
177 |
+
"0": 210,
|
178 |
+
"1": 46
|
179 |
+
},
|
180 |
+
"flags": {},
|
181 |
+
"order": 7,
|
182 |
+
"mode": 0,
|
183 |
+
"inputs": [
|
184 |
+
{
|
185 |
+
"name": "pixels",
|
186 |
+
"type": "IMAGE",
|
187 |
+
"link": 53
|
188 |
+
},
|
189 |
+
{
|
190 |
+
"name": "vae",
|
191 |
+
"type": "VAE",
|
192 |
+
"link": 49,
|
193 |
+
"slot_index": 1
|
194 |
+
}
|
195 |
+
],
|
196 |
+
"outputs": [
|
197 |
+
{
|
198 |
+
"name": "LATENT",
|
199 |
+
"type": "LATENT",
|
200 |
+
"links": [
|
201 |
+
61
|
202 |
+
],
|
203 |
+
"shape": 3,
|
204 |
+
"slot_index": 0
|
205 |
+
}
|
206 |
+
],
|
207 |
+
"properties": {
|
208 |
+
"Node name for S&R": "VAEEncode"
|
209 |
+
}
|
210 |
+
},
|
211 |
+
{
|
212 |
+
"id": 38,
|
213 |
+
"type": "LoadImage",
|
214 |
+
"pos": [
|
215 |
+
-137,
|
216 |
+
-388
|
217 |
+
],
|
218 |
+
"size": {
|
219 |
+
"0": 288.47406005859375,
|
220 |
+
"1": 317.46051025390625
|
221 |
+
},
|
222 |
+
"flags": {},
|
223 |
+
"order": 2,
|
224 |
+
"mode": 0,
|
225 |
+
"outputs": [
|
226 |
+
{
|
227 |
+
"name": "IMAGE",
|
228 |
+
"type": "IMAGE",
|
229 |
+
"links": [
|
230 |
+
59
|
231 |
+
],
|
232 |
+
"shape": 3
|
233 |
+
},
|
234 |
+
{
|
235 |
+
"name": "MASK",
|
236 |
+
"type": "MASK",
|
237 |
+
"links": null,
|
238 |
+
"shape": 3
|
239 |
+
}
|
240 |
+
],
|
241 |
+
"properties": {
|
242 |
+
"Node name for S&R": "LoadImage"
|
243 |
+
},
|
244 |
+
"widgets_values": [
|
245 |
+
"old_man.png",
|
246 |
+
"image"
|
247 |
+
]
|
248 |
+
},
|
249 |
+
{
|
250 |
+
"id": 30,
|
251 |
+
"type": "LoadImage",
|
252 |
+
"pos": [
|
253 |
+
-146,
|
254 |
+
-22
|
255 |
+
],
|
256 |
+
"size": {
|
257 |
+
"0": 315,
|
258 |
+
"1": 314
|
259 |
+
},
|
260 |
+
"flags": {},
|
261 |
+
"order": 3,
|
262 |
+
"mode": 0,
|
263 |
+
"outputs": [
|
264 |
+
{
|
265 |
+
"name": "IMAGE",
|
266 |
+
"type": "IMAGE",
|
267 |
+
"links": [
|
268 |
+
53
|
269 |
+
],
|
270 |
+
"shape": 3,
|
271 |
+
"slot_index": 0
|
272 |
+
},
|
273 |
+
{
|
274 |
+
"name": "MASK",
|
275 |
+
"type": "MASK",
|
276 |
+
"links": null,
|
277 |
+
"shape": 3
|
278 |
+
}
|
279 |
+
],
|
280 |
+
"properties": {
|
281 |
+
"Node name for S&R": "LoadImage"
|
282 |
+
},
|
283 |
+
"widgets_values": [
|
284 |
+
"chair.png",
|
285 |
+
"image"
|
286 |
+
]
|
287 |
+
},
|
288 |
+
{
|
289 |
+
"id": 6,
|
290 |
+
"type": "CLIPTextEncode",
|
291 |
+
"pos": [
|
292 |
+
415,
|
293 |
+
186
|
294 |
+
],
|
295 |
+
"size": {
|
296 |
+
"0": 422.84503173828125,
|
297 |
+
"1": 164.31304931640625
|
298 |
+
},
|
299 |
+
"flags": {},
|
300 |
+
"order": 4,
|
301 |
+
"mode": 0,
|
302 |
+
"inputs": [
|
303 |
+
{
|
304 |
+
"name": "clip",
|
305 |
+
"type": "CLIP",
|
306 |
+
"link": 3
|
307 |
+
}
|
308 |
+
],
|
309 |
+
"outputs": [
|
310 |
+
{
|
311 |
+
"name": "CONDITIONING",
|
312 |
+
"type": "CONDITIONING",
|
313 |
+
"links": [
|
314 |
+
56
|
315 |
+
],
|
316 |
+
"slot_index": 0
|
317 |
+
}
|
318 |
+
],
|
319 |
+
"properties": {
|
320 |
+
"Node name for S&R": "CLIPTextEncode"
|
321 |
+
},
|
322 |
+
"widgets_values": [
|
323 |
+
"an old man sitting, high quality\n\n"
|
324 |
+
]
|
325 |
+
},
|
326 |
+
{
|
327 |
+
"id": 14,
|
328 |
+
"type": "VAEDecode",
|
329 |
+
"pos": [
|
330 |
+
1286,
|
331 |
+
187
|
332 |
+
],
|
333 |
+
"size": {
|
334 |
+
"0": 210,
|
335 |
+
"1": 46
|
336 |
+
},
|
337 |
+
"flags": {},
|
338 |
+
"order": 10,
|
339 |
+
"mode": 0,
|
340 |
+
"inputs": [
|
341 |
+
{
|
342 |
+
"name": "samples",
|
343 |
+
"type": "LATENT",
|
344 |
+
"link": 21
|
345 |
+
},
|
346 |
+
{
|
347 |
+
"name": "vae",
|
348 |
+
"type": "VAE",
|
349 |
+
"link": 22,
|
350 |
+
"slot_index": 1
|
351 |
+
}
|
352 |
+
],
|
353 |
+
"outputs": [
|
354 |
+
{
|
355 |
+
"name": "IMAGE",
|
356 |
+
"type": "IMAGE",
|
357 |
+
"links": [
|
358 |
+
65
|
359 |
+
],
|
360 |
+
"shape": 3,
|
361 |
+
"slot_index": 0
|
362 |
+
}
|
363 |
+
],
|
364 |
+
"properties": {
|
365 |
+
"Node name for S&R": "VAEDecode"
|
366 |
+
}
|
367 |
+
},
|
368 |
+
{
|
369 |
+
"id": 3,
|
370 |
+
"type": "KSampler",
|
371 |
+
"pos": [
|
372 |
+
913,
|
373 |
+
182
|
374 |
+
],
|
375 |
+
"size": {
|
376 |
+
"0": 315,
|
377 |
+
"1": 262
|
378 |
+
},
|
379 |
+
"flags": {},
|
380 |
+
"order": 9,
|
381 |
+
"mode": 0,
|
382 |
+
"inputs": [
|
383 |
+
{
|
384 |
+
"name": "model",
|
385 |
+
"type": "MODEL",
|
386 |
+
"link": 62
|
387 |
+
},
|
388 |
+
{
|
389 |
+
"name": "positive",
|
390 |
+
"type": "CONDITIONING",
|
391 |
+
"link": 63
|
392 |
+
},
|
393 |
+
{
|
394 |
+
"name": "negative",
|
395 |
+
"type": "CONDITIONING",
|
396 |
+
"link": 64
|
397 |
+
},
|
398 |
+
{
|
399 |
+
"name": "latent_image",
|
400 |
+
"type": "LATENT",
|
401 |
+
"link": 2
|
402 |
+
}
|
403 |
+
],
|
404 |
+
"outputs": [
|
405 |
+
{
|
406 |
+
"name": "LATENT",
|
407 |
+
"type": "LATENT",
|
408 |
+
"links": [
|
409 |
+
21,
|
410 |
+
67
|
411 |
+
],
|
412 |
+
"slot_index": 0
|
413 |
+
}
|
414 |
+
],
|
415 |
+
"properties": {
|
416 |
+
"Node name for S&R": "KSampler"
|
417 |
+
},
|
418 |
+
"widgets_values": [
|
419 |
+
462370085958750,
|
420 |
+
"fixed",
|
421 |
+
20,
|
422 |
+
8,
|
423 |
+
"euler",
|
424 |
+
"normal",
|
425 |
+
1
|
426 |
+
]
|
427 |
+
},
|
428 |
+
{
|
429 |
+
"id": 20,
|
430 |
+
"type": "PreviewImage",
|
431 |
+
"pos": [
|
432 |
+
1800,
|
433 |
+
190
|
434 |
+
],
|
435 |
+
"size": {
|
436 |
+
"0": 611.2340087890625,
|
437 |
+
"1": 633.9354858398438
|
438 |
+
},
|
439 |
+
"flags": {},
|
440 |
+
"order": 12,
|
441 |
+
"mode": 0,
|
442 |
+
"inputs": [
|
443 |
+
{
|
444 |
+
"name": "images",
|
445 |
+
"type": "IMAGE",
|
446 |
+
"link": 66
|
447 |
+
}
|
448 |
+
],
|
449 |
+
"properties": {
|
450 |
+
"Node name for S&R": "PreviewImage"
|
451 |
+
}
|
452 |
+
},
|
453 |
+
{
|
454 |
+
"id": 37,
|
455 |
+
"type": "LayeredDiffusionDiffApply",
|
456 |
+
"pos": [
|
457 |
+
457,
|
458 |
+
-37
|
459 |
+
],
|
460 |
+
"size": {
|
461 |
+
"0": 342.5999755859375,
|
462 |
+
"1": 162
|
463 |
+
},
|
464 |
+
"flags": {},
|
465 |
+
"order": 8,
|
466 |
+
"mode": 0,
|
467 |
+
"inputs": [
|
468 |
+
{
|
469 |
+
"name": "model",
|
470 |
+
"type": "MODEL",
|
471 |
+
"link": 55,
|
472 |
+
"slot_index": 0
|
473 |
+
},
|
474 |
+
{
|
475 |
+
"name": "cond",
|
476 |
+
"type": "CONDITIONING",
|
477 |
+
"link": 56,
|
478 |
+
"slot_index": 1
|
479 |
+
},
|
480 |
+
{
|
481 |
+
"name": "uncond",
|
482 |
+
"type": "CONDITIONING",
|
483 |
+
"link": 57,
|
484 |
+
"slot_index": 2
|
485 |
+
},
|
486 |
+
{
|
487 |
+
"name": "blended_latent",
|
488 |
+
"type": "LATENT",
|
489 |
+
"link": 60
|
490 |
+
},
|
491 |
+
{
|
492 |
+
"name": "latent",
|
493 |
+
"type": "LATENT",
|
494 |
+
"link": 61
|
495 |
+
}
|
496 |
+
],
|
497 |
+
"outputs": [
|
498 |
+
{
|
499 |
+
"name": "MODEL",
|
500 |
+
"type": "MODEL",
|
501 |
+
"links": [
|
502 |
+
62
|
503 |
+
],
|
504 |
+
"shape": 3,
|
505 |
+
"slot_index": 0
|
506 |
+
},
|
507 |
+
{
|
508 |
+
"name": "CONDITIONING",
|
509 |
+
"type": "CONDITIONING",
|
510 |
+
"links": [
|
511 |
+
63
|
512 |
+
],
|
513 |
+
"shape": 3,
|
514 |
+
"slot_index": 1
|
515 |
+
},
|
516 |
+
{
|
517 |
+
"name": "CONDITIONING",
|
518 |
+
"type": "CONDITIONING",
|
519 |
+
"links": [
|
520 |
+
64
|
521 |
+
],
|
522 |
+
"shape": 3,
|
523 |
+
"slot_index": 2
|
524 |
+
}
|
525 |
+
],
|
526 |
+
"properties": {
|
527 |
+
"Node name for S&R": "LayeredDiffusionDiffApply"
|
528 |
+
},
|
529 |
+
"widgets_values": [
|
530 |
+
"SDXL, Background",
|
531 |
+
1
|
532 |
+
],
|
533 |
+
"color": "#232",
|
534 |
+
"bgcolor": "#353"
|
535 |
+
},
|
536 |
+
{
|
537 |
+
"id": 40,
|
538 |
+
"type": "LayeredDiffusionDecodeRGBA",
|
539 |
+
"pos": [
|
540 |
+
1533,
|
541 |
+
189
|
542 |
+
],
|
543 |
+
"size": {
|
544 |
+
"0": 243.60000610351562,
|
545 |
+
"1": 102
|
546 |
+
},
|
547 |
+
"flags": {},
|
548 |
+
"order": 11,
|
549 |
+
"mode": 0,
|
550 |
+
"inputs": [
|
551 |
+
{
|
552 |
+
"name": "samples",
|
553 |
+
"type": "LATENT",
|
554 |
+
"link": 67
|
555 |
+
},
|
556 |
+
{
|
557 |
+
"name": "images",
|
558 |
+
"type": "IMAGE",
|
559 |
+
"link": 65
|
560 |
+
}
|
561 |
+
],
|
562 |
+
"outputs": [
|
563 |
+
{
|
564 |
+
"name": "IMAGE",
|
565 |
+
"type": "IMAGE",
|
566 |
+
"links": [
|
567 |
+
66
|
568 |
+
],
|
569 |
+
"shape": 3,
|
570 |
+
"slot_index": 0
|
571 |
+
}
|
572 |
+
],
|
573 |
+
"properties": {
|
574 |
+
"Node name for S&R": "LayeredDiffusionDecodeRGBA"
|
575 |
+
},
|
576 |
+
"widgets_values": [
|
577 |
+
"SDXL",
|
578 |
+
16
|
579 |
+
],
|
580 |
+
"color": "#232",
|
581 |
+
"bgcolor": "#353"
|
582 |
+
}
|
583 |
+
],
|
584 |
+
"links": [
|
585 |
+
[
|
586 |
+
2,
|
587 |
+
5,
|
588 |
+
0,
|
589 |
+
3,
|
590 |
+
3,
|
591 |
+
"LATENT"
|
592 |
+
],
|
593 |
+
[
|
594 |
+
3,
|
595 |
+
4,
|
596 |
+
1,
|
597 |
+
6,
|
598 |
+
0,
|
599 |
+
"CLIP"
|
600 |
+
],
|
601 |
+
[
|
602 |
+
5,
|
603 |
+
4,
|
604 |
+
1,
|
605 |
+
7,
|
606 |
+
0,
|
607 |
+
"CLIP"
|
608 |
+
],
|
609 |
+
[
|
610 |
+
21,
|
611 |
+
3,
|
612 |
+
0,
|
613 |
+
14,
|
614 |
+
0,
|
615 |
+
"LATENT"
|
616 |
+
],
|
617 |
+
[
|
618 |
+
22,
|
619 |
+
4,
|
620 |
+
2,
|
621 |
+
14,
|
622 |
+
1,
|
623 |
+
"VAE"
|
624 |
+
],
|
625 |
+
[
|
626 |
+
49,
|
627 |
+
4,
|
628 |
+
2,
|
629 |
+
29,
|
630 |
+
1,
|
631 |
+
"VAE"
|
632 |
+
],
|
633 |
+
[
|
634 |
+
53,
|
635 |
+
30,
|
636 |
+
0,
|
637 |
+
29,
|
638 |
+
0,
|
639 |
+
"IMAGE"
|
640 |
+
],
|
641 |
+
[
|
642 |
+
55,
|
643 |
+
4,
|
644 |
+
0,
|
645 |
+
37,
|
646 |
+
0,
|
647 |
+
"MODEL"
|
648 |
+
],
|
649 |
+
[
|
650 |
+
56,
|
651 |
+
6,
|
652 |
+
0,
|
653 |
+
37,
|
654 |
+
1,
|
655 |
+
"CONDITIONING"
|
656 |
+
],
|
657 |
+
[
|
658 |
+
57,
|
659 |
+
7,
|
660 |
+
0,
|
661 |
+
37,
|
662 |
+
2,
|
663 |
+
"CONDITIONING"
|
664 |
+
],
|
665 |
+
[
|
666 |
+
58,
|
667 |
+
4,
|
668 |
+
2,
|
669 |
+
39,
|
670 |
+
1,
|
671 |
+
"VAE"
|
672 |
+
],
|
673 |
+
[
|
674 |
+
59,
|
675 |
+
38,
|
676 |
+
0,
|
677 |
+
39,
|
678 |
+
0,
|
679 |
+
"IMAGE"
|
680 |
+
],
|
681 |
+
[
|
682 |
+
60,
|
683 |
+
39,
|
684 |
+
0,
|
685 |
+
37,
|
686 |
+
3,
|
687 |
+
"LATENT"
|
688 |
+
],
|
689 |
+
[
|
690 |
+
61,
|
691 |
+
29,
|
692 |
+
0,
|
693 |
+
37,
|
694 |
+
4,
|
695 |
+
"LATENT"
|
696 |
+
],
|
697 |
+
[
|
698 |
+
62,
|
699 |
+
37,
|
700 |
+
0,
|
701 |
+
3,
|
702 |
+
0,
|
703 |
+
"MODEL"
|
704 |
+
],
|
705 |
+
[
|
706 |
+
63,
|
707 |
+
37,
|
708 |
+
1,
|
709 |
+
3,
|
710 |
+
1,
|
711 |
+
"CONDITIONING"
|
712 |
+
],
|
713 |
+
[
|
714 |
+
64,
|
715 |
+
37,
|
716 |
+
2,
|
717 |
+
3,
|
718 |
+
2,
|
719 |
+
"CONDITIONING"
|
720 |
+
],
|
721 |
+
[
|
722 |
+
65,
|
723 |
+
14,
|
724 |
+
0,
|
725 |
+
40,
|
726 |
+
1,
|
727 |
+
"IMAGE"
|
728 |
+
],
|
729 |
+
[
|
730 |
+
66,
|
731 |
+
40,
|
732 |
+
0,
|
733 |
+
20,
|
734 |
+
0,
|
735 |
+
"IMAGE"
|
736 |
+
],
|
737 |
+
[
|
738 |
+
67,
|
739 |
+
3,
|
740 |
+
0,
|
741 |
+
40,
|
742 |
+
0,
|
743 |
+
"LATENT"
|
744 |
+
]
|
745 |
+
],
|
746 |
+
"groups": [],
|
747 |
+
"config": {},
|
748 |
+
"extra": {},
|
749 |
+
"version": 0.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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"last_node_id": 45,
|
3 |
+
"last_link_id": 86,
|
4 |
+
"nodes": [
|
5 |
+
{
|
6 |
+
"id": 5,
|
7 |
+
"type": "EmptyLatentImage",
|
8 |
+
"pos": [
|
9 |
+
475,
|
10 |
+
666
|
11 |
+
],
|
12 |
+
"size": {
|
13 |
+
"0": 315,
|
14 |
+
"1": 106
|
15 |
+
},
|
16 |
+
"flags": {},
|
17 |
+
"order": 0,
|
18 |
+
"mode": 0,
|
19 |
+
"outputs": [
|
20 |
+
{
|
21 |
+
"name": "LATENT",
|
22 |
+
"type": "LATENT",
|
23 |
+
"links": [
|
24 |
+
2
|
25 |
+
],
|
26 |
+
"slot_index": 0
|
27 |
+
}
|
28 |
+
],
|
29 |
+
"properties": {
|
30 |
+
"Node name for S&R": "EmptyLatentImage"
|
31 |
+
},
|
32 |
+
"widgets_values": [
|
33 |
+
1024,
|
34 |
+
1024,
|
35 |
+
1
|
36 |
+
]
|
37 |
+
},
|
38 |
+
{
|
39 |
+
"id": 38,
|
40 |
+
"type": "LoadImage",
|
41 |
+
"pos": [
|
42 |
+
-137,
|
43 |
+
-388
|
44 |
+
],
|
45 |
+
"size": {
|
46 |
+
"0": 288.47406005859375,
|
47 |
+
"1": 317.46051025390625
|
48 |
+
},
|
49 |
+
"flags": {},
|
50 |
+
"order": 1,
|
51 |
+
"mode": 0,
|
52 |
+
"outputs": [
|
53 |
+
{
|
54 |
+
"name": "IMAGE",
|
55 |
+
"type": "IMAGE",
|
56 |
+
"links": [
|
57 |
+
59
|
58 |
+
],
|
59 |
+
"shape": 3
|
60 |
+
},
|
61 |
+
{
|
62 |
+
"name": "MASK",
|
63 |
+
"type": "MASK",
|
64 |
+
"links": null,
|
65 |
+
"shape": 3
|
66 |
+
}
|
67 |
+
],
|
68 |
+
"properties": {
|
69 |
+
"Node name for S&R": "LoadImage"
|
70 |
+
},
|
71 |
+
"widgets_values": [
|
72 |
+
"blended.png",
|
73 |
+
"image"
|
74 |
+
]
|
75 |
+
},
|
76 |
+
{
|
77 |
+
"id": 39,
|
78 |
+
"type": "VAEEncode",
|
79 |
+
"pos": [
|
80 |
+
201,
|
81 |
+
-391
|
82 |
+
],
|
83 |
+
"size": {
|
84 |
+
"0": 210,
|
85 |
+
"1": 46
|
86 |
+
},
|
87 |
+
"flags": {},
|
88 |
+
"order": 7,
|
89 |
+
"mode": 0,
|
90 |
+
"inputs": [
|
91 |
+
{
|
92 |
+
"name": "pixels",
|
93 |
+
"type": "IMAGE",
|
94 |
+
"link": 59,
|
95 |
+
"slot_index": 0
|
96 |
+
},
|
97 |
+
{
|
98 |
+
"name": "vae",
|
99 |
+
"type": "VAE",
|
100 |
+
"link": 58,
|
101 |
+
"slot_index": 1
|
102 |
+
}
|
103 |
+
],
|
104 |
+
"outputs": [
|
105 |
+
{
|
106 |
+
"name": "LATENT",
|
107 |
+
"type": "LATENT",
|
108 |
+
"links": [
|
109 |
+
60
|
110 |
+
],
|
111 |
+
"shape": 3,
|
112 |
+
"slot_index": 0
|
113 |
+
}
|
114 |
+
],
|
115 |
+
"properties": {
|
116 |
+
"Node name for S&R": "VAEEncode"
|
117 |
+
}
|
118 |
+
},
|
119 |
+
{
|
120 |
+
"id": 29,
|
121 |
+
"type": "VAEEncode",
|
122 |
+
"pos": [
|
123 |
+
210,
|
124 |
+
-20
|
125 |
+
],
|
126 |
+
"size": {
|
127 |
+
"0": 210,
|
128 |
+
"1": 46
|
129 |
+
},
|
130 |
+
"flags": {},
|
131 |
+
"order": 6,
|
132 |
+
"mode": 0,
|
133 |
+
"inputs": [
|
134 |
+
{
|
135 |
+
"name": "pixels",
|
136 |
+
"type": "IMAGE",
|
137 |
+
"link": 53
|
138 |
+
},
|
139 |
+
{
|
140 |
+
"name": "vae",
|
141 |
+
"type": "VAE",
|
142 |
+
"link": 49,
|
143 |
+
"slot_index": 1
|
144 |
+
}
|
145 |
+
],
|
146 |
+
"outputs": [
|
147 |
+
{
|
148 |
+
"name": "LATENT",
|
149 |
+
"type": "LATENT",
|
150 |
+
"links": [
|
151 |
+
61
|
152 |
+
],
|
153 |
+
"shape": 3,
|
154 |
+
"slot_index": 0
|
155 |
+
}
|
156 |
+
],
|
157 |
+
"properties": {
|
158 |
+
"Node name for S&R": "VAEEncode"
|
159 |
+
}
|
160 |
+
},
|
161 |
+
{
|
162 |
+
"id": 30,
|
163 |
+
"type": "LoadImage",
|
164 |
+
"pos": [
|
165 |
+
-146,
|
166 |
+
-22
|
167 |
+
],
|
168 |
+
"size": {
|
169 |
+
"0": 315,
|
170 |
+
"1": 314
|
171 |
+
},
|
172 |
+
"flags": {},
|
173 |
+
"order": 2,
|
174 |
+
"mode": 0,
|
175 |
+
"outputs": [
|
176 |
+
{
|
177 |
+
"name": "IMAGE",
|
178 |
+
"type": "IMAGE",
|
179 |
+
"links": [
|
180 |
+
53
|
181 |
+
],
|
182 |
+
"shape": 3,
|
183 |
+
"slot_index": 0
|
184 |
+
},
|
185 |
+
{
|
186 |
+
"name": "MASK",
|
187 |
+
"type": "MASK",
|
188 |
+
"links": null,
|
189 |
+
"shape": 3
|
190 |
+
}
|
191 |
+
],
|
192 |
+
"properties": {
|
193 |
+
"Node name for S&R": "LoadImage"
|
194 |
+
},
|
195 |
+
"widgets_values": [
|
196 |
+
"dog.png",
|
197 |
+
"image"
|
198 |
+
]
|
199 |
+
},
|
200 |
+
{
|
201 |
+
"id": 6,
|
202 |
+
"type": "CLIPTextEncode",
|
203 |
+
"pos": [
|
204 |
+
415,
|
205 |
+
186
|
206 |
+
],
|
207 |
+
"size": {
|
208 |
+
"0": 422.84503173828125,
|
209 |
+
"1": 164.31304931640625
|
210 |
+
},
|
211 |
+
"flags": {},
|
212 |
+
"order": 4,
|
213 |
+
"mode": 0,
|
214 |
+
"inputs": [
|
215 |
+
{
|
216 |
+
"name": "clip",
|
217 |
+
"type": "CLIP",
|
218 |
+
"link": 3
|
219 |
+
}
|
220 |
+
],
|
221 |
+
"outputs": [
|
222 |
+
{
|
223 |
+
"name": "CONDITIONING",
|
224 |
+
"type": "CONDITIONING",
|
225 |
+
"links": [
|
226 |
+
56,
|
227 |
+
81
|
228 |
+
],
|
229 |
+
"slot_index": 0
|
230 |
+
}
|
231 |
+
],
|
232 |
+
"properties": {
|
233 |
+
"Node name for S&R": "CLIPTextEncode"
|
234 |
+
},
|
235 |
+
"widgets_values": [
|
236 |
+
"a room, high quality\n\n"
|
237 |
+
]
|
238 |
+
},
|
239 |
+
{
|
240 |
+
"id": 7,
|
241 |
+
"type": "CLIPTextEncode",
|
242 |
+
"pos": [
|
243 |
+
413,
|
244 |
+
389
|
245 |
+
],
|
246 |
+
"size": {
|
247 |
+
"0": 425.27801513671875,
|
248 |
+
"1": 180.6060791015625
|
249 |
+
},
|
250 |
+
"flags": {},
|
251 |
+
"order": 5,
|
252 |
+
"mode": 0,
|
253 |
+
"inputs": [
|
254 |
+
{
|
255 |
+
"name": "clip",
|
256 |
+
"type": "CLIP",
|
257 |
+
"link": 5
|
258 |
+
}
|
259 |
+
],
|
260 |
+
"outputs": [
|
261 |
+
{
|
262 |
+
"name": "CONDITIONING",
|
263 |
+
"type": "CONDITIONING",
|
264 |
+
"links": [
|
265 |
+
57,
|
266 |
+
82
|
267 |
+
],
|
268 |
+
"slot_index": 0
|
269 |
+
}
|
270 |
+
],
|
271 |
+
"properties": {
|
272 |
+
"Node name for S&R": "CLIPTextEncode"
|
273 |
+
},
|
274 |
+
"widgets_values": [
|
275 |
+
"text, watermark"
|
276 |
+
]
|
277 |
+
},
|
278 |
+
{
|
279 |
+
"id": 42,
|
280 |
+
"type": "PreviewImage",
|
281 |
+
"pos": [
|
282 |
+
1830,
|
283 |
+
-500
|
284 |
+
],
|
285 |
+
"size": {
|
286 |
+
"0": 611.2340087890625,
|
287 |
+
"1": 633.9354858398438
|
288 |
+
},
|
289 |
+
"flags": {},
|
290 |
+
"order": 12,
|
291 |
+
"mode": 0,
|
292 |
+
"inputs": [
|
293 |
+
{
|
294 |
+
"name": "images",
|
295 |
+
"type": "IMAGE",
|
296 |
+
"link": 76
|
297 |
+
}
|
298 |
+
],
|
299 |
+
"properties": {
|
300 |
+
"Node name for S&R": "PreviewImage"
|
301 |
+
}
|
302 |
+
},
|
303 |
+
{
|
304 |
+
"id": 20,
|
305 |
+
"type": "PreviewImage",
|
306 |
+
"pos": [
|
307 |
+
1830,
|
308 |
+
186
|
309 |
+
],
|
310 |
+
"size": {
|
311 |
+
"0": 611.2340087890625,
|
312 |
+
"1": 633.9354858398438
|
313 |
+
},
|
314 |
+
"flags": {},
|
315 |
+
"order": 14,
|
316 |
+
"mode": 0,
|
317 |
+
"inputs": [
|
318 |
+
{
|
319 |
+
"name": "images",
|
320 |
+
"type": "IMAGE",
|
321 |
+
"link": 29
|
322 |
+
}
|
323 |
+
],
|
324 |
+
"properties": {
|
325 |
+
"Node name for S&R": "PreviewImage"
|
326 |
+
}
|
327 |
+
},
|
328 |
+
{
|
329 |
+
"id": 4,
|
330 |
+
"type": "CheckpointLoaderSimple",
|
331 |
+
"pos": [
|
332 |
+
5,
|
333 |
+
479
|
334 |
+
],
|
335 |
+
"size": {
|
336 |
+
"0": 315,
|
337 |
+
"1": 98
|
338 |
+
},
|
339 |
+
"flags": {},
|
340 |
+
"order": 3,
|
341 |
+
"mode": 0,
|
342 |
+
"outputs": [
|
343 |
+
{
|
344 |
+
"name": "MODEL",
|
345 |
+
"type": "MODEL",
|
346 |
+
"links": [
|
347 |
+
55,
|
348 |
+
80
|
349 |
+
],
|
350 |
+
"slot_index": 0
|
351 |
+
},
|
352 |
+
{
|
353 |
+
"name": "CLIP",
|
354 |
+
"type": "CLIP",
|
355 |
+
"links": [
|
356 |
+
3,
|
357 |
+
5
|
358 |
+
],
|
359 |
+
"slot_index": 1
|
360 |
+
},
|
361 |
+
{
|
362 |
+
"name": "VAE",
|
363 |
+
"type": "VAE",
|
364 |
+
"links": [
|
365 |
+
22,
|
366 |
+
49,
|
367 |
+
58,
|
368 |
+
75
|
369 |
+
],
|
370 |
+
"slot_index": 2
|
371 |
+
}
|
372 |
+
],
|
373 |
+
"properties": {
|
374 |
+
"Node name for S&R": "CheckpointLoaderSimple"
|
375 |
+
},
|
376 |
+
"widgets_values": [
|
377 |
+
"juggernautXL_v8Rundiffusion.safetensors"
|
378 |
+
]
|
379 |
+
},
|
380 |
+
{
|
381 |
+
"id": 41,
|
382 |
+
"type": "VAEDecode",
|
383 |
+
"pos": [
|
384 |
+
1600,
|
385 |
+
-500
|
386 |
+
],
|
387 |
+
"size": {
|
388 |
+
"0": 210,
|
389 |
+
"1": 46
|
390 |
+
},
|
391 |
+
"flags": {},
|
392 |
+
"order": 10,
|
393 |
+
"mode": 0,
|
394 |
+
"inputs": [
|
395 |
+
{
|
396 |
+
"name": "samples",
|
397 |
+
"type": "LATENT",
|
398 |
+
"link": 77
|
399 |
+
},
|
400 |
+
{
|
401 |
+
"name": "vae",
|
402 |
+
"type": "VAE",
|
403 |
+
"link": 75,
|
404 |
+
"slot_index": 1
|
405 |
+
}
|
406 |
+
],
|
407 |
+
"outputs": [
|
408 |
+
{
|
409 |
+
"name": "IMAGE",
|
410 |
+
"type": "IMAGE",
|
411 |
+
"links": [
|
412 |
+
76
|
413 |
+
],
|
414 |
+
"shape": 3,
|
415 |
+
"slot_index": 0
|
416 |
+
}
|
417 |
+
],
|
418 |
+
"properties": {
|
419 |
+
"Node name for S&R": "VAEDecode"
|
420 |
+
}
|
421 |
+
},
|
422 |
+
{
|
423 |
+
"id": 14,
|
424 |
+
"type": "VAEDecode",
|
425 |
+
"pos": [
|
426 |
+
1588,
|
427 |
+
186
|
428 |
+
],
|
429 |
+
"size": {
|
430 |
+
"0": 210,
|
431 |
+
"1": 46
|
432 |
+
},
|
433 |
+
"flags": {},
|
434 |
+
"order": 13,
|
435 |
+
"mode": 0,
|
436 |
+
"inputs": [
|
437 |
+
{
|
438 |
+
"name": "samples",
|
439 |
+
"type": "LATENT",
|
440 |
+
"link": 85
|
441 |
+
},
|
442 |
+
{
|
443 |
+
"name": "vae",
|
444 |
+
"type": "VAE",
|
445 |
+
"link": 22,
|
446 |
+
"slot_index": 1
|
447 |
+
}
|
448 |
+
],
|
449 |
+
"outputs": [
|
450 |
+
{
|
451 |
+
"name": "IMAGE",
|
452 |
+
"type": "IMAGE",
|
453 |
+
"links": [
|
454 |
+
29
|
455 |
+
],
|
456 |
+
"shape": 3,
|
457 |
+
"slot_index": 0
|
458 |
+
}
|
459 |
+
],
|
460 |
+
"properties": {
|
461 |
+
"Node name for S&R": "VAEDecode"
|
462 |
+
}
|
463 |
+
},
|
464 |
+
{
|
465 |
+
"id": 3,
|
466 |
+
"type": "KSampler",
|
467 |
+
"pos": [
|
468 |
+
913,
|
469 |
+
181
|
470 |
+
],
|
471 |
+
"size": {
|
472 |
+
"0": 315,
|
473 |
+
"1": 262
|
474 |
+
},
|
475 |
+
"flags": {},
|
476 |
+
"order": 9,
|
477 |
+
"mode": 0,
|
478 |
+
"inputs": [
|
479 |
+
{
|
480 |
+
"name": "model",
|
481 |
+
"type": "MODEL",
|
482 |
+
"link": 62
|
483 |
+
},
|
484 |
+
{
|
485 |
+
"name": "positive",
|
486 |
+
"type": "CONDITIONING",
|
487 |
+
"link": 63
|
488 |
+
},
|
489 |
+
{
|
490 |
+
"name": "negative",
|
491 |
+
"type": "CONDITIONING",
|
492 |
+
"link": 64
|
493 |
+
},
|
494 |
+
{
|
495 |
+
"name": "latent_image",
|
496 |
+
"type": "LATENT",
|
497 |
+
"link": 2
|
498 |
+
}
|
499 |
+
],
|
500 |
+
"outputs": [
|
501 |
+
{
|
502 |
+
"name": "LATENT",
|
503 |
+
"type": "LATENT",
|
504 |
+
"links": [
|
505 |
+
77,
|
506 |
+
86
|
507 |
+
],
|
508 |
+
"slot_index": 0
|
509 |
+
}
|
510 |
+
],
|
511 |
+
"properties": {
|
512 |
+
"Node name for S&R": "KSampler"
|
513 |
+
},
|
514 |
+
"widgets_values": [
|
515 |
+
462370085958750,
|
516 |
+
"fixed",
|
517 |
+
20,
|
518 |
+
8,
|
519 |
+
"euler",
|
520 |
+
"normal",
|
521 |
+
1
|
522 |
+
]
|
523 |
+
},
|
524 |
+
{
|
525 |
+
"id": 45,
|
526 |
+
"type": "KSamplerAdvanced",
|
527 |
+
"pos": [
|
528 |
+
1249,
|
529 |
+
179
|
530 |
+
],
|
531 |
+
"size": {
|
532 |
+
"0": 315,
|
533 |
+
"1": 334
|
534 |
+
},
|
535 |
+
"flags": {},
|
536 |
+
"order": 11,
|
537 |
+
"mode": 0,
|
538 |
+
"inputs": [
|
539 |
+
{
|
540 |
+
"name": "model",
|
541 |
+
"type": "MODEL",
|
542 |
+
"link": 80
|
543 |
+
},
|
544 |
+
{
|
545 |
+
"name": "positive",
|
546 |
+
"type": "CONDITIONING",
|
547 |
+
"link": 81
|
548 |
+
},
|
549 |
+
{
|
550 |
+
"name": "negative",
|
551 |
+
"type": "CONDITIONING",
|
552 |
+
"link": 82
|
553 |
+
},
|
554 |
+
{
|
555 |
+
"name": "latent_image",
|
556 |
+
"type": "LATENT",
|
557 |
+
"link": 86
|
558 |
+
}
|
559 |
+
],
|
560 |
+
"outputs": [
|
561 |
+
{
|
562 |
+
"name": "LATENT",
|
563 |
+
"type": "LATENT",
|
564 |
+
"links": [
|
565 |
+
85
|
566 |
+
],
|
567 |
+
"shape": 3,
|
568 |
+
"slot_index": 0
|
569 |
+
}
|
570 |
+
],
|
571 |
+
"properties": {
|
572 |
+
"Node name for S&R": "KSamplerAdvanced"
|
573 |
+
},
|
574 |
+
"widgets_values": [
|
575 |
+
"enable",
|
576 |
+
0,
|
577 |
+
"fixed",
|
578 |
+
20,
|
579 |
+
8,
|
580 |
+
"euler",
|
581 |
+
"normal",
|
582 |
+
10,
|
583 |
+
10000,
|
584 |
+
"disable"
|
585 |
+
]
|
586 |
+
},
|
587 |
+
{
|
588 |
+
"id": 37,
|
589 |
+
"type": "LayeredDiffusionDiffApply",
|
590 |
+
"pos": [
|
591 |
+
456,
|
592 |
+
-44
|
593 |
+
],
|
594 |
+
"size": {
|
595 |
+
"0": 342.5999755859375,
|
596 |
+
"1": 186
|
597 |
+
},
|
598 |
+
"flags": {},
|
599 |
+
"order": 8,
|
600 |
+
"mode": 0,
|
601 |
+
"inputs": [
|
602 |
+
{
|
603 |
+
"name": "model",
|
604 |
+
"type": "MODEL",
|
605 |
+
"link": 55,
|
606 |
+
"slot_index": 0
|
607 |
+
},
|
608 |
+
{
|
609 |
+
"name": "cond",
|
610 |
+
"type": "CONDITIONING",
|
611 |
+
"link": 56,
|
612 |
+
"slot_index": 1
|
613 |
+
},
|
614 |
+
{
|
615 |
+
"name": "uncond",
|
616 |
+
"type": "CONDITIONING",
|
617 |
+
"link": 57,
|
618 |
+
"slot_index": 2
|
619 |
+
},
|
620 |
+
{
|
621 |
+
"name": "blended_latent",
|
622 |
+
"type": "LATENT",
|
623 |
+
"link": 60
|
624 |
+
},
|
625 |
+
{
|
626 |
+
"name": "latent",
|
627 |
+
"type": "LATENT",
|
628 |
+
"link": 61
|
629 |
+
}
|
630 |
+
],
|
631 |
+
"outputs": [
|
632 |
+
{
|
633 |
+
"name": "MODEL",
|
634 |
+
"type": "MODEL",
|
635 |
+
"links": [
|
636 |
+
62
|
637 |
+
],
|
638 |
+
"shape": 3,
|
639 |
+
"slot_index": 0
|
640 |
+
},
|
641 |
+
{
|
642 |
+
"name": "CONDITIONING",
|
643 |
+
"type": "CONDITIONING",
|
644 |
+
"links": [
|
645 |
+
63
|
646 |
+
],
|
647 |
+
"shape": 3,
|
648 |
+
"slot_index": 1
|
649 |
+
},
|
650 |
+
{
|
651 |
+
"name": "CONDITIONING",
|
652 |
+
"type": "CONDITIONING",
|
653 |
+
"links": [
|
654 |
+
64
|
655 |
+
],
|
656 |
+
"shape": 3,
|
657 |
+
"slot_index": 2
|
658 |
+
}
|
659 |
+
],
|
660 |
+
"properties": {
|
661 |
+
"Node name for S&R": "LayeredDiffusionDiffApply"
|
662 |
+
},
|
663 |
+
"widgets_values": [
|
664 |
+
"SDXL, Foreground",
|
665 |
+
1
|
666 |
+
],
|
667 |
+
"color": "#232",
|
668 |
+
"bgcolor": "#353"
|
669 |
+
}
|
670 |
+
],
|
671 |
+
"links": [
|
672 |
+
[
|
673 |
+
2,
|
674 |
+
5,
|
675 |
+
0,
|
676 |
+
3,
|
677 |
+
3,
|
678 |
+
"LATENT"
|
679 |
+
],
|
680 |
+
[
|
681 |
+
3,
|
682 |
+
4,
|
683 |
+
1,
|
684 |
+
6,
|
685 |
+
0,
|
686 |
+
"CLIP"
|
687 |
+
],
|
688 |
+
[
|
689 |
+
5,
|
690 |
+
4,
|
691 |
+
1,
|
692 |
+
7,
|
693 |
+
0,
|
694 |
+
"CLIP"
|
695 |
+
],
|
696 |
+
[
|
697 |
+
22,
|
698 |
+
4,
|
699 |
+
2,
|
700 |
+
14,
|
701 |
+
1,
|
702 |
+
"VAE"
|
703 |
+
],
|
704 |
+
[
|
705 |
+
29,
|
706 |
+
14,
|
707 |
+
0,
|
708 |
+
20,
|
709 |
+
0,
|
710 |
+
"IMAGE"
|
711 |
+
],
|
712 |
+
[
|
713 |
+
49,
|
714 |
+
4,
|
715 |
+
2,
|
716 |
+
29,
|
717 |
+
1,
|
718 |
+
"VAE"
|
719 |
+
],
|
720 |
+
[
|
721 |
+
53,
|
722 |
+
30,
|
723 |
+
0,
|
724 |
+
29,
|
725 |
+
0,
|
726 |
+
"IMAGE"
|
727 |
+
],
|
728 |
+
[
|
729 |
+
55,
|
730 |
+
4,
|
731 |
+
0,
|
732 |
+
37,
|
733 |
+
0,
|
734 |
+
"MODEL"
|
735 |
+
],
|
736 |
+
[
|
737 |
+
56,
|
738 |
+
6,
|
739 |
+
0,
|
740 |
+
37,
|
741 |
+
1,
|
742 |
+
"CONDITIONING"
|
743 |
+
],
|
744 |
+
[
|
745 |
+
57,
|
746 |
+
7,
|
747 |
+
0,
|
748 |
+
37,
|
749 |
+
2,
|
750 |
+
"CONDITIONING"
|
751 |
+
],
|
752 |
+
[
|
753 |
+
58,
|
754 |
+
4,
|
755 |
+
2,
|
756 |
+
39,
|
757 |
+
1,
|
758 |
+
"VAE"
|
759 |
+
],
|
760 |
+
[
|
761 |
+
59,
|
762 |
+
38,
|
763 |
+
0,
|
764 |
+
39,
|
765 |
+
0,
|
766 |
+
"IMAGE"
|
767 |
+
],
|
768 |
+
[
|
769 |
+
60,
|
770 |
+
39,
|
771 |
+
0,
|
772 |
+
37,
|
773 |
+
3,
|
774 |
+
"LATENT"
|
775 |
+
],
|
776 |
+
[
|
777 |
+
61,
|
778 |
+
29,
|
779 |
+
0,
|
780 |
+
37,
|
781 |
+
4,
|
782 |
+
"LATENT"
|
783 |
+
],
|
784 |
+
[
|
785 |
+
62,
|
786 |
+
37,
|
787 |
+
0,
|
788 |
+
3,
|
789 |
+
0,
|
790 |
+
"MODEL"
|
791 |
+
],
|
792 |
+
[
|
793 |
+
63,
|
794 |
+
37,
|
795 |
+
1,
|
796 |
+
3,
|
797 |
+
1,
|
798 |
+
"CONDITIONING"
|
799 |
+
],
|
800 |
+
[
|
801 |
+
64,
|
802 |
+
37,
|
803 |
+
2,
|
804 |
+
3,
|
805 |
+
2,
|
806 |
+
"CONDITIONING"
|
807 |
+
],
|
808 |
+
[
|
809 |
+
75,
|
810 |
+
4,
|
811 |
+
2,
|
812 |
+
41,
|
813 |
+
1,
|
814 |
+
"VAE"
|
815 |
+
],
|
816 |
+
[
|
817 |
+
76,
|
818 |
+
41,
|
819 |
+
0,
|
820 |
+
42,
|
821 |
+
0,
|
822 |
+
"IMAGE"
|
823 |
+
],
|
824 |
+
[
|
825 |
+
77,
|
826 |
+
3,
|
827 |
+
0,
|
828 |
+
41,
|
829 |
+
0,
|
830 |
+
"LATENT"
|
831 |
+
],
|
832 |
+
[
|
833 |
+
80,
|
834 |
+
4,
|
835 |
+
0,
|
836 |
+
45,
|
837 |
+
0,
|
838 |
+
"MODEL"
|
839 |
+
],
|
840 |
+
[
|
841 |
+
81,
|
842 |
+
6,
|
843 |
+
0,
|
844 |
+
45,
|
845 |
+
1,
|
846 |
+
"CONDITIONING"
|
847 |
+
],
|
848 |
+
[
|
849 |
+
82,
|
850 |
+
7,
|
851 |
+
0,
|
852 |
+
45,
|
853 |
+
2,
|
854 |
+
"CONDITIONING"
|
855 |
+
],
|
856 |
+
[
|
857 |
+
85,
|
858 |
+
45,
|
859 |
+
0,
|
860 |
+
14,
|
861 |
+
0,
|
862 |
+
"LATENT"
|
863 |
+
],
|
864 |
+
[
|
865 |
+
86,
|
866 |
+
3,
|
867 |
+
0,
|
868 |
+
45,
|
869 |
+
3,
|
870 |
+
"LATENT"
|
871 |
+
]
|
872 |
+
],
|
873 |
+
"groups": [],
|
874 |
+
"config": {},
|
875 |
+
"extra": {},
|
876 |
+
"version": 0.4
|
877 |
+
}
|
ComfyUI/custom_nodes/layerdiffuse/examples/layer_diffusion_diff_fg.json
ADDED
@@ -0,0 +1,686 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"last_node_id": 39,
|
3 |
+
"last_link_id": 64,
|
4 |
+
"nodes": [
|
5 |
+
{
|
6 |
+
"id": 4,
|
7 |
+
"type": "CheckpointLoaderSimple",
|
8 |
+
"pos": [
|
9 |
+
5,
|
10 |
+
479
|
11 |
+
],
|
12 |
+
"size": {
|
13 |
+
"0": 315,
|
14 |
+
"1": 98
|
15 |
+
},
|
16 |
+
"flags": {},
|
17 |
+
"order": 0,
|
18 |
+
"mode": 0,
|
19 |
+
"outputs": [
|
20 |
+
{
|
21 |
+
"name": "MODEL",
|
22 |
+
"type": "MODEL",
|
23 |
+
"links": [
|
24 |
+
55
|
25 |
+
],
|
26 |
+
"slot_index": 0
|
27 |
+
},
|
28 |
+
{
|
29 |
+
"name": "CLIP",
|
30 |
+
"type": "CLIP",
|
31 |
+
"links": [
|
32 |
+
3,
|
33 |
+
5
|
34 |
+
],
|
35 |
+
"slot_index": 1
|
36 |
+
},
|
37 |
+
{
|
38 |
+
"name": "VAE",
|
39 |
+
"type": "VAE",
|
40 |
+
"links": [
|
41 |
+
22,
|
42 |
+
49,
|
43 |
+
58
|
44 |
+
],
|
45 |
+
"slot_index": 2
|
46 |
+
}
|
47 |
+
],
|
48 |
+
"properties": {
|
49 |
+
"Node name for S&R": "CheckpointLoaderSimple"
|
50 |
+
},
|
51 |
+
"widgets_values": [
|
52 |
+
"juggernautXL_v8Rundiffusion.safetensors"
|
53 |
+
]
|
54 |
+
},
|
55 |
+
{
|
56 |
+
"id": 7,
|
57 |
+
"type": "CLIPTextEncode",
|
58 |
+
"pos": [
|
59 |
+
413,
|
60 |
+
389
|
61 |
+
],
|
62 |
+
"size": {
|
63 |
+
"0": 425.27801513671875,
|
64 |
+
"1": 180.6060791015625
|
65 |
+
},
|
66 |
+
"flags": {},
|
67 |
+
"order": 5,
|
68 |
+
"mode": 0,
|
69 |
+
"inputs": [
|
70 |
+
{
|
71 |
+
"name": "clip",
|
72 |
+
"type": "CLIP",
|
73 |
+
"link": 5
|
74 |
+
}
|
75 |
+
],
|
76 |
+
"outputs": [
|
77 |
+
{
|
78 |
+
"name": "CONDITIONING",
|
79 |
+
"type": "CONDITIONING",
|
80 |
+
"links": [
|
81 |
+
57
|
82 |
+
],
|
83 |
+
"slot_index": 0
|
84 |
+
}
|
85 |
+
],
|
86 |
+
"properties": {
|
87 |
+
"Node name for S&R": "CLIPTextEncode"
|
88 |
+
},
|
89 |
+
"widgets_values": [
|
90 |
+
"text, watermark"
|
91 |
+
]
|
92 |
+
},
|
93 |
+
{
|
94 |
+
"id": 5,
|
95 |
+
"type": "EmptyLatentImage",
|
96 |
+
"pos": [
|
97 |
+
475,
|
98 |
+
666
|
99 |
+
],
|
100 |
+
"size": {
|
101 |
+
"0": 315,
|
102 |
+
"1": 106
|
103 |
+
},
|
104 |
+
"flags": {},
|
105 |
+
"order": 1,
|
106 |
+
"mode": 0,
|
107 |
+
"outputs": [
|
108 |
+
{
|
109 |
+
"name": "LATENT",
|
110 |
+
"type": "LATENT",
|
111 |
+
"links": [
|
112 |
+
2
|
113 |
+
],
|
114 |
+
"slot_index": 0
|
115 |
+
}
|
116 |
+
],
|
117 |
+
"properties": {
|
118 |
+
"Node name for S&R": "EmptyLatentImage"
|
119 |
+
},
|
120 |
+
"widgets_values": [
|
121 |
+
1024,
|
122 |
+
1024,
|
123 |
+
1
|
124 |
+
]
|
125 |
+
},
|
126 |
+
{
|
127 |
+
"id": 14,
|
128 |
+
"type": "VAEDecode",
|
129 |
+
"pos": [
|
130 |
+
1286,
|
131 |
+
187
|
132 |
+
],
|
133 |
+
"size": {
|
134 |
+
"0": 210,
|
135 |
+
"1": 46
|
136 |
+
},
|
137 |
+
"flags": {},
|
138 |
+
"order": 10,
|
139 |
+
"mode": 0,
|
140 |
+
"inputs": [
|
141 |
+
{
|
142 |
+
"name": "samples",
|
143 |
+
"type": "LATENT",
|
144 |
+
"link": 21
|
145 |
+
},
|
146 |
+
{
|
147 |
+
"name": "vae",
|
148 |
+
"type": "VAE",
|
149 |
+
"link": 22,
|
150 |
+
"slot_index": 1
|
151 |
+
}
|
152 |
+
],
|
153 |
+
"outputs": [
|
154 |
+
{
|
155 |
+
"name": "IMAGE",
|
156 |
+
"type": "IMAGE",
|
157 |
+
"links": [
|
158 |
+
29
|
159 |
+
],
|
160 |
+
"shape": 3,
|
161 |
+
"slot_index": 0
|
162 |
+
}
|
163 |
+
],
|
164 |
+
"properties": {
|
165 |
+
"Node name for S&R": "VAEDecode"
|
166 |
+
}
|
167 |
+
},
|
168 |
+
{
|
169 |
+
"id": 20,
|
170 |
+
"type": "PreviewImage",
|
171 |
+
"pos": [
|
172 |
+
1558,
|
173 |
+
189
|
174 |
+
],
|
175 |
+
"size": {
|
176 |
+
"0": 611.2340087890625,
|
177 |
+
"1": 633.9354858398438
|
178 |
+
},
|
179 |
+
"flags": {},
|
180 |
+
"order": 11,
|
181 |
+
"mode": 0,
|
182 |
+
"inputs": [
|
183 |
+
{
|
184 |
+
"name": "images",
|
185 |
+
"type": "IMAGE",
|
186 |
+
"link": 29
|
187 |
+
}
|
188 |
+
],
|
189 |
+
"properties": {
|
190 |
+
"Node name for S&R": "PreviewImage"
|
191 |
+
}
|
192 |
+
},
|
193 |
+
{
|
194 |
+
"id": 3,
|
195 |
+
"type": "KSampler",
|
196 |
+
"pos": [
|
197 |
+
913,
|
198 |
+
181
|
199 |
+
],
|
200 |
+
"size": {
|
201 |
+
"0": 315,
|
202 |
+
"1": 262
|
203 |
+
},
|
204 |
+
"flags": {},
|
205 |
+
"order": 9,
|
206 |
+
"mode": 0,
|
207 |
+
"inputs": [
|
208 |
+
{
|
209 |
+
"name": "model",
|
210 |
+
"type": "MODEL",
|
211 |
+
"link": 62
|
212 |
+
},
|
213 |
+
{
|
214 |
+
"name": "positive",
|
215 |
+
"type": "CONDITIONING",
|
216 |
+
"link": 63
|
217 |
+
},
|
218 |
+
{
|
219 |
+
"name": "negative",
|
220 |
+
"type": "CONDITIONING",
|
221 |
+
"link": 64
|
222 |
+
},
|
223 |
+
{
|
224 |
+
"name": "latent_image",
|
225 |
+
"type": "LATENT",
|
226 |
+
"link": 2
|
227 |
+
}
|
228 |
+
],
|
229 |
+
"outputs": [
|
230 |
+
{
|
231 |
+
"name": "LATENT",
|
232 |
+
"type": "LATENT",
|
233 |
+
"links": [
|
234 |
+
21
|
235 |
+
],
|
236 |
+
"slot_index": 0
|
237 |
+
}
|
238 |
+
],
|
239 |
+
"properties": {
|
240 |
+
"Node name for S&R": "KSampler"
|
241 |
+
},
|
242 |
+
"widgets_values": [
|
243 |
+
462370085958750,
|
244 |
+
"fixed",
|
245 |
+
20,
|
246 |
+
8,
|
247 |
+
"euler",
|
248 |
+
"normal",
|
249 |
+
1
|
250 |
+
]
|
251 |
+
},
|
252 |
+
{
|
253 |
+
"id": 38,
|
254 |
+
"type": "LoadImage",
|
255 |
+
"pos": [
|
256 |
+
-137,
|
257 |
+
-388
|
258 |
+
],
|
259 |
+
"size": {
|
260 |
+
"0": 288.47406005859375,
|
261 |
+
"1": 317.46051025390625
|
262 |
+
},
|
263 |
+
"flags": {},
|
264 |
+
"order": 2,
|
265 |
+
"mode": 0,
|
266 |
+
"outputs": [
|
267 |
+
{
|
268 |
+
"name": "IMAGE",
|
269 |
+
"type": "IMAGE",
|
270 |
+
"links": [
|
271 |
+
59
|
272 |
+
],
|
273 |
+
"shape": 3
|
274 |
+
},
|
275 |
+
{
|
276 |
+
"name": "MASK",
|
277 |
+
"type": "MASK",
|
278 |
+
"links": null,
|
279 |
+
"shape": 3
|
280 |
+
}
|
281 |
+
],
|
282 |
+
"properties": {
|
283 |
+
"Node name for S&R": "LoadImage"
|
284 |
+
},
|
285 |
+
"widgets_values": [
|
286 |
+
"blended.png",
|
287 |
+
"image"
|
288 |
+
]
|
289 |
+
},
|
290 |
+
{
|
291 |
+
"id": 39,
|
292 |
+
"type": "VAEEncode",
|
293 |
+
"pos": [
|
294 |
+
201,
|
295 |
+
-391
|
296 |
+
],
|
297 |
+
"size": {
|
298 |
+
"0": 210,
|
299 |
+
"1": 46
|
300 |
+
},
|
301 |
+
"flags": {},
|
302 |
+
"order": 6,
|
303 |
+
"mode": 0,
|
304 |
+
"inputs": [
|
305 |
+
{
|
306 |
+
"name": "pixels",
|
307 |
+
"type": "IMAGE",
|
308 |
+
"link": 59,
|
309 |
+
"slot_index": 0
|
310 |
+
},
|
311 |
+
{
|
312 |
+
"name": "vae",
|
313 |
+
"type": "VAE",
|
314 |
+
"link": 58,
|
315 |
+
"slot_index": 1
|
316 |
+
}
|
317 |
+
],
|
318 |
+
"outputs": [
|
319 |
+
{
|
320 |
+
"name": "LATENT",
|
321 |
+
"type": "LATENT",
|
322 |
+
"links": [
|
323 |
+
60
|
324 |
+
],
|
325 |
+
"shape": 3,
|
326 |
+
"slot_index": 0
|
327 |
+
}
|
328 |
+
],
|
329 |
+
"properties": {
|
330 |
+
"Node name for S&R": "VAEEncode"
|
331 |
+
}
|
332 |
+
},
|
333 |
+
{
|
334 |
+
"id": 29,
|
335 |
+
"type": "VAEEncode",
|
336 |
+
"pos": [
|
337 |
+
210,
|
338 |
+
-20
|
339 |
+
],
|
340 |
+
"size": {
|
341 |
+
"0": 210,
|
342 |
+
"1": 46
|
343 |
+
},
|
344 |
+
"flags": {},
|
345 |
+
"order": 7,
|
346 |
+
"mode": 0,
|
347 |
+
"inputs": [
|
348 |
+
{
|
349 |
+
"name": "pixels",
|
350 |
+
"type": "IMAGE",
|
351 |
+
"link": 53
|
352 |
+
},
|
353 |
+
{
|
354 |
+
"name": "vae",
|
355 |
+
"type": "VAE",
|
356 |
+
"link": 49,
|
357 |
+
"slot_index": 1
|
358 |
+
}
|
359 |
+
],
|
360 |
+
"outputs": [
|
361 |
+
{
|
362 |
+
"name": "LATENT",
|
363 |
+
"type": "LATENT",
|
364 |
+
"links": [
|
365 |
+
61
|
366 |
+
],
|
367 |
+
"shape": 3,
|
368 |
+
"slot_index": 0
|
369 |
+
}
|
370 |
+
],
|
371 |
+
"properties": {
|
372 |
+
"Node name for S&R": "VAEEncode"
|
373 |
+
}
|
374 |
+
},
|
375 |
+
{
|
376 |
+
"id": 6,
|
377 |
+
"type": "CLIPTextEncode",
|
378 |
+
"pos": [
|
379 |
+
415,
|
380 |
+
186
|
381 |
+
],
|
382 |
+
"size": {
|
383 |
+
"0": 422.84503173828125,
|
384 |
+
"1": 164.31304931640625
|
385 |
+
},
|
386 |
+
"flags": {},
|
387 |
+
"order": 4,
|
388 |
+
"mode": 0,
|
389 |
+
"inputs": [
|
390 |
+
{
|
391 |
+
"name": "clip",
|
392 |
+
"type": "CLIP",
|
393 |
+
"link": 3
|
394 |
+
}
|
395 |
+
],
|
396 |
+
"outputs": [
|
397 |
+
{
|
398 |
+
"name": "CONDITIONING",
|
399 |
+
"type": "CONDITIONING",
|
400 |
+
"links": [
|
401 |
+
56
|
402 |
+
],
|
403 |
+
"slot_index": 0
|
404 |
+
}
|
405 |
+
],
|
406 |
+
"properties": {
|
407 |
+
"Node name for S&R": "CLIPTextEncode"
|
408 |
+
},
|
409 |
+
"widgets_values": [
|
410 |
+
"a room, high quality\n\n"
|
411 |
+
]
|
412 |
+
},
|
413 |
+
{
|
414 |
+
"id": 30,
|
415 |
+
"type": "LoadImage",
|
416 |
+
"pos": [
|
417 |
+
-146,
|
418 |
+
-22
|
419 |
+
],
|
420 |
+
"size": {
|
421 |
+
"0": 315,
|
422 |
+
"1": 314
|
423 |
+
},
|
424 |
+
"flags": {},
|
425 |
+
"order": 3,
|
426 |
+
"mode": 0,
|
427 |
+
"outputs": [
|
428 |
+
{
|
429 |
+
"name": "IMAGE",
|
430 |
+
"type": "IMAGE",
|
431 |
+
"links": [
|
432 |
+
53
|
433 |
+
],
|
434 |
+
"shape": 3,
|
435 |
+
"slot_index": 0
|
436 |
+
},
|
437 |
+
{
|
438 |
+
"name": "MASK",
|
439 |
+
"type": "MASK",
|
440 |
+
"links": null,
|
441 |
+
"shape": 3
|
442 |
+
}
|
443 |
+
],
|
444 |
+
"properties": {
|
445 |
+
"Node name for S&R": "LoadImage"
|
446 |
+
},
|
447 |
+
"widgets_values": [
|
448 |
+
"dog.png",
|
449 |
+
"image"
|
450 |
+
]
|
451 |
+
},
|
452 |
+
{
|
453 |
+
"id": 37,
|
454 |
+
"type": "LayeredDiffusionDiffApply",
|
455 |
+
"pos": [
|
456 |
+
456,
|
457 |
+
-44
|
458 |
+
],
|
459 |
+
"size": {
|
460 |
+
"0": 342.5999755859375,
|
461 |
+
"1": 162
|
462 |
+
},
|
463 |
+
"flags": {},
|
464 |
+
"order": 8,
|
465 |
+
"mode": 0,
|
466 |
+
"inputs": [
|
467 |
+
{
|
468 |
+
"name": "model",
|
469 |
+
"type": "MODEL",
|
470 |
+
"link": 55,
|
471 |
+
"slot_index": 0
|
472 |
+
},
|
473 |
+
{
|
474 |
+
"name": "cond",
|
475 |
+
"type": "CONDITIONING",
|
476 |
+
"link": 56,
|
477 |
+
"slot_index": 1
|
478 |
+
},
|
479 |
+
{
|
480 |
+
"name": "uncond",
|
481 |
+
"type": "CONDITIONING",
|
482 |
+
"link": 57,
|
483 |
+
"slot_index": 2
|
484 |
+
},
|
485 |
+
{
|
486 |
+
"name": "blended_latent",
|
487 |
+
"type": "LATENT",
|
488 |
+
"link": 60
|
489 |
+
},
|
490 |
+
{
|
491 |
+
"name": "latent",
|
492 |
+
"type": "LATENT",
|
493 |
+
"link": 61
|
494 |
+
}
|
495 |
+
],
|
496 |
+
"outputs": [
|
497 |
+
{
|
498 |
+
"name": "MODEL",
|
499 |
+
"type": "MODEL",
|
500 |
+
"links": [
|
501 |
+
62
|
502 |
+
],
|
503 |
+
"shape": 3,
|
504 |
+
"slot_index": 0
|
505 |
+
},
|
506 |
+
{
|
507 |
+
"name": "CONDITIONING",
|
508 |
+
"type": "CONDITIONING",
|
509 |
+
"links": [
|
510 |
+
63
|
511 |
+
],
|
512 |
+
"shape": 3,
|
513 |
+
"slot_index": 1
|
514 |
+
},
|
515 |
+
{
|
516 |
+
"name": "CONDITIONING",
|
517 |
+
"type": "CONDITIONING",
|
518 |
+
"links": [
|
519 |
+
64
|
520 |
+
],
|
521 |
+
"shape": 3,
|
522 |
+
"slot_index": 2
|
523 |
+
}
|
524 |
+
],
|
525 |
+
"properties": {
|
526 |
+
"Node name for S&R": "LayeredDiffusionDiffApply"
|
527 |
+
},
|
528 |
+
"widgets_values": [
|
529 |
+
"SDXL, Foreground",
|
530 |
+
1
|
531 |
+
],
|
532 |
+
"color": "#232",
|
533 |
+
"bgcolor": "#353"
|
534 |
+
}
|
535 |
+
],
|
536 |
+
"links": [
|
537 |
+
[
|
538 |
+
2,
|
539 |
+
5,
|
540 |
+
0,
|
541 |
+
3,
|
542 |
+
3,
|
543 |
+
"LATENT"
|
544 |
+
],
|
545 |
+
[
|
546 |
+
3,
|
547 |
+
4,
|
548 |
+
1,
|
549 |
+
6,
|
550 |
+
0,
|
551 |
+
"CLIP"
|
552 |
+
],
|
553 |
+
[
|
554 |
+
5,
|
555 |
+
4,
|
556 |
+
1,
|
557 |
+
7,
|
558 |
+
0,
|
559 |
+
"CLIP"
|
560 |
+
],
|
561 |
+
[
|
562 |
+
21,
|
563 |
+
3,
|
564 |
+
0,
|
565 |
+
14,
|
566 |
+
0,
|
567 |
+
"LATENT"
|
568 |
+
],
|
569 |
+
[
|
570 |
+
22,
|
571 |
+
4,
|
572 |
+
2,
|
573 |
+
14,
|
574 |
+
1,
|
575 |
+
"VAE"
|
576 |
+
],
|
577 |
+
[
|
578 |
+
29,
|
579 |
+
14,
|
580 |
+
0,
|
581 |
+
20,
|
582 |
+
0,
|
583 |
+
"IMAGE"
|
584 |
+
],
|
585 |
+
[
|
586 |
+
49,
|
587 |
+
4,
|
588 |
+
2,
|
589 |
+
29,
|
590 |
+
1,
|
591 |
+
"VAE"
|
592 |
+
],
|
593 |
+
[
|
594 |
+
53,
|
595 |
+
30,
|
596 |
+
0,
|
597 |
+
29,
|
598 |
+
0,
|
599 |
+
"IMAGE"
|
600 |
+
],
|
601 |
+
[
|
602 |
+
55,
|
603 |
+
4,
|
604 |
+
0,
|
605 |
+
37,
|
606 |
+
0,
|
607 |
+
"MODEL"
|
608 |
+
],
|
609 |
+
[
|
610 |
+
56,
|
611 |
+
6,
|
612 |
+
0,
|
613 |
+
37,
|
614 |
+
1,
|
615 |
+
"CONDITIONING"
|
616 |
+
],
|
617 |
+
[
|
618 |
+
57,
|
619 |
+
7,
|
620 |
+
0,
|
621 |
+
37,
|
622 |
+
2,
|
623 |
+
"CONDITIONING"
|
624 |
+
],
|
625 |
+
[
|
626 |
+
58,
|
627 |
+
4,
|
628 |
+
2,
|
629 |
+
39,
|
630 |
+
1,
|
631 |
+
"VAE"
|
632 |
+
],
|
633 |
+
[
|
634 |
+
59,
|
635 |
+
38,
|
636 |
+
0,
|
637 |
+
39,
|
638 |
+
0,
|
639 |
+
"IMAGE"
|
640 |
+
],
|
641 |
+
[
|
642 |
+
60,
|
643 |
+
39,
|
644 |
+
0,
|
645 |
+
37,
|
646 |
+
3,
|
647 |
+
"LATENT"
|
648 |
+
],
|
649 |
+
[
|
650 |
+
61,
|
651 |
+
29,
|
652 |
+
0,
|
653 |
+
37,
|
654 |
+
4,
|
655 |
+
"LATENT"
|
656 |
+
],
|
657 |
+
[
|
658 |
+
62,
|
659 |
+
37,
|
660 |
+
0,
|
661 |
+
3,
|
662 |
+
0,
|
663 |
+
"MODEL"
|
664 |
+
],
|
665 |
+
[
|
666 |
+
63,
|
667 |
+
37,
|
668 |
+
1,
|
669 |
+
3,
|
670 |
+
1,
|
671 |
+
"CONDITIONING"
|
672 |
+
],
|
673 |
+
[
|
674 |
+
64,
|
675 |
+
37,
|
676 |
+
2,
|
677 |
+
3,
|
678 |
+
2,
|
679 |
+
"CONDITIONING"
|
680 |
+
]
|
681 |
+
],
|
682 |
+
"groups": [],
|
683 |
+
"config": {},
|
684 |
+
"extra": {},
|
685 |
+
"version": 0.4
|
686 |
+
}
|
ComfyUI/custom_nodes/layerdiffuse/examples/layer_diffusion_fg_example.json
ADDED
@@ -0,0 +1,733 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"last_node_id": 29,
|
3 |
+
"last_link_id": 40,
|
4 |
+
"nodes": [
|
5 |
+
{
|
6 |
+
"id": 7,
|
7 |
+
"type": "CLIPTextEncode",
|
8 |
+
"pos": [
|
9 |
+
413,
|
10 |
+
389
|
11 |
+
],
|
12 |
+
"size": {
|
13 |
+
"0": 425.27801513671875,
|
14 |
+
"1": 180.6060791015625
|
15 |
+
},
|
16 |
+
"flags": {},
|
17 |
+
"order": 4,
|
18 |
+
"mode": 0,
|
19 |
+
"inputs": [
|
20 |
+
{
|
21 |
+
"name": "clip",
|
22 |
+
"type": "CLIP",
|
23 |
+
"link": 5
|
24 |
+
}
|
25 |
+
],
|
26 |
+
"outputs": [
|
27 |
+
{
|
28 |
+
"name": "CONDITIONING",
|
29 |
+
"type": "CONDITIONING",
|
30 |
+
"links": [
|
31 |
+
6
|
32 |
+
],
|
33 |
+
"slot_index": 0
|
34 |
+
}
|
35 |
+
],
|
36 |
+
"properties": {
|
37 |
+
"Node name for S&R": "CLIPTextEncode"
|
38 |
+
},
|
39 |
+
"widgets_values": [
|
40 |
+
"text, watermark"
|
41 |
+
]
|
42 |
+
},
|
43 |
+
{
|
44 |
+
"id": 6,
|
45 |
+
"type": "CLIPTextEncode",
|
46 |
+
"pos": [
|
47 |
+
415,
|
48 |
+
186
|
49 |
+
],
|
50 |
+
"size": {
|
51 |
+
"0": 422.84503173828125,
|
52 |
+
"1": 164.31304931640625
|
53 |
+
},
|
54 |
+
"flags": {},
|
55 |
+
"order": 3,
|
56 |
+
"mode": 0,
|
57 |
+
"inputs": [
|
58 |
+
{
|
59 |
+
"name": "clip",
|
60 |
+
"type": "CLIP",
|
61 |
+
"link": 3
|
62 |
+
}
|
63 |
+
],
|
64 |
+
"outputs": [
|
65 |
+
{
|
66 |
+
"name": "CONDITIONING",
|
67 |
+
"type": "CONDITIONING",
|
68 |
+
"links": [
|
69 |
+
4
|
70 |
+
],
|
71 |
+
"slot_index": 0
|
72 |
+
}
|
73 |
+
],
|
74 |
+
"properties": {
|
75 |
+
"Node name for S&R": "CLIPTextEncode"
|
76 |
+
},
|
77 |
+
"widgets_values": [
|
78 |
+
"beautiful scenery nature glass bottle landscape, , purple galaxy bottle,"
|
79 |
+
]
|
80 |
+
},
|
81 |
+
{
|
82 |
+
"id": 4,
|
83 |
+
"type": "CheckpointLoaderSimple",
|
84 |
+
"pos": [
|
85 |
+
5,
|
86 |
+
479
|
87 |
+
],
|
88 |
+
"size": {
|
89 |
+
"0": 315,
|
90 |
+
"1": 98
|
91 |
+
},
|
92 |
+
"flags": {},
|
93 |
+
"order": 0,
|
94 |
+
"mode": 0,
|
95 |
+
"outputs": [
|
96 |
+
{
|
97 |
+
"name": "MODEL",
|
98 |
+
"type": "MODEL",
|
99 |
+
"links": [
|
100 |
+
18
|
101 |
+
],
|
102 |
+
"slot_index": 0
|
103 |
+
},
|
104 |
+
{
|
105 |
+
"name": "CLIP",
|
106 |
+
"type": "CLIP",
|
107 |
+
"links": [
|
108 |
+
3,
|
109 |
+
5
|
110 |
+
],
|
111 |
+
"slot_index": 1
|
112 |
+
},
|
113 |
+
{
|
114 |
+
"name": "VAE",
|
115 |
+
"type": "VAE",
|
116 |
+
"links": [
|
117 |
+
22
|
118 |
+
],
|
119 |
+
"slot_index": 2
|
120 |
+
}
|
121 |
+
],
|
122 |
+
"properties": {
|
123 |
+
"Node name for S&R": "CheckpointLoaderSimple"
|
124 |
+
},
|
125 |
+
"widgets_values": [
|
126 |
+
"juggernautXL_v8Rundiffusion.safetensors"
|
127 |
+
]
|
128 |
+
},
|
129 |
+
{
|
130 |
+
"id": 14,
|
131 |
+
"type": "VAEDecode",
|
132 |
+
"pos": [
|
133 |
+
1275,
|
134 |
+
198
|
135 |
+
],
|
136 |
+
"size": {
|
137 |
+
"0": 210,
|
138 |
+
"1": 46
|
139 |
+
},
|
140 |
+
"flags": {},
|
141 |
+
"order": 6,
|
142 |
+
"mode": 0,
|
143 |
+
"inputs": [
|
144 |
+
{
|
145 |
+
"name": "samples",
|
146 |
+
"type": "LATENT",
|
147 |
+
"link": 21
|
148 |
+
},
|
149 |
+
{
|
150 |
+
"name": "vae",
|
151 |
+
"type": "VAE",
|
152 |
+
"link": 22,
|
153 |
+
"slot_index": 1
|
154 |
+
}
|
155 |
+
],
|
156 |
+
"outputs": [
|
157 |
+
{
|
158 |
+
"name": "IMAGE",
|
159 |
+
"type": "IMAGE",
|
160 |
+
"links": [
|
161 |
+
24,
|
162 |
+
29
|
163 |
+
],
|
164 |
+
"shape": 3,
|
165 |
+
"slot_index": 0
|
166 |
+
}
|
167 |
+
],
|
168 |
+
"properties": {
|
169 |
+
"Node name for S&R": "VAEDecode"
|
170 |
+
}
|
171 |
+
},
|
172 |
+
{
|
173 |
+
"id": 20,
|
174 |
+
"type": "PreviewImage",
|
175 |
+
"pos": [
|
176 |
+
1547,
|
177 |
+
472
|
178 |
+
],
|
179 |
+
"size": {
|
180 |
+
"0": 289.6058349609375,
|
181 |
+
"1": 299.6588134765625
|
182 |
+
},
|
183 |
+
"flags": {},
|
184 |
+
"order": 8,
|
185 |
+
"mode": 0,
|
186 |
+
"inputs": [
|
187 |
+
{
|
188 |
+
"name": "images",
|
189 |
+
"type": "IMAGE",
|
190 |
+
"link": 29
|
191 |
+
}
|
192 |
+
],
|
193 |
+
"properties": {
|
194 |
+
"Node name for S&R": "PreviewImage"
|
195 |
+
}
|
196 |
+
},
|
197 |
+
{
|
198 |
+
"id": 5,
|
199 |
+
"type": "EmptyLatentImage",
|
200 |
+
"pos": [
|
201 |
+
475,
|
202 |
+
707
|
203 |
+
],
|
204 |
+
"size": {
|
205 |
+
"0": 315,
|
206 |
+
"1": 106
|
207 |
+
},
|
208 |
+
"flags": {},
|
209 |
+
"order": 1,
|
210 |
+
"mode": 0,
|
211 |
+
"outputs": [
|
212 |
+
{
|
213 |
+
"name": "LATENT",
|
214 |
+
"type": "LATENT",
|
215 |
+
"links": [
|
216 |
+
2
|
217 |
+
],
|
218 |
+
"slot_index": 0
|
219 |
+
}
|
220 |
+
],
|
221 |
+
"properties": {
|
222 |
+
"Node name for S&R": "EmptyLatentImage"
|
223 |
+
},
|
224 |
+
"widgets_values": [
|
225 |
+
1024,
|
226 |
+
1024,
|
227 |
+
1
|
228 |
+
]
|
229 |
+
},
|
230 |
+
{
|
231 |
+
"id": 3,
|
232 |
+
"type": "KSampler",
|
233 |
+
"pos": [
|
234 |
+
911,
|
235 |
+
198
|
236 |
+
],
|
237 |
+
"size": {
|
238 |
+
"0": 315,
|
239 |
+
"1": 262
|
240 |
+
},
|
241 |
+
"flags": {},
|
242 |
+
"order": 5,
|
243 |
+
"mode": 0,
|
244 |
+
"inputs": [
|
245 |
+
{
|
246 |
+
"name": "model",
|
247 |
+
"type": "MODEL",
|
248 |
+
"link": 19
|
249 |
+
},
|
250 |
+
{
|
251 |
+
"name": "positive",
|
252 |
+
"type": "CONDITIONING",
|
253 |
+
"link": 4
|
254 |
+
},
|
255 |
+
{
|
256 |
+
"name": "negative",
|
257 |
+
"type": "CONDITIONING",
|
258 |
+
"link": 6
|
259 |
+
},
|
260 |
+
{
|
261 |
+
"name": "latent_image",
|
262 |
+
"type": "LATENT",
|
263 |
+
"link": 2
|
264 |
+
}
|
265 |
+
],
|
266 |
+
"outputs": [
|
267 |
+
{
|
268 |
+
"name": "LATENT",
|
269 |
+
"type": "LATENT",
|
270 |
+
"links": [
|
271 |
+
21,
|
272 |
+
23
|
273 |
+
],
|
274 |
+
"slot_index": 0
|
275 |
+
}
|
276 |
+
],
|
277 |
+
"properties": {
|
278 |
+
"Node name for S&R": "KSampler"
|
279 |
+
},
|
280 |
+
"widgets_values": [
|
281 |
+
984560333937969,
|
282 |
+
"randomize",
|
283 |
+
20,
|
284 |
+
8,
|
285 |
+
"euler",
|
286 |
+
"normal",
|
287 |
+
1
|
288 |
+
]
|
289 |
+
},
|
290 |
+
{
|
291 |
+
"id": 25,
|
292 |
+
"type": "PreviewImage",
|
293 |
+
"pos": [
|
294 |
+
2244,
|
295 |
+
194
|
296 |
+
],
|
297 |
+
"size": {
|
298 |
+
"0": 289.6058349609375,
|
299 |
+
"1": 299.6588134765625
|
300 |
+
},
|
301 |
+
"flags": {},
|
302 |
+
"order": 12,
|
303 |
+
"mode": 0,
|
304 |
+
"inputs": [
|
305 |
+
{
|
306 |
+
"name": "images",
|
307 |
+
"type": "IMAGE",
|
308 |
+
"link": 33
|
309 |
+
}
|
310 |
+
],
|
311 |
+
"properties": {
|
312 |
+
"Node name for S&R": "PreviewImage"
|
313 |
+
}
|
314 |
+
},
|
315 |
+
{
|
316 |
+
"id": 24,
|
317 |
+
"type": "MaskToImage",
|
318 |
+
"pos": [
|
319 |
+
1921,
|
320 |
+
192
|
321 |
+
],
|
322 |
+
"size": {
|
323 |
+
"0": 210,
|
324 |
+
"1": 26
|
325 |
+
},
|
326 |
+
"flags": {},
|
327 |
+
"order": 10,
|
328 |
+
"mode": 0,
|
329 |
+
"inputs": [
|
330 |
+
{
|
331 |
+
"name": "mask",
|
332 |
+
"type": "MASK",
|
333 |
+
"link": 32
|
334 |
+
}
|
335 |
+
],
|
336 |
+
"outputs": [
|
337 |
+
{
|
338 |
+
"name": "IMAGE",
|
339 |
+
"type": "IMAGE",
|
340 |
+
"links": [
|
341 |
+
33
|
342 |
+
],
|
343 |
+
"shape": 3,
|
344 |
+
"slot_index": 0
|
345 |
+
}
|
346 |
+
],
|
347 |
+
"properties": {
|
348 |
+
"Node name for S&R": "MaskToImage"
|
349 |
+
}
|
350 |
+
},
|
351 |
+
{
|
352 |
+
"id": 23,
|
353 |
+
"type": "PreviewImage",
|
354 |
+
"pos": [
|
355 |
+
1965,
|
356 |
+
479
|
357 |
+
],
|
358 |
+
"size": {
|
359 |
+
"0": 289.6058349609375,
|
360 |
+
"1": 299.6588134765625
|
361 |
+
},
|
362 |
+
"flags": {},
|
363 |
+
"order": 9,
|
364 |
+
"mode": 0,
|
365 |
+
"inputs": [
|
366 |
+
{
|
367 |
+
"name": "images",
|
368 |
+
"type": "IMAGE",
|
369 |
+
"link": 31
|
370 |
+
}
|
371 |
+
],
|
372 |
+
"properties": {
|
373 |
+
"Node name for S&R": "PreviewImage"
|
374 |
+
}
|
375 |
+
},
|
376 |
+
{
|
377 |
+
"id": 27,
|
378 |
+
"type": "PreviewImage",
|
379 |
+
"pos": [
|
380 |
+
2243,
|
381 |
+
-164
|
382 |
+
],
|
383 |
+
"size": {
|
384 |
+
"0": 289.6058349609375,
|
385 |
+
"1": 299.6588134765625
|
386 |
+
},
|
387 |
+
"flags": {},
|
388 |
+
"order": 14,
|
389 |
+
"mode": 0,
|
390 |
+
"inputs": [
|
391 |
+
{
|
392 |
+
"name": "images",
|
393 |
+
"type": "IMAGE",
|
394 |
+
"link": 40
|
395 |
+
}
|
396 |
+
],
|
397 |
+
"properties": {
|
398 |
+
"Node name for S&R": "PreviewImage"
|
399 |
+
}
|
400 |
+
},
|
401 |
+
{
|
402 |
+
"id": 15,
|
403 |
+
"type": "LayeredDiffusionDecode",
|
404 |
+
"pos": [
|
405 |
+
1586,
|
406 |
+
195
|
407 |
+
],
|
408 |
+
"size": {
|
409 |
+
"0": 210,
|
410 |
+
"1": 102
|
411 |
+
},
|
412 |
+
"flags": {},
|
413 |
+
"order": 7,
|
414 |
+
"mode": 0,
|
415 |
+
"inputs": [
|
416 |
+
{
|
417 |
+
"name": "samples",
|
418 |
+
"type": "LATENT",
|
419 |
+
"link": 23
|
420 |
+
},
|
421 |
+
{
|
422 |
+
"name": "images",
|
423 |
+
"type": "IMAGE",
|
424 |
+
"link": 24
|
425 |
+
}
|
426 |
+
],
|
427 |
+
"outputs": [
|
428 |
+
{
|
429 |
+
"name": "IMAGE",
|
430 |
+
"type": "IMAGE",
|
431 |
+
"links": [
|
432 |
+
31,
|
433 |
+
37
|
434 |
+
],
|
435 |
+
"shape": 3,
|
436 |
+
"slot_index": 0
|
437 |
+
},
|
438 |
+
{
|
439 |
+
"name": "MASK",
|
440 |
+
"type": "MASK",
|
441 |
+
"links": [
|
442 |
+
32,
|
443 |
+
38
|
444 |
+
],
|
445 |
+
"shape": 3,
|
446 |
+
"slot_index": 1
|
447 |
+
}
|
448 |
+
],
|
449 |
+
"properties": {
|
450 |
+
"Node name for S&R": "LayeredDiffusionDecode"
|
451 |
+
},
|
452 |
+
"widgets_values": [
|
453 |
+
"SDXL",
|
454 |
+
16
|
455 |
+
]
|
456 |
+
},
|
457 |
+
{
|
458 |
+
"id": 28,
|
459 |
+
"type": "JoinImageWithAlpha",
|
460 |
+
"pos": [
|
461 |
+
1928,
|
462 |
+
-59
|
463 |
+
],
|
464 |
+
"size": {
|
465 |
+
"0": 210,
|
466 |
+
"1": 46
|
467 |
+
},
|
468 |
+
"flags": {},
|
469 |
+
"order": 13,
|
470 |
+
"mode": 0,
|
471 |
+
"inputs": [
|
472 |
+
{
|
473 |
+
"name": "image",
|
474 |
+
"type": "IMAGE",
|
475 |
+
"link": 37
|
476 |
+
},
|
477 |
+
{
|
478 |
+
"name": "alpha",
|
479 |
+
"type": "MASK",
|
480 |
+
"link": 39
|
481 |
+
}
|
482 |
+
],
|
483 |
+
"outputs": [
|
484 |
+
{
|
485 |
+
"name": "IMAGE",
|
486 |
+
"type": "IMAGE",
|
487 |
+
"links": [
|
488 |
+
40
|
489 |
+
],
|
490 |
+
"shape": 3,
|
491 |
+
"slot_index": 0
|
492 |
+
}
|
493 |
+
],
|
494 |
+
"properties": {
|
495 |
+
"Node name for S&R": "JoinImageWithAlpha"
|
496 |
+
}
|
497 |
+
},
|
498 |
+
{
|
499 |
+
"id": 29,
|
500 |
+
"type": "InvertMask",
|
501 |
+
"pos": [
|
502 |
+
1931,
|
503 |
+
44
|
504 |
+
],
|
505 |
+
"size": {
|
506 |
+
"0": 210,
|
507 |
+
"1": 26
|
508 |
+
},
|
509 |
+
"flags": {},
|
510 |
+
"order": 11,
|
511 |
+
"mode": 0,
|
512 |
+
"inputs": [
|
513 |
+
{
|
514 |
+
"name": "mask",
|
515 |
+
"type": "MASK",
|
516 |
+
"link": 38
|
517 |
+
}
|
518 |
+
],
|
519 |
+
"outputs": [
|
520 |
+
{
|
521 |
+
"name": "MASK",
|
522 |
+
"type": "MASK",
|
523 |
+
"links": [
|
524 |
+
39
|
525 |
+
],
|
526 |
+
"shape": 3,
|
527 |
+
"slot_index": 0
|
528 |
+
}
|
529 |
+
],
|
530 |
+
"properties": {
|
531 |
+
"Node name for S&R": "InvertMask"
|
532 |
+
}
|
533 |
+
},
|
534 |
+
{
|
535 |
+
"id": 13,
|
536 |
+
"type": "LayeredDiffusionApply",
|
537 |
+
"pos": [
|
538 |
+
468,
|
539 |
+
-2
|
540 |
+
],
|
541 |
+
"size": {
|
542 |
+
"0": 327.8314208984375,
|
543 |
+
"1": 106.42147827148438
|
544 |
+
},
|
545 |
+
"flags": {},
|
546 |
+
"order": 2,
|
547 |
+
"mode": 0,
|
548 |
+
"inputs": [
|
549 |
+
{
|
550 |
+
"name": "model",
|
551 |
+
"type": "MODEL",
|
552 |
+
"link": 18
|
553 |
+
}
|
554 |
+
],
|
555 |
+
"outputs": [
|
556 |
+
{
|
557 |
+
"name": "MODEL",
|
558 |
+
"type": "MODEL",
|
559 |
+
"links": [
|
560 |
+
19
|
561 |
+
],
|
562 |
+
"shape": 3,
|
563 |
+
"slot_index": 0
|
564 |
+
}
|
565 |
+
],
|
566 |
+
"properties": {
|
567 |
+
"Node name for S&R": "LayeredDiffusionApply"
|
568 |
+
},
|
569 |
+
"widgets_values": [
|
570 |
+
"SDXL, Conv Injection",
|
571 |
+
1
|
572 |
+
]
|
573 |
+
}
|
574 |
+
],
|
575 |
+
"links": [
|
576 |
+
[
|
577 |
+
2,
|
578 |
+
5,
|
579 |
+
0,
|
580 |
+
3,
|
581 |
+
3,
|
582 |
+
"LATENT"
|
583 |
+
],
|
584 |
+
[
|
585 |
+
3,
|
586 |
+
4,
|
587 |
+
1,
|
588 |
+
6,
|
589 |
+
0,
|
590 |
+
"CLIP"
|
591 |
+
],
|
592 |
+
[
|
593 |
+
4,
|
594 |
+
6,
|
595 |
+
0,
|
596 |
+
3,
|
597 |
+
1,
|
598 |
+
"CONDITIONING"
|
599 |
+
],
|
600 |
+
[
|
601 |
+
5,
|
602 |
+
4,
|
603 |
+
1,
|
604 |
+
7,
|
605 |
+
0,
|
606 |
+
"CLIP"
|
607 |
+
],
|
608 |
+
[
|
609 |
+
6,
|
610 |
+
7,
|
611 |
+
0,
|
612 |
+
3,
|
613 |
+
2,
|
614 |
+
"CONDITIONING"
|
615 |
+
],
|
616 |
+
[
|
617 |
+
18,
|
618 |
+
4,
|
619 |
+
0,
|
620 |
+
13,
|
621 |
+
0,
|
622 |
+
"MODEL"
|
623 |
+
],
|
624 |
+
[
|
625 |
+
19,
|
626 |
+
13,
|
627 |
+
0,
|
628 |
+
3,
|
629 |
+
0,
|
630 |
+
"MODEL"
|
631 |
+
],
|
632 |
+
[
|
633 |
+
21,
|
634 |
+
3,
|
635 |
+
0,
|
636 |
+
14,
|
637 |
+
0,
|
638 |
+
"LATENT"
|
639 |
+
],
|
640 |
+
[
|
641 |
+
22,
|
642 |
+
4,
|
643 |
+
2,
|
644 |
+
14,
|
645 |
+
1,
|
646 |
+
"VAE"
|
647 |
+
],
|
648 |
+
[
|
649 |
+
23,
|
650 |
+
3,
|
651 |
+
0,
|
652 |
+
15,
|
653 |
+
0,
|
654 |
+
"LATENT"
|
655 |
+
],
|
656 |
+
[
|
657 |
+
24,
|
658 |
+
14,
|
659 |
+
0,
|
660 |
+
15,
|
661 |
+
1,
|
662 |
+
"IMAGE"
|
663 |
+
],
|
664 |
+
[
|
665 |
+
29,
|
666 |
+
14,
|
667 |
+
0,
|
668 |
+
20,
|
669 |
+
0,
|
670 |
+
"IMAGE"
|
671 |
+
],
|
672 |
+
[
|
673 |
+
31,
|
674 |
+
15,
|
675 |
+
0,
|
676 |
+
23,
|
677 |
+
0,
|
678 |
+
"IMAGE"
|
679 |
+
],
|
680 |
+
[
|
681 |
+
32,
|
682 |
+
15,
|
683 |
+
1,
|
684 |
+
24,
|
685 |
+
0,
|
686 |
+
"MASK"
|
687 |
+
],
|
688 |
+
[
|
689 |
+
33,
|
690 |
+
24,
|
691 |
+
0,
|
692 |
+
25,
|
693 |
+
0,
|
694 |
+
"IMAGE"
|
695 |
+
],
|
696 |
+
[
|
697 |
+
37,
|
698 |
+
15,
|
699 |
+
0,
|
700 |
+
28,
|
701 |
+
0,
|
702 |
+
"IMAGE"
|
703 |
+
],
|
704 |
+
[
|
705 |
+
38,
|
706 |
+
15,
|
707 |
+
1,
|
708 |
+
29,
|
709 |
+
0,
|
710 |
+
"MASK"
|
711 |
+
],
|
712 |
+
[
|
713 |
+
39,
|
714 |
+
29,
|
715 |
+
0,
|
716 |
+
28,
|
717 |
+
1,
|
718 |
+
"MASK"
|
719 |
+
],
|
720 |
+
[
|
721 |
+
40,
|
722 |
+
28,
|
723 |
+
0,
|
724 |
+
27,
|
725 |
+
0,
|
726 |
+
"IMAGE"
|
727 |
+
]
|
728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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"last_node_id": 36,
|
3 |
+
"last_link_id": 51,
|
4 |
+
"nodes": [
|
5 |
+
{
|
6 |
+
"id": 7,
|
7 |
+
"type": "CLIPTextEncode",
|
8 |
+
"pos": [
|
9 |
+
413,
|
10 |
+
389
|
11 |
+
],
|
12 |
+
"size": {
|
13 |
+
"0": 425.27801513671875,
|
14 |
+
"1": 180.6060791015625
|
15 |
+
},
|
16 |
+
"flags": {},
|
17 |
+
"order": 4,
|
18 |
+
"mode": 0,
|
19 |
+
"inputs": [
|
20 |
+
{
|
21 |
+
"name": "clip",
|
22 |
+
"type": "CLIP",
|
23 |
+
"link": 5
|
24 |
+
}
|
25 |
+
],
|
26 |
+
"outputs": [
|
27 |
+
{
|
28 |
+
"name": "CONDITIONING",
|
29 |
+
"type": "CONDITIONING",
|
30 |
+
"links": [
|
31 |
+
6
|
32 |
+
],
|
33 |
+
"slot_index": 0
|
34 |
+
}
|
35 |
+
],
|
36 |
+
"properties": {
|
37 |
+
"Node name for S&R": "CLIPTextEncode"
|
38 |
+
},
|
39 |
+
"widgets_values": [
|
40 |
+
"text, watermark"
|
41 |
+
]
|
42 |
+
},
|
43 |
+
{
|
44 |
+
"id": 6,
|
45 |
+
"type": "CLIPTextEncode",
|
46 |
+
"pos": [
|
47 |
+
415,
|
48 |
+
186
|
49 |
+
],
|
50 |
+
"size": {
|
51 |
+
"0": 422.84503173828125,
|
52 |
+
"1": 164.31304931640625
|
53 |
+
},
|
54 |
+
"flags": {},
|
55 |
+
"order": 3,
|
56 |
+
"mode": 0,
|
57 |
+
"inputs": [
|
58 |
+
{
|
59 |
+
"name": "clip",
|
60 |
+
"type": "CLIP",
|
61 |
+
"link": 3
|
62 |
+
}
|
63 |
+
],
|
64 |
+
"outputs": [
|
65 |
+
{
|
66 |
+
"name": "CONDITIONING",
|
67 |
+
"type": "CONDITIONING",
|
68 |
+
"links": [
|
69 |
+
4
|
70 |
+
],
|
71 |
+
"slot_index": 0
|
72 |
+
}
|
73 |
+
],
|
74 |
+
"properties": {
|
75 |
+
"Node name for S&R": "CLIPTextEncode"
|
76 |
+
},
|
77 |
+
"widgets_values": [
|
78 |
+
"beautiful scenery nature glass bottle landscape, , purple galaxy bottle,"
|
79 |
+
]
|
80 |
+
},
|
81 |
+
{
|
82 |
+
"id": 4,
|
83 |
+
"type": "CheckpointLoaderSimple",
|
84 |
+
"pos": [
|
85 |
+
5,
|
86 |
+
479
|
87 |
+
],
|
88 |
+
"size": {
|
89 |
+
"0": 315,
|
90 |
+
"1": 98
|
91 |
+
},
|
92 |
+
"flags": {},
|
93 |
+
"order": 0,
|
94 |
+
"mode": 0,
|
95 |
+
"outputs": [
|
96 |
+
{
|
97 |
+
"name": "MODEL",
|
98 |
+
"type": "MODEL",
|
99 |
+
"links": [
|
100 |
+
18
|
101 |
+
],
|
102 |
+
"slot_index": 0
|
103 |
+
},
|
104 |
+
{
|
105 |
+
"name": "CLIP",
|
106 |
+
"type": "CLIP",
|
107 |
+
"links": [
|
108 |
+
3,
|
109 |
+
5
|
110 |
+
],
|
111 |
+
"slot_index": 1
|
112 |
+
},
|
113 |
+
{
|
114 |
+
"name": "VAE",
|
115 |
+
"type": "VAE",
|
116 |
+
"links": [
|
117 |
+
22
|
118 |
+
],
|
119 |
+
"slot_index": 2
|
120 |
+
}
|
121 |
+
],
|
122 |
+
"properties": {
|
123 |
+
"Node name for S&R": "CheckpointLoaderSimple"
|
124 |
+
},
|
125 |
+
"widgets_values": [
|
126 |
+
"juggernautXL_v8Rundiffusion.safetensors"
|
127 |
+
]
|
128 |
+
},
|
129 |
+
{
|
130 |
+
"id": 14,
|
131 |
+
"type": "VAEDecode",
|
132 |
+
"pos": [
|
133 |
+
1275,
|
134 |
+
198
|
135 |
+
],
|
136 |
+
"size": {
|
137 |
+
"0": 210,
|
138 |
+
"1": 46
|
139 |
+
},
|
140 |
+
"flags": {},
|
141 |
+
"order": 6,
|
142 |
+
"mode": 0,
|
143 |
+
"inputs": [
|
144 |
+
{
|
145 |
+
"name": "samples",
|
146 |
+
"type": "LATENT",
|
147 |
+
"link": 21
|
148 |
+
},
|
149 |
+
{
|
150 |
+
"name": "vae",
|
151 |
+
"type": "VAE",
|
152 |
+
"link": 22,
|
153 |
+
"slot_index": 1
|
154 |
+
}
|
155 |
+
],
|
156 |
+
"outputs": [
|
157 |
+
{
|
158 |
+
"name": "IMAGE",
|
159 |
+
"type": "IMAGE",
|
160 |
+
"links": [
|
161 |
+
29,
|
162 |
+
50
|
163 |
+
],
|
164 |
+
"shape": 3,
|
165 |
+
"slot_index": 0
|
166 |
+
}
|
167 |
+
],
|
168 |
+
"properties": {
|
169 |
+
"Node name for S&R": "VAEDecode"
|
170 |
+
}
|
171 |
+
},
|
172 |
+
{
|
173 |
+
"id": 3,
|
174 |
+
"type": "KSampler",
|
175 |
+
"pos": [
|
176 |
+
911,
|
177 |
+
198
|
178 |
+
],
|
179 |
+
"size": {
|
180 |
+
"0": 315,
|
181 |
+
"1": 262
|
182 |
+
},
|
183 |
+
"flags": {},
|
184 |
+
"order": 5,
|
185 |
+
"mode": 0,
|
186 |
+
"inputs": [
|
187 |
+
{
|
188 |
+
"name": "model",
|
189 |
+
"type": "MODEL",
|
190 |
+
"link": 19
|
191 |
+
},
|
192 |
+
{
|
193 |
+
"name": "positive",
|
194 |
+
"type": "CONDITIONING",
|
195 |
+
"link": 4
|
196 |
+
},
|
197 |
+
{
|
198 |
+
"name": "negative",
|
199 |
+
"type": "CONDITIONING",
|
200 |
+
"link": 6
|
201 |
+
},
|
202 |
+
{
|
203 |
+
"name": "latent_image",
|
204 |
+
"type": "LATENT",
|
205 |
+
"link": 2
|
206 |
+
}
|
207 |
+
],
|
208 |
+
"outputs": [
|
209 |
+
{
|
210 |
+
"name": "LATENT",
|
211 |
+
"type": "LATENT",
|
212 |
+
"links": [
|
213 |
+
21,
|
214 |
+
49
|
215 |
+
],
|
216 |
+
"slot_index": 0
|
217 |
+
}
|
218 |
+
],
|
219 |
+
"properties": {
|
220 |
+
"Node name for S&R": "KSampler"
|
221 |
+
},
|
222 |
+
"widgets_values": [
|
223 |
+
1029477926308287,
|
224 |
+
"randomize",
|
225 |
+
20,
|
226 |
+
8,
|
227 |
+
"euler",
|
228 |
+
"normal",
|
229 |
+
1
|
230 |
+
]
|
231 |
+
},
|
232 |
+
{
|
233 |
+
"id": 5,
|
234 |
+
"type": "EmptyLatentImage",
|
235 |
+
"pos": [
|
236 |
+
480,
|
237 |
+
691
|
238 |
+
],
|
239 |
+
"size": {
|
240 |
+
"0": 315,
|
241 |
+
"1": 106
|
242 |
+
},
|
243 |
+
"flags": {},
|
244 |
+
"order": 1,
|
245 |
+
"mode": 0,
|
246 |
+
"outputs": [
|
247 |
+
{
|
248 |
+
"name": "LATENT",
|
249 |
+
"type": "LATENT",
|
250 |
+
"links": [
|
251 |
+
2
|
252 |
+
],
|
253 |
+
"slot_index": 0
|
254 |
+
}
|
255 |
+
],
|
256 |
+
"properties": {
|
257 |
+
"Node name for S&R": "EmptyLatentImage"
|
258 |
+
},
|
259 |
+
"widgets_values": [
|
260 |
+
1024,
|
261 |
+
1024,
|
262 |
+
1
|
263 |
+
]
|
264 |
+
},
|
265 |
+
{
|
266 |
+
"id": 36,
|
267 |
+
"type": "LayeredDiffusionDecodeRGBA",
|
268 |
+
"pos": [
|
269 |
+
1589,
|
270 |
+
199
|
271 |
+
],
|
272 |
+
"size": {
|
273 |
+
"0": 243.60000610351562,
|
274 |
+
"1": 102
|
275 |
+
},
|
276 |
+
"flags": {},
|
277 |
+
"order": 8,
|
278 |
+
"mode": 0,
|
279 |
+
"inputs": [
|
280 |
+
{
|
281 |
+
"name": "samples",
|
282 |
+
"type": "LATENT",
|
283 |
+
"link": 49
|
284 |
+
},
|
285 |
+
{
|
286 |
+
"name": "images",
|
287 |
+
"type": "IMAGE",
|
288 |
+
"link": 50
|
289 |
+
}
|
290 |
+
],
|
291 |
+
"outputs": [
|
292 |
+
{
|
293 |
+
"name": "IMAGE",
|
294 |
+
"type": "IMAGE",
|
295 |
+
"links": [
|
296 |
+
51
|
297 |
+
],
|
298 |
+
"shape": 3
|
299 |
+
}
|
300 |
+
],
|
301 |
+
"properties": {
|
302 |
+
"Node name for S&R": "LayeredDiffusionDecodeRGBA"
|
303 |
+
},
|
304 |
+
"widgets_values": [
|
305 |
+
"SDXL",
|
306 |
+
16
|
307 |
+
]
|
308 |
+
},
|
309 |
+
{
|
310 |
+
"id": 27,
|
311 |
+
"type": "PreviewImage",
|
312 |
+
"pos": [
|
313 |
+
1930,
|
314 |
+
197
|
315 |
+
],
|
316 |
+
"size": {
|
317 |
+
"0": 289.6058349609375,
|
318 |
+
"1": 299.6588134765625
|
319 |
+
},
|
320 |
+
"flags": {},
|
321 |
+
"order": 9,
|
322 |
+
"mode": 0,
|
323 |
+
"inputs": [
|
324 |
+
{
|
325 |
+
"name": "images",
|
326 |
+
"type": "IMAGE",
|
327 |
+
"link": 51,
|
328 |
+
"slot_index": 0
|
329 |
+
}
|
330 |
+
],
|
331 |
+
"properties": {
|
332 |
+
"Node name for S&R": "PreviewImage"
|
333 |
+
}
|
334 |
+
},
|
335 |
+
{
|
336 |
+
"id": 20,
|
337 |
+
"type": "PreviewImage",
|
338 |
+
"pos": [
|
339 |
+
1570,
|
340 |
+
365
|
341 |
+
],
|
342 |
+
"size": {
|
343 |
+
"0": 289.6058349609375,
|
344 |
+
"1": 299.6588134765625
|
345 |
+
},
|
346 |
+
"flags": {},
|
347 |
+
"order": 7,
|
348 |
+
"mode": 0,
|
349 |
+
"inputs": [
|
350 |
+
{
|
351 |
+
"name": "images",
|
352 |
+
"type": "IMAGE",
|
353 |
+
"link": 29
|
354 |
+
}
|
355 |
+
],
|
356 |
+
"properties": {
|
357 |
+
"Node name for S&R": "PreviewImage"
|
358 |
+
}
|
359 |
+
},
|
360 |
+
{
|
361 |
+
"id": 13,
|
362 |
+
"type": "LayeredDiffusionApply",
|
363 |
+
"pos": [
|
364 |
+
468,
|
365 |
+
-2
|
366 |
+
],
|
367 |
+
"size": {
|
368 |
+
"0": 327.8314208984375,
|
369 |
+
"1": 106.42147827148438
|
370 |
+
},
|
371 |
+
"flags": {},
|
372 |
+
"order": 2,
|
373 |
+
"mode": 0,
|
374 |
+
"inputs": [
|
375 |
+
{
|
376 |
+
"name": "model",
|
377 |
+
"type": "MODEL",
|
378 |
+
"link": 18
|
379 |
+
}
|
380 |
+
],
|
381 |
+
"outputs": [
|
382 |
+
{
|
383 |
+
"name": "MODEL",
|
384 |
+
"type": "MODEL",
|
385 |
+
"links": [
|
386 |
+
19
|
387 |
+
],
|
388 |
+
"shape": 3,
|
389 |
+
"slot_index": 0
|
390 |
+
}
|
391 |
+
],
|
392 |
+
"properties": {
|
393 |
+
"Node name for S&R": "LayeredDiffusionApply"
|
394 |
+
},
|
395 |
+
"widgets_values": [
|
396 |
+
"SDXL, Conv Injection",
|
397 |
+
1
|
398 |
+
]
|
399 |
+
}
|
400 |
+
],
|
401 |
+
"links": [
|
402 |
+
[
|
403 |
+
2,
|
404 |
+
5,
|
405 |
+
0,
|
406 |
+
3,
|
407 |
+
3,
|
408 |
+
"LATENT"
|
409 |
+
],
|
410 |
+
[
|
411 |
+
3,
|
412 |
+
4,
|
413 |
+
1,
|
414 |
+
6,
|
415 |
+
0,
|
416 |
+
"CLIP"
|
417 |
+
],
|
418 |
+
[
|
419 |
+
4,
|
420 |
+
6,
|
421 |
+
0,
|
422 |
+
3,
|
423 |
+
1,
|
424 |
+
"CONDITIONING"
|
425 |
+
],
|
426 |
+
[
|
427 |
+
5,
|
428 |
+
4,
|
429 |
+
1,
|
430 |
+
7,
|
431 |
+
0,
|
432 |
+
"CLIP"
|
433 |
+
],
|
434 |
+
[
|
435 |
+
6,
|
436 |
+
7,
|
437 |
+
0,
|
438 |
+
3,
|
439 |
+
2,
|
440 |
+
"CONDITIONING"
|
441 |
+
],
|
442 |
+
[
|
443 |
+
18,
|
444 |
+
4,
|
445 |
+
0,
|
446 |
+
13,
|
447 |
+
0,
|
448 |
+
"MODEL"
|
449 |
+
],
|
450 |
+
[
|
451 |
+
19,
|
452 |
+
13,
|
453 |
+
0,
|
454 |
+
3,
|
455 |
+
0,
|
456 |
+
"MODEL"
|
457 |
+
],
|
458 |
+
[
|
459 |
+
21,
|
460 |
+
3,
|
461 |
+
0,
|
462 |
+
14,
|
463 |
+
0,
|
464 |
+
"LATENT"
|
465 |
+
],
|
466 |
+
[
|
467 |
+
22,
|
468 |
+
4,
|
469 |
+
2,
|
470 |
+
14,
|
471 |
+
1,
|
472 |
+
"VAE"
|
473 |
+
],
|
474 |
+
[
|
475 |
+
29,
|
476 |
+
14,
|
477 |
+
0,
|
478 |
+
20,
|
479 |
+
0,
|
480 |
+
"IMAGE"
|
481 |
+
],
|
482 |
+
[
|
483 |
+
49,
|
484 |
+
3,
|
485 |
+
0,
|
486 |
+
36,
|
487 |
+
0,
|
488 |
+
"LATENT"
|
489 |
+
],
|
490 |
+
[
|
491 |
+
50,
|
492 |
+
14,
|
493 |
+
0,
|
494 |
+
36,
|
495 |
+
1,
|
496 |
+
"IMAGE"
|
497 |
+
],
|
498 |
+
[
|
499 |
+
51,
|
500 |
+
36,
|
501 |
+
0,
|
502 |
+
27,
|
503 |
+
0,
|
504 |
+
"IMAGE"
|
505 |
+
]
|
506 |
+
],
|
507 |
+
"groups": [],
|
508 |
+
"config": {},
|
509 |
+
"extra": {},
|
510 |
+
"version": 0.4
|
511 |
+
}
|
ComfyUI/custom_nodes/layerdiffuse/examples/layer_diffusion_joint.json
ADDED
@@ -0,0 +1,703 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"last_node_id": 27,
|
3 |
+
"last_link_id": 42,
|
4 |
+
"nodes": [
|
5 |
+
{
|
6 |
+
"id": 7,
|
7 |
+
"type": "CLIPTextEncode",
|
8 |
+
"pos": [
|
9 |
+
413,
|
10 |
+
389
|
11 |
+
],
|
12 |
+
"size": {
|
13 |
+
"0": 425.27801513671875,
|
14 |
+
"1": 180.6060791015625
|
15 |
+
},
|
16 |
+
"flags": {},
|
17 |
+
"order": 3,
|
18 |
+
"mode": 0,
|
19 |
+
"inputs": [
|
20 |
+
{
|
21 |
+
"name": "clip",
|
22 |
+
"type": "CLIP",
|
23 |
+
"link": 5
|
24 |
+
}
|
25 |
+
],
|
26 |
+
"outputs": [
|
27 |
+
{
|
28 |
+
"name": "CONDITIONING",
|
29 |
+
"type": "CONDITIONING",
|
30 |
+
"links": [
|
31 |
+
6
|
32 |
+
],
|
33 |
+
"slot_index": 0
|
34 |
+
}
|
35 |
+
],
|
36 |
+
"properties": {
|
37 |
+
"Node name for S&R": "CLIPTextEncode"
|
38 |
+
},
|
39 |
+
"widgets_values": [
|
40 |
+
"text, watermark"
|
41 |
+
]
|
42 |
+
},
|
43 |
+
{
|
44 |
+
"id": 3,
|
45 |
+
"type": "KSampler",
|
46 |
+
"pos": [
|
47 |
+
891,
|
48 |
+
192
|
49 |
+
],
|
50 |
+
"size": {
|
51 |
+
"0": 315,
|
52 |
+
"1": 262
|
53 |
+
},
|
54 |
+
"flags": {},
|
55 |
+
"order": 7,
|
56 |
+
"mode": 0,
|
57 |
+
"inputs": [
|
58 |
+
{
|
59 |
+
"name": "model",
|
60 |
+
"type": "MODEL",
|
61 |
+
"link": 32
|
62 |
+
},
|
63 |
+
{
|
64 |
+
"name": "positive",
|
65 |
+
"type": "CONDITIONING",
|
66 |
+
"link": 4
|
67 |
+
},
|
68 |
+
{
|
69 |
+
"name": "negative",
|
70 |
+
"type": "CONDITIONING",
|
71 |
+
"link": 6
|
72 |
+
},
|
73 |
+
{
|
74 |
+
"name": "latent_image",
|
75 |
+
"type": "LATENT",
|
76 |
+
"link": 2
|
77 |
+
}
|
78 |
+
],
|
79 |
+
"outputs": [
|
80 |
+
{
|
81 |
+
"name": "LATENT",
|
82 |
+
"type": "LATENT",
|
83 |
+
"links": [
|
84 |
+
21,
|
85 |
+
33
|
86 |
+
],
|
87 |
+
"slot_index": 0
|
88 |
+
}
|
89 |
+
],
|
90 |
+
"properties": {
|
91 |
+
"Node name for S&R": "KSampler"
|
92 |
+
},
|
93 |
+
"widgets_values": [
|
94 |
+
960762378448318,
|
95 |
+
"randomize",
|
96 |
+
20,
|
97 |
+
8,
|
98 |
+
"euler",
|
99 |
+
"normal",
|
100 |
+
1
|
101 |
+
]
|
102 |
+
},
|
103 |
+
{
|
104 |
+
"id": 14,
|
105 |
+
"type": "VAEDecode",
|
106 |
+
"pos": [
|
107 |
+
1275,
|
108 |
+
198
|
109 |
+
],
|
110 |
+
"size": {
|
111 |
+
"0": 210,
|
112 |
+
"1": 46
|
113 |
+
},
|
114 |
+
"flags": {},
|
115 |
+
"order": 8,
|
116 |
+
"mode": 0,
|
117 |
+
"inputs": [
|
118 |
+
{
|
119 |
+
"name": "samples",
|
120 |
+
"type": "LATENT",
|
121 |
+
"link": 21
|
122 |
+
},
|
123 |
+
{
|
124 |
+
"name": "vae",
|
125 |
+
"type": "VAE",
|
126 |
+
"link": 22,
|
127 |
+
"slot_index": 1
|
128 |
+
}
|
129 |
+
],
|
130 |
+
"outputs": [
|
131 |
+
{
|
132 |
+
"name": "IMAGE",
|
133 |
+
"type": "IMAGE",
|
134 |
+
"links": [
|
135 |
+
34
|
136 |
+
],
|
137 |
+
"shape": 3,
|
138 |
+
"slot_index": 0
|
139 |
+
}
|
140 |
+
],
|
141 |
+
"properties": {
|
142 |
+
"Node name for S&R": "VAEDecode"
|
143 |
+
}
|
144 |
+
},
|
145 |
+
{
|
146 |
+
"id": 4,
|
147 |
+
"type": "CheckpointLoaderSimple",
|
148 |
+
"pos": [
|
149 |
+
5,
|
150 |
+
479
|
151 |
+
],
|
152 |
+
"size": {
|
153 |
+
"0": 315,
|
154 |
+
"1": 98
|
155 |
+
},
|
156 |
+
"flags": {},
|
157 |
+
"order": 0,
|
158 |
+
"mode": 0,
|
159 |
+
"outputs": [
|
160 |
+
{
|
161 |
+
"name": "MODEL",
|
162 |
+
"type": "MODEL",
|
163 |
+
"links": [
|
164 |
+
31
|
165 |
+
],
|
166 |
+
"slot_index": 0
|
167 |
+
},
|
168 |
+
{
|
169 |
+
"name": "CLIP",
|
170 |
+
"type": "CLIP",
|
171 |
+
"links": [
|
172 |
+
3,
|
173 |
+
5,
|
174 |
+
41,
|
175 |
+
42
|
176 |
+
],
|
177 |
+
"slot_index": 1
|
178 |
+
},
|
179 |
+
{
|
180 |
+
"name": "VAE",
|
181 |
+
"type": "VAE",
|
182 |
+
"links": [
|
183 |
+
22
|
184 |
+
],
|
185 |
+
"slot_index": 2
|
186 |
+
}
|
187 |
+
],
|
188 |
+
"properties": {
|
189 |
+
"Node name for S&R": "CheckpointLoaderSimple"
|
190 |
+
},
|
191 |
+
"widgets_values": [
|
192 |
+
"realisticVisionV20_v20.safetensors"
|
193 |
+
]
|
194 |
+
},
|
195 |
+
{
|
196 |
+
"id": 27,
|
197 |
+
"type": "CLIPTextEncode",
|
198 |
+
"pos": [
|
199 |
+
-20,
|
200 |
+
-20
|
201 |
+
],
|
202 |
+
"size": {
|
203 |
+
"0": 422.84503173828125,
|
204 |
+
"1": 164.31304931640625
|
205 |
+
},
|
206 |
+
"flags": {},
|
207 |
+
"order": 5,
|
208 |
+
"mode": 0,
|
209 |
+
"inputs": [
|
210 |
+
{
|
211 |
+
"name": "clip",
|
212 |
+
"type": "CLIP",
|
213 |
+
"link": 42,
|
214 |
+
"slot_index": 0
|
215 |
+
}
|
216 |
+
],
|
217 |
+
"outputs": [
|
218 |
+
{
|
219 |
+
"name": "CONDITIONING",
|
220 |
+
"type": "CONDITIONING",
|
221 |
+
"links": [
|
222 |
+
40
|
223 |
+
],
|
224 |
+
"slot_index": 0
|
225 |
+
}
|
226 |
+
],
|
227 |
+
"properties": {
|
228 |
+
"Node name for S&R": "CLIPTextEncode"
|
229 |
+
},
|
230 |
+
"widgets_values": [
|
231 |
+
"a cozy room"
|
232 |
+
]
|
233 |
+
},
|
234 |
+
{
|
235 |
+
"id": 21,
|
236 |
+
"type": "LayeredDiffusionJointApply",
|
237 |
+
"pos": [
|
238 |
+
469,
|
239 |
+
-9
|
240 |
+
],
|
241 |
+
"size": {
|
242 |
+
"0": 315,
|
243 |
+
"1": 118
|
244 |
+
},
|
245 |
+
"flags": {},
|
246 |
+
"order": 6,
|
247 |
+
"mode": 0,
|
248 |
+
"inputs": [
|
249 |
+
{
|
250 |
+
"name": "model",
|
251 |
+
"type": "MODEL",
|
252 |
+
"link": 31,
|
253 |
+
"slot_index": 0
|
254 |
+
},
|
255 |
+
{
|
256 |
+
"name": "fg_cond",
|
257 |
+
"type": "CONDITIONING",
|
258 |
+
"link": 39
|
259 |
+
},
|
260 |
+
{
|
261 |
+
"name": "bg_cond",
|
262 |
+
"type": "CONDITIONING",
|
263 |
+
"link": 40
|
264 |
+
},
|
265 |
+
{
|
266 |
+
"name": "blended_cond",
|
267 |
+
"type": "CONDITIONING",
|
268 |
+
"link": 38
|
269 |
+
}
|
270 |
+
],
|
271 |
+
"outputs": [
|
272 |
+
{
|
273 |
+
"name": "MODEL",
|
274 |
+
"type": "MODEL",
|
275 |
+
"links": [
|
276 |
+
32
|
277 |
+
],
|
278 |
+
"shape": 3,
|
279 |
+
"slot_index": 0
|
280 |
+
}
|
281 |
+
],
|
282 |
+
"properties": {
|
283 |
+
"Node name for S&R": "LayeredDiffusionJointApply"
|
284 |
+
},
|
285 |
+
"widgets_values": [
|
286 |
+
"SD15, attn_sharing, Batch size (3N)"
|
287 |
+
],
|
288 |
+
"color": "#232",
|
289 |
+
"bgcolor": "#353"
|
290 |
+
},
|
291 |
+
{
|
292 |
+
"id": 22,
|
293 |
+
"type": "LayeredDiffusionDecodeSplit",
|
294 |
+
"pos": [
|
295 |
+
1534,
|
296 |
+
193
|
297 |
+
],
|
298 |
+
"size": {
|
299 |
+
"0": 315,
|
300 |
+
"1": 146
|
301 |
+
},
|
302 |
+
"flags": {},
|
303 |
+
"order": 9,
|
304 |
+
"mode": 0,
|
305 |
+
"inputs": [
|
306 |
+
{
|
307 |
+
"name": "samples",
|
308 |
+
"type": "LATENT",
|
309 |
+
"link": 33,
|
310 |
+
"slot_index": 0
|
311 |
+
},
|
312 |
+
{
|
313 |
+
"name": "images",
|
314 |
+
"type": "IMAGE",
|
315 |
+
"link": 34
|
316 |
+
}
|
317 |
+
],
|
318 |
+
"outputs": [
|
319 |
+
{
|
320 |
+
"name": "IMAGE",
|
321 |
+
"type": "IMAGE",
|
322 |
+
"links": [
|
323 |
+
35
|
324 |
+
],
|
325 |
+
"shape": 3,
|
326 |
+
"slot_index": 0
|
327 |
+
},
|
328 |
+
{
|
329 |
+
"name": "IMAGE",
|
330 |
+
"type": "IMAGE",
|
331 |
+
"links": [
|
332 |
+
36
|
333 |
+
],
|
334 |
+
"shape": 3,
|
335 |
+
"slot_index": 1
|
336 |
+
},
|
337 |
+
{
|
338 |
+
"name": "IMAGE",
|
339 |
+
"type": "IMAGE",
|
340 |
+
"links": [
|
341 |
+
37
|
342 |
+
],
|
343 |
+
"shape": 3,
|
344 |
+
"slot_index": 2
|
345 |
+
}
|
346 |
+
],
|
347 |
+
"properties": {
|
348 |
+
"Node name for S&R": "LayeredDiffusionDecodeSplit"
|
349 |
+
},
|
350 |
+
"widgets_values": [
|
351 |
+
3,
|
352 |
+
"SD15",
|
353 |
+
16
|
354 |
+
],
|
355 |
+
"color": "#232",
|
356 |
+
"bgcolor": "#353"
|
357 |
+
},
|
358 |
+
{
|
359 |
+
"id": 5,
|
360 |
+
"type": "EmptyLatentImage",
|
361 |
+
"pos": [
|
362 |
+
466,
|
363 |
+
645
|
364 |
+
],
|
365 |
+
"size": {
|
366 |
+
"0": 315,
|
367 |
+
"1": 106
|
368 |
+
},
|
369 |
+
"flags": {},
|
370 |
+
"order": 1,
|
371 |
+
"mode": 0,
|
372 |
+
"outputs": [
|
373 |
+
{
|
374 |
+
"name": "LATENT",
|
375 |
+
"type": "LATENT",
|
376 |
+
"links": [
|
377 |
+
2
|
378 |
+
],
|
379 |
+
"slot_index": 0
|
380 |
+
}
|
381 |
+
],
|
382 |
+
"properties": {
|
383 |
+
"Node name for S&R": "EmptyLatentImage"
|
384 |
+
},
|
385 |
+
"widgets_values": [
|
386 |
+
512,
|
387 |
+
512,
|
388 |
+
6
|
389 |
+
]
|
390 |
+
},
|
391 |
+
{
|
392 |
+
"id": 26,
|
393 |
+
"type": "CLIPTextEncode",
|
394 |
+
"pos": [
|
395 |
+
-20,
|
396 |
+
-235
|
397 |
+
],
|
398 |
+
"size": {
|
399 |
+
"0": 422.84503173828125,
|
400 |
+
"1": 164.31304931640625
|
401 |
+
},
|
402 |
+
"flags": {},
|
403 |
+
"order": 4,
|
404 |
+
"mode": 0,
|
405 |
+
"inputs": [
|
406 |
+
{
|
407 |
+
"name": "clip",
|
408 |
+
"type": "CLIP",
|
409 |
+
"link": 41,
|
410 |
+
"slot_index": 0
|
411 |
+
}
|
412 |
+
],
|
413 |
+
"outputs": [
|
414 |
+
{
|
415 |
+
"name": "CONDITIONING",
|
416 |
+
"type": "CONDITIONING",
|
417 |
+
"links": [
|
418 |
+
39
|
419 |
+
],
|
420 |
+
"slot_index": 0
|
421 |
+
}
|
422 |
+
],
|
423 |
+
"properties": {
|
424 |
+
"Node name for S&R": "CLIPTextEncode"
|
425 |
+
},
|
426 |
+
"widgets_values": [
|
427 |
+
"a sitting dog"
|
428 |
+
]
|
429 |
+
},
|
430 |
+
{
|
431 |
+
"id": 6,
|
432 |
+
"type": "CLIPTextEncode",
|
433 |
+
"pos": [
|
434 |
+
413,
|
435 |
+
172
|
436 |
+
],
|
437 |
+
"size": {
|
438 |
+
"0": 422.84503173828125,
|
439 |
+
"1": 164.31304931640625
|
440 |
+
},
|
441 |
+
"flags": {},
|
442 |
+
"order": 2,
|
443 |
+
"mode": 0,
|
444 |
+
"inputs": [
|
445 |
+
{
|
446 |
+
"name": "clip",
|
447 |
+
"type": "CLIP",
|
448 |
+
"link": 3
|
449 |
+
}
|
450 |
+
],
|
451 |
+
"outputs": [
|
452 |
+
{
|
453 |
+
"name": "CONDITIONING",
|
454 |
+
"type": "CONDITIONING",
|
455 |
+
"links": [
|
456 |
+
4,
|
457 |
+
38
|
458 |
+
],
|
459 |
+
"slot_index": 0
|
460 |
+
}
|
461 |
+
],
|
462 |
+
"properties": {
|
463 |
+
"Node name for S&R": "CLIPTextEncode"
|
464 |
+
},
|
465 |
+
"widgets_values": [
|
466 |
+
"A dog sitting in a cozy room"
|
467 |
+
]
|
468 |
+
},
|
469 |
+
{
|
470 |
+
"id": 23,
|
471 |
+
"type": "PreviewImage",
|
472 |
+
"pos": [
|
473 |
+
1931,
|
474 |
+
-98
|
475 |
+
],
|
476 |
+
"size": [
|
477 |
+
522.1710021972658,
|
478 |
+
259.90739746093755
|
479 |
+
],
|
480 |
+
"flags": {},
|
481 |
+
"order": 10,
|
482 |
+
"mode": 0,
|
483 |
+
"inputs": [
|
484 |
+
{
|
485 |
+
"name": "images",
|
486 |
+
"type": "IMAGE",
|
487 |
+
"link": 35
|
488 |
+
}
|
489 |
+
],
|
490 |
+
"properties": {
|
491 |
+
"Node name for S&R": "PreviewImage"
|
492 |
+
}
|
493 |
+
},
|
494 |
+
{
|
495 |
+
"id": 24,
|
496 |
+
"type": "PreviewImage",
|
497 |
+
"pos": [
|
498 |
+
1933,
|
499 |
+
222
|
500 |
+
],
|
501 |
+
"size": [
|
502 |
+
517.9710037231448,
|
503 |
+
258.9074523925782
|
504 |
+
],
|
505 |
+
"flags": {},
|
506 |
+
"order": 11,
|
507 |
+
"mode": 0,
|
508 |
+
"inputs": [
|
509 |
+
{
|
510 |
+
"name": "images",
|
511 |
+
"type": "IMAGE",
|
512 |
+
"link": 36
|
513 |
+
}
|
514 |
+
],
|
515 |
+
"properties": {
|
516 |
+
"Node name for S&R": "PreviewImage"
|
517 |
+
}
|
518 |
+
},
|
519 |
+
{
|
520 |
+
"id": 25,
|
521 |
+
"type": "PreviewImage",
|
522 |
+
"pos": [
|
523 |
+
1933,
|
524 |
+
536
|
525 |
+
],
|
526 |
+
"size": [
|
527 |
+
516.8710037231444,
|
528 |
+
270.5074523925782
|
529 |
+
],
|
530 |
+
"flags": {},
|
531 |
+
"order": 12,
|
532 |
+
"mode": 0,
|
533 |
+
"inputs": [
|
534 |
+
{
|
535 |
+
"name": "images",
|
536 |
+
"type": "IMAGE",
|
537 |
+
"link": 37
|
538 |
+
}
|
539 |
+
],
|
540 |
+
"properties": {
|
541 |
+
"Node name for S&R": "PreviewImage"
|
542 |
+
}
|
543 |
+
}
|
544 |
+
],
|
545 |
+
"links": [
|
546 |
+
[
|
547 |
+
2,
|
548 |
+
5,
|
549 |
+
0,
|
550 |
+
3,
|
551 |
+
3,
|
552 |
+
"LATENT"
|
553 |
+
],
|
554 |
+
[
|
555 |
+
3,
|
556 |
+
4,
|
557 |
+
1,
|
558 |
+
6,
|
559 |
+
0,
|
560 |
+
"CLIP"
|
561 |
+
],
|
562 |
+
[
|
563 |
+
4,
|
564 |
+
6,
|
565 |
+
0,
|
566 |
+
3,
|
567 |
+
1,
|
568 |
+
"CONDITIONING"
|
569 |
+
],
|
570 |
+
[
|
571 |
+
5,
|
572 |
+
4,
|
573 |
+
1,
|
574 |
+
7,
|
575 |
+
0,
|
576 |
+
"CLIP"
|
577 |
+
],
|
578 |
+
[
|
579 |
+
6,
|
580 |
+
7,
|
581 |
+
0,
|
582 |
+
3,
|
583 |
+
2,
|
584 |
+
"CONDITIONING"
|
585 |
+
],
|
586 |
+
[
|
587 |
+
21,
|
588 |
+
3,
|
589 |
+
0,
|
590 |
+
14,
|
591 |
+
0,
|
592 |
+
"LATENT"
|
593 |
+
],
|
594 |
+
[
|
595 |
+
22,
|
596 |
+
4,
|
597 |
+
2,
|
598 |
+
14,
|
599 |
+
1,
|
600 |
+
"VAE"
|
601 |
+
],
|
602 |
+
[
|
603 |
+
31,
|
604 |
+
4,
|
605 |
+
0,
|
606 |
+
21,
|
607 |
+
0,
|
608 |
+
"MODEL"
|
609 |
+
],
|
610 |
+
[
|
611 |
+
32,
|
612 |
+
21,
|
613 |
+
0,
|
614 |
+
3,
|
615 |
+
0,
|
616 |
+
"MODEL"
|
617 |
+
],
|
618 |
+
[
|
619 |
+
33,
|
620 |
+
3,
|
621 |
+
0,
|
622 |
+
22,
|
623 |
+
0,
|
624 |
+
"LATENT"
|
625 |
+
],
|
626 |
+
[
|
627 |
+
34,
|
628 |
+
14,
|
629 |
+
0,
|
630 |
+
22,
|
631 |
+
1,
|
632 |
+
"IMAGE"
|
633 |
+
],
|
634 |
+
[
|
635 |
+
35,
|
636 |
+
22,
|
637 |
+
0,
|
638 |
+
23,
|
639 |
+
0,
|
640 |
+
"IMAGE"
|
641 |
+
],
|
642 |
+
[
|
643 |
+
36,
|
644 |
+
22,
|
645 |
+
1,
|
646 |
+
24,
|
647 |
+
0,
|
648 |
+
"IMAGE"
|
649 |
+
],
|
650 |
+
[
|
651 |
+
37,
|
652 |
+
22,
|
653 |
+
2,
|
654 |
+
25,
|
655 |
+
0,
|
656 |
+
"IMAGE"
|
657 |
+
],
|
658 |
+
[
|
659 |
+
38,
|
660 |
+
6,
|
661 |
+
0,
|
662 |
+
21,
|
663 |
+
3,
|
664 |
+
"CONDITIONING"
|
665 |
+
],
|
666 |
+
[
|
667 |
+
39,
|
668 |
+
26,
|
669 |
+
0,
|
670 |
+
21,
|
671 |
+
1,
|
672 |
+
"CONDITIONING"
|
673 |
+
],
|
674 |
+
[
|
675 |
+
40,
|
676 |
+
27,
|
677 |
+
0,
|
678 |
+
21,
|
679 |
+
2,
|
680 |
+
"CONDITIONING"
|
681 |
+
],
|
682 |
+
[
|
683 |
+
41,
|
684 |
+
4,
|
685 |
+
1,
|
686 |
+
26,
|
687 |
+
0,
|
688 |
+
"CLIP"
|
689 |
+
],
|
690 |
+
[
|
691 |
+
42,
|
692 |
+
4,
|
693 |
+
1,
|
694 |
+
27,
|
695 |
+
0,
|
696 |
+
"CLIP"
|
697 |
+
]
|
698 |
+
],
|
699 |
+
"groups": [],
|
700 |
+
"config": {},
|
701 |
+
"extra": {},
|
702 |
+
"version": 0.4
|
703 |
+
}
|
ComfyUI/custom_nodes/layerdiffuse/layered_diffusion.py
ADDED
@@ -0,0 +1,683 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
from enum import Enum
|
3 |
+
import torch
|
4 |
+
import functools
|
5 |
+
import copy
|
6 |
+
from typing import Optional, List
|
7 |
+
from dataclasses import dataclass
|
8 |
+
|
9 |
+
import folder_paths
|
10 |
+
import comfy.model_management
|
11 |
+
import comfy.model_base
|
12 |
+
import comfy.supported_models
|
13 |
+
import comfy.supported_models_base
|
14 |
+
from comfy.model_patcher import ModelPatcher
|
15 |
+
from folder_paths import get_folder_paths
|
16 |
+
from comfy.utils import load_torch_file
|
17 |
+
from comfy_extras.nodes_compositing import JoinImageWithAlpha
|
18 |
+
from comfy.conds import CONDRegular
|
19 |
+
from .lib_layerdiffusion.utils import (
|
20 |
+
load_file_from_url,
|
21 |
+
to_lora_patch_dict,
|
22 |
+
)
|
23 |
+
from .lib_layerdiffusion.models import TransparentVAEDecoder
|
24 |
+
from .lib_layerdiffusion.attention_sharing import AttentionSharingPatcher
|
25 |
+
from .lib_layerdiffusion.enums import StableDiffusionVersion
|
26 |
+
|
27 |
+
if "layer_model" in folder_paths.folder_names_and_paths:
|
28 |
+
layer_model_root = get_folder_paths("layer_model")[0]
|
29 |
+
else:
|
30 |
+
layer_model_root = os.path.join(folder_paths.models_dir, "layer_model")
|
31 |
+
load_layer_model_state_dict = load_torch_file
|
32 |
+
|
33 |
+
|
34 |
+
# ------------ Start patching ComfyUI ------------
|
35 |
+
def calculate_weight_adjust_channel(func):
|
36 |
+
"""Patches ComfyUI's LoRA weight application to accept multi-channel inputs."""
|
37 |
+
|
38 |
+
@functools.wraps(func)
|
39 |
+
def calculate_weight(
|
40 |
+
self: ModelPatcher, patches, weight: torch.Tensor, key: str
|
41 |
+
) -> torch.Tensor:
|
42 |
+
weight = func(self, patches, weight, key)
|
43 |
+
|
44 |
+
for p in patches:
|
45 |
+
alpha = p[0]
|
46 |
+
v = p[1]
|
47 |
+
|
48 |
+
# The recursion call should be handled in the main func call.
|
49 |
+
if isinstance(v, list):
|
50 |
+
continue
|
51 |
+
|
52 |
+
if len(v) == 1:
|
53 |
+
patch_type = "diff"
|
54 |
+
elif len(v) == 2:
|
55 |
+
patch_type = v[0]
|
56 |
+
v = v[1]
|
57 |
+
|
58 |
+
if patch_type == "diff":
|
59 |
+
w1 = v[0]
|
60 |
+
if all(
|
61 |
+
(
|
62 |
+
alpha != 0.0,
|
63 |
+
w1.shape != weight.shape,
|
64 |
+
w1.ndim == weight.ndim == 4,
|
65 |
+
)
|
66 |
+
):
|
67 |
+
new_shape = [max(n, m) for n, m in zip(weight.shape, w1.shape)]
|
68 |
+
print(
|
69 |
+
f"Merged with {key} channel changed from {weight.shape} to {new_shape}"
|
70 |
+
)
|
71 |
+
new_diff = alpha * comfy.model_management.cast_to_device(
|
72 |
+
w1, weight.device, weight.dtype
|
73 |
+
)
|
74 |
+
new_weight = torch.zeros(size=new_shape).to(weight)
|
75 |
+
new_weight[
|
76 |
+
: weight.shape[0],
|
77 |
+
: weight.shape[1],
|
78 |
+
: weight.shape[2],
|
79 |
+
: weight.shape[3],
|
80 |
+
] = weight
|
81 |
+
new_weight[
|
82 |
+
: new_diff.shape[0],
|
83 |
+
: new_diff.shape[1],
|
84 |
+
: new_diff.shape[2],
|
85 |
+
: new_diff.shape[3],
|
86 |
+
] += new_diff
|
87 |
+
new_weight = new_weight.contiguous().clone()
|
88 |
+
weight = new_weight
|
89 |
+
return weight
|
90 |
+
|
91 |
+
return calculate_weight
|
92 |
+
|
93 |
+
|
94 |
+
ModelPatcher.calculate_weight = calculate_weight_adjust_channel(
|
95 |
+
ModelPatcher.calculate_weight
|
96 |
+
)
|
97 |
+
|
98 |
+
# ------------ End patching ComfyUI ------------
|
99 |
+
|
100 |
+
|
101 |
+
class LayeredDiffusionDecode:
|
102 |
+
"""
|
103 |
+
Decode alpha channel value from pixel value.
|
104 |
+
[B, C=3, H, W] => [B, C=4, H, W]
|
105 |
+
Outputs RGB image + Alpha mask.
|
106 |
+
"""
|
107 |
+
|
108 |
+
@classmethod
|
109 |
+
def INPUT_TYPES(s):
|
110 |
+
return {
|
111 |
+
"required": {
|
112 |
+
"samples": ("LATENT",),
|
113 |
+
"images": ("IMAGE",),
|
114 |
+
"sd_version": (
|
115 |
+
[
|
116 |
+
StableDiffusionVersion.SD1x.value,
|
117 |
+
StableDiffusionVersion.SDXL.value,
|
118 |
+
],
|
119 |
+
{
|
120 |
+
"default": StableDiffusionVersion.SDXL.value,
|
121 |
+
},
|
122 |
+
),
|
123 |
+
"sub_batch_size": (
|
124 |
+
"INT",
|
125 |
+
{"default": 16, "min": 1, "max": 4096, "step": 1},
|
126 |
+
),
|
127 |
+
},
|
128 |
+
}
|
129 |
+
|
130 |
+
RETURN_TYPES = ("IMAGE", "MASK")
|
131 |
+
FUNCTION = "decode"
|
132 |
+
CATEGORY = "layer_diffuse"
|
133 |
+
|
134 |
+
def __init__(self) -> None:
|
135 |
+
self.vae_transparent_decoder = {}
|
136 |
+
|
137 |
+
def decode(self, samples, images, sd_version: str, sub_batch_size: int):
|
138 |
+
"""
|
139 |
+
sub_batch_size: How many images to decode in a single pass.
|
140 |
+
See https://github.com/huchenlei/ComfyUI-layerdiffuse/pull/4 for more
|
141 |
+
context.
|
142 |
+
"""
|
143 |
+
sd_version = StableDiffusionVersion(sd_version)
|
144 |
+
if sd_version == StableDiffusionVersion.SD1x:
|
145 |
+
url = "https://huggingface.co/LayerDiffusion/layerdiffusion-v1/resolve/main/layer_sd15_vae_transparent_decoder.safetensors"
|
146 |
+
file_name = "layer_sd15_vae_transparent_decoder.safetensors"
|
147 |
+
elif sd_version == StableDiffusionVersion.SDXL:
|
148 |
+
url = "https://huggingface.co/LayerDiffusion/layerdiffusion-v1/resolve/main/vae_transparent_decoder.safetensors"
|
149 |
+
file_name = "vae_transparent_decoder.safetensors"
|
150 |
+
|
151 |
+
if not self.vae_transparent_decoder.get(sd_version):
|
152 |
+
model_path = load_file_from_url(
|
153 |
+
url=url, model_dir=layer_model_root, file_name=file_name
|
154 |
+
)
|
155 |
+
self.vae_transparent_decoder[sd_version] = TransparentVAEDecoder(
|
156 |
+
load_torch_file(model_path),
|
157 |
+
device=comfy.model_management.get_torch_device(),
|
158 |
+
dtype=(
|
159 |
+
torch.float16
|
160 |
+
if comfy.model_management.should_use_fp16()
|
161 |
+
else torch.float32
|
162 |
+
),
|
163 |
+
)
|
164 |
+
pixel = images.movedim(-1, 1) # [B, H, W, C] => [B, C, H, W]
|
165 |
+
|
166 |
+
# Decoder requires dimension to be 64-aligned.
|
167 |
+
B, C, H, W = pixel.shape
|
168 |
+
assert H % 64 == 0, f"Height({H}) is not multiple of 64."
|
169 |
+
assert W % 64 == 0, f"Height({W}) is not multiple of 64."
|
170 |
+
|
171 |
+
decoded = []
|
172 |
+
for start_idx in range(0, samples["samples"].shape[0], sub_batch_size):
|
173 |
+
decoded.append(
|
174 |
+
self.vae_transparent_decoder[sd_version].decode_pixel(
|
175 |
+
pixel[start_idx : start_idx + sub_batch_size],
|
176 |
+
samples["samples"][start_idx : start_idx + sub_batch_size],
|
177 |
+
)
|
178 |
+
)
|
179 |
+
pixel_with_alpha = torch.cat(decoded, dim=0)
|
180 |
+
|
181 |
+
# [B, C, H, W] => [B, H, W, C]
|
182 |
+
pixel_with_alpha = pixel_with_alpha.movedim(1, -1)
|
183 |
+
image = pixel_with_alpha[..., 1:]
|
184 |
+
alpha = pixel_with_alpha[..., 0]
|
185 |
+
return (image, alpha)
|
186 |
+
|
187 |
+
|
188 |
+
class LayeredDiffusionDecodeRGBA(LayeredDiffusionDecode):
|
189 |
+
"""
|
190 |
+
Decode alpha channel value from pixel value.
|
191 |
+
[B, C=3, H, W] => [B, C=4, H, W]
|
192 |
+
Outputs RGBA image.
|
193 |
+
"""
|
194 |
+
|
195 |
+
RETURN_TYPES = ("IMAGE",)
|
196 |
+
|
197 |
+
def decode(self, samples, images, sd_version: str, sub_batch_size: int):
|
198 |
+
image, mask = super().decode(samples, images, sd_version, sub_batch_size)
|
199 |
+
alpha = 1.0 - mask
|
200 |
+
return JoinImageWithAlpha().join_image_with_alpha(image, alpha)
|
201 |
+
|
202 |
+
|
203 |
+
class LayeredDiffusionDecodeSplit(LayeredDiffusionDecodeRGBA):
|
204 |
+
"""Decode RGBA every N images."""
|
205 |
+
|
206 |
+
@classmethod
|
207 |
+
def INPUT_TYPES(s):
|
208 |
+
return {
|
209 |
+
"required": {
|
210 |
+
"samples": ("LATENT",),
|
211 |
+
"images": ("IMAGE",),
|
212 |
+
# Do RGBA decode every N output images.
|
213 |
+
"frames": (
|
214 |
+
"INT",
|
215 |
+
{"default": 2, "min": 2, "max": s.MAX_FRAMES, "step": 1},
|
216 |
+
),
|
217 |
+
"sd_version": (
|
218 |
+
[
|
219 |
+
StableDiffusionVersion.SD1x.value,
|
220 |
+
StableDiffusionVersion.SDXL.value,
|
221 |
+
],
|
222 |
+
{
|
223 |
+
"default": StableDiffusionVersion.SDXL.value,
|
224 |
+
},
|
225 |
+
),
|
226 |
+
"sub_batch_size": (
|
227 |
+
"INT",
|
228 |
+
{"default": 16, "min": 1, "max": 4096, "step": 1},
|
229 |
+
),
|
230 |
+
},
|
231 |
+
}
|
232 |
+
|
233 |
+
MAX_FRAMES = 3
|
234 |
+
RETURN_TYPES = ("IMAGE",) * MAX_FRAMES
|
235 |
+
|
236 |
+
def decode(
|
237 |
+
self,
|
238 |
+
samples,
|
239 |
+
images: torch.Tensor,
|
240 |
+
frames: int,
|
241 |
+
sd_version: str,
|
242 |
+
sub_batch_size: int,
|
243 |
+
):
|
244 |
+
sliced_samples = copy.copy(samples)
|
245 |
+
sliced_samples["samples"] = sliced_samples["samples"][::frames]
|
246 |
+
return tuple(
|
247 |
+
(
|
248 |
+
(
|
249 |
+
super(LayeredDiffusionDecodeSplit, self).decode(
|
250 |
+
sliced_samples, imgs, sd_version, sub_batch_size
|
251 |
+
)[0]
|
252 |
+
if i == 0
|
253 |
+
else imgs
|
254 |
+
)
|
255 |
+
for i in range(frames)
|
256 |
+
for imgs in (images[i::frames],)
|
257 |
+
)
|
258 |
+
) + (None,) * (self.MAX_FRAMES - frames)
|
259 |
+
|
260 |
+
|
261 |
+
class LayerMethod(Enum):
|
262 |
+
ATTN = "Attention Injection"
|
263 |
+
CONV = "Conv Injection"
|
264 |
+
|
265 |
+
|
266 |
+
class LayerType(Enum):
|
267 |
+
FG = "Foreground"
|
268 |
+
BG = "Background"
|
269 |
+
|
270 |
+
|
271 |
+
@dataclass
|
272 |
+
class LayeredDiffusionBase:
|
273 |
+
model_file_name: str
|
274 |
+
model_url: str
|
275 |
+
sd_version: StableDiffusionVersion
|
276 |
+
attn_sharing: bool = False
|
277 |
+
injection_method: Optional[LayerMethod] = None
|
278 |
+
cond_type: Optional[LayerType] = None
|
279 |
+
# Number of output images per run.
|
280 |
+
frames: int = 1
|
281 |
+
|
282 |
+
@property
|
283 |
+
def config_string(self) -> str:
|
284 |
+
injection_method = self.injection_method.value if self.injection_method else ""
|
285 |
+
cond_type = self.cond_type.value if self.cond_type else ""
|
286 |
+
attn_sharing = "attn_sharing" if self.attn_sharing else ""
|
287 |
+
frames = f"Batch size ({self.frames}N)" if self.frames != 1 else ""
|
288 |
+
return ", ".join(
|
289 |
+
x
|
290 |
+
for x in (
|
291 |
+
self.sd_version.value,
|
292 |
+
injection_method,
|
293 |
+
cond_type,
|
294 |
+
attn_sharing,
|
295 |
+
frames,
|
296 |
+
)
|
297 |
+
if x
|
298 |
+
)
|
299 |
+
|
300 |
+
def apply_c_concat(self, cond, uncond, c_concat):
|
301 |
+
"""Set foreground/background concat condition."""
|
302 |
+
|
303 |
+
def write_c_concat(cond):
|
304 |
+
new_cond = []
|
305 |
+
for t in cond:
|
306 |
+
n = [t[0], t[1].copy()]
|
307 |
+
if "model_conds" not in n[1]:
|
308 |
+
n[1]["model_conds"] = {}
|
309 |
+
n[1]["model_conds"]["c_concat"] = CONDRegular(c_concat)
|
310 |
+
new_cond.append(n)
|
311 |
+
return new_cond
|
312 |
+
|
313 |
+
return (write_c_concat(cond), write_c_concat(uncond))
|
314 |
+
|
315 |
+
def apply_layered_diffusion(
|
316 |
+
self,
|
317 |
+
model: ModelPatcher,
|
318 |
+
weight: float,
|
319 |
+
):
|
320 |
+
"""Patch model"""
|
321 |
+
model_path = load_file_from_url(
|
322 |
+
url=self.model_url,
|
323 |
+
model_dir=layer_model_root,
|
324 |
+
file_name=self.model_file_name,
|
325 |
+
)
|
326 |
+
layer_lora_state_dict = load_layer_model_state_dict(model_path)
|
327 |
+
layer_lora_patch_dict = to_lora_patch_dict(layer_lora_state_dict)
|
328 |
+
work_model = model.clone()
|
329 |
+
work_model.add_patches(layer_lora_patch_dict, weight)
|
330 |
+
return (work_model,)
|
331 |
+
|
332 |
+
def apply_layered_diffusion_attn_sharing(
|
333 |
+
self,
|
334 |
+
model: ModelPatcher,
|
335 |
+
control_img: Optional[torch.TensorType] = None,
|
336 |
+
):
|
337 |
+
"""Patch model with attn sharing"""
|
338 |
+
model_path = load_file_from_url(
|
339 |
+
url=self.model_url,
|
340 |
+
model_dir=layer_model_root,
|
341 |
+
file_name=self.model_file_name,
|
342 |
+
)
|
343 |
+
layer_lora_state_dict = load_layer_model_state_dict(model_path)
|
344 |
+
work_model = model.clone()
|
345 |
+
patcher = AttentionSharingPatcher(
|
346 |
+
work_model, self.frames, use_control=control_img is not None
|
347 |
+
)
|
348 |
+
patcher.load_state_dict(layer_lora_state_dict, strict=True)
|
349 |
+
if control_img is not None:
|
350 |
+
patcher.set_control(control_img)
|
351 |
+
return (work_model,)
|
352 |
+
|
353 |
+
|
354 |
+
def get_model_sd_version(model: ModelPatcher) -> StableDiffusionVersion:
|
355 |
+
"""Get model's StableDiffusionVersion."""
|
356 |
+
base: comfy.model_base.BaseModel = model.model
|
357 |
+
model_config: comfy.supported_models.supported_models_base.BASE = base.model_config
|
358 |
+
if isinstance(model_config, comfy.supported_models.SDXL):
|
359 |
+
return StableDiffusionVersion.SDXL
|
360 |
+
elif isinstance(
|
361 |
+
model_config, (comfy.supported_models.SD15, comfy.supported_models.SD20)
|
362 |
+
):
|
363 |
+
# SD15 and SD20 are compatible with each other.
|
364 |
+
return StableDiffusionVersion.SD1x
|
365 |
+
else:
|
366 |
+
raise Exception(f"Unsupported SD Version: {type(model_config)}.")
|
367 |
+
|
368 |
+
|
369 |
+
class LayeredDiffusionFG:
|
370 |
+
"""Generate foreground with transparent background."""
|
371 |
+
|
372 |
+
@classmethod
|
373 |
+
def INPUT_TYPES(s):
|
374 |
+
return {
|
375 |
+
"required": {
|
376 |
+
"model": ("MODEL",),
|
377 |
+
"config": ([c.config_string for c in s.MODELS],),
|
378 |
+
"weight": (
|
379 |
+
"FLOAT",
|
380 |
+
{"default": 1.0, "min": -1, "max": 3, "step": 0.05},
|
381 |
+
),
|
382 |
+
},
|
383 |
+
}
|
384 |
+
|
385 |
+
RETURN_TYPES = ("MODEL",)
|
386 |
+
FUNCTION = "apply_layered_diffusion"
|
387 |
+
CATEGORY = "layer_diffuse"
|
388 |
+
MODELS = (
|
389 |
+
LayeredDiffusionBase(
|
390 |
+
model_file_name="layer_xl_transparent_attn.safetensors",
|
391 |
+
model_url="https://huggingface.co/LayerDiffusion/layerdiffusion-v1/resolve/main/layer_xl_transparent_attn.safetensors",
|
392 |
+
sd_version=StableDiffusionVersion.SDXL,
|
393 |
+
injection_method=LayerMethod.ATTN,
|
394 |
+
),
|
395 |
+
LayeredDiffusionBase(
|
396 |
+
model_file_name="layer_xl_transparent_conv.safetensors",
|
397 |
+
model_url="https://huggingface.co/LayerDiffusion/layerdiffusion-v1/resolve/main/layer_xl_transparent_conv.safetensors",
|
398 |
+
sd_version=StableDiffusionVersion.SDXL,
|
399 |
+
injection_method=LayerMethod.CONV,
|
400 |
+
),
|
401 |
+
LayeredDiffusionBase(
|
402 |
+
model_file_name="layer_sd15_transparent_attn.safetensors",
|
403 |
+
model_url="https://huggingface.co/LayerDiffusion/layerdiffusion-v1/resolve/main/layer_sd15_transparent_attn.safetensors",
|
404 |
+
sd_version=StableDiffusionVersion.SD1x,
|
405 |
+
injection_method=LayerMethod.ATTN,
|
406 |
+
attn_sharing=True,
|
407 |
+
),
|
408 |
+
)
|
409 |
+
|
410 |
+
def apply_layered_diffusion(
|
411 |
+
self,
|
412 |
+
model: ModelPatcher,
|
413 |
+
config: str,
|
414 |
+
weight: float,
|
415 |
+
):
|
416 |
+
ld_model = [m for m in self.MODELS if m.config_string == config][0]
|
417 |
+
assert get_model_sd_version(model) == ld_model.sd_version
|
418 |
+
if ld_model.attn_sharing:
|
419 |
+
return ld_model.apply_layered_diffusion_attn_sharing(model)
|
420 |
+
else:
|
421 |
+
return ld_model.apply_layered_diffusion(model, weight)
|
422 |
+
|
423 |
+
|
424 |
+
class LayeredDiffusionJoint:
|
425 |
+
"""Generate FG + BG + Blended in one inference batch. Batch size = 3N."""
|
426 |
+
|
427 |
+
@classmethod
|
428 |
+
def INPUT_TYPES(s):
|
429 |
+
return {
|
430 |
+
"required": {
|
431 |
+
"model": ("MODEL",),
|
432 |
+
"config": ([c.config_string for c in s.MODELS],),
|
433 |
+
},
|
434 |
+
"optional": {
|
435 |
+
"fg_cond": ("CONDITIONING",),
|
436 |
+
"bg_cond": ("CONDITIONING",),
|
437 |
+
"blended_cond": ("CONDITIONING",),
|
438 |
+
},
|
439 |
+
}
|
440 |
+
|
441 |
+
RETURN_TYPES = ("MODEL",)
|
442 |
+
FUNCTION = "apply_layered_diffusion"
|
443 |
+
CATEGORY = "layer_diffuse"
|
444 |
+
MODELS = (
|
445 |
+
LayeredDiffusionBase(
|
446 |
+
model_file_name="layer_sd15_joint.safetensors",
|
447 |
+
model_url="https://huggingface.co/LayerDiffusion/layerdiffusion-v1/resolve/main/layer_sd15_joint.safetensors",
|
448 |
+
sd_version=StableDiffusionVersion.SD1x,
|
449 |
+
attn_sharing=True,
|
450 |
+
frames=3,
|
451 |
+
),
|
452 |
+
)
|
453 |
+
|
454 |
+
def apply_layered_diffusion(
|
455 |
+
self,
|
456 |
+
model: ModelPatcher,
|
457 |
+
config: str,
|
458 |
+
fg_cond: Optional[List[List[torch.TensorType]]] = None,
|
459 |
+
bg_cond: Optional[List[List[torch.TensorType]]] = None,
|
460 |
+
blended_cond: Optional[List[List[torch.TensorType]]] = None,
|
461 |
+
):
|
462 |
+
ld_model = [m for m in self.MODELS if m.config_string == config][0]
|
463 |
+
assert get_model_sd_version(model) == ld_model.sd_version
|
464 |
+
assert ld_model.attn_sharing
|
465 |
+
work_model = ld_model.apply_layered_diffusion_attn_sharing(model)[0]
|
466 |
+
work_model.model_options.setdefault("transformer_options", {})
|
467 |
+
work_model.model_options["transformer_options"]["cond_overwrite"] = [
|
468 |
+
cond[0][0] if cond is not None else None
|
469 |
+
for cond in (
|
470 |
+
fg_cond,
|
471 |
+
bg_cond,
|
472 |
+
blended_cond,
|
473 |
+
)
|
474 |
+
]
|
475 |
+
return (work_model,)
|
476 |
+
|
477 |
+
|
478 |
+
class LayeredDiffusionCond:
|
479 |
+
"""Generate foreground + background given background / foreground.
|
480 |
+
- FG => Blended
|
481 |
+
- BG => Blended
|
482 |
+
"""
|
483 |
+
|
484 |
+
@classmethod
|
485 |
+
def INPUT_TYPES(s):
|
486 |
+
return {
|
487 |
+
"required": {
|
488 |
+
"model": ("MODEL",),
|
489 |
+
"cond": ("CONDITIONING",),
|
490 |
+
"uncond": ("CONDITIONING",),
|
491 |
+
"latent": ("LATENT",),
|
492 |
+
"config": ([c.config_string for c in s.MODELS],),
|
493 |
+
"weight": (
|
494 |
+
"FLOAT",
|
495 |
+
{"default": 1.0, "min": -1, "max": 3, "step": 0.05},
|
496 |
+
),
|
497 |
+
},
|
498 |
+
}
|
499 |
+
|
500 |
+
RETURN_TYPES = ("MODEL", "CONDITIONING", "CONDITIONING")
|
501 |
+
FUNCTION = "apply_layered_diffusion"
|
502 |
+
CATEGORY = "layer_diffuse"
|
503 |
+
MODELS = (
|
504 |
+
LayeredDiffusionBase(
|
505 |
+
model_file_name="layer_xl_fg2ble.safetensors",
|
506 |
+
model_url="https://huggingface.co/LayerDiffusion/layerdiffusion-v1/resolve/main/layer_xl_fg2ble.safetensors",
|
507 |
+
sd_version=StableDiffusionVersion.SDXL,
|
508 |
+
cond_type=LayerType.FG,
|
509 |
+
),
|
510 |
+
LayeredDiffusionBase(
|
511 |
+
model_file_name="layer_xl_bg2ble.safetensors",
|
512 |
+
model_url="https://huggingface.co/LayerDiffusion/layerdiffusion-v1/resolve/main/layer_xl_bg2ble.safetensors",
|
513 |
+
sd_version=StableDiffusionVersion.SDXL,
|
514 |
+
cond_type=LayerType.BG,
|
515 |
+
),
|
516 |
+
)
|
517 |
+
|
518 |
+
def apply_layered_diffusion(
|
519 |
+
self,
|
520 |
+
model: ModelPatcher,
|
521 |
+
cond,
|
522 |
+
uncond,
|
523 |
+
latent,
|
524 |
+
config: str,
|
525 |
+
weight: float,
|
526 |
+
):
|
527 |
+
ld_model = [m for m in self.MODELS if m.config_string == config][0]
|
528 |
+
assert get_model_sd_version(model) == ld_model.sd_version
|
529 |
+
c_concat = model.model.latent_format.process_in(latent["samples"])
|
530 |
+
return ld_model.apply_layered_diffusion(
|
531 |
+
model, weight
|
532 |
+
) + ld_model.apply_c_concat(cond, uncond, c_concat)
|
533 |
+
|
534 |
+
|
535 |
+
class LayeredDiffusionCondJoint:
|
536 |
+
"""Generate fg/bg + blended given fg/bg.
|
537 |
+
- FG => Blended + BG
|
538 |
+
- BG => Blended + FG
|
539 |
+
"""
|
540 |
+
|
541 |
+
@classmethod
|
542 |
+
def INPUT_TYPES(s):
|
543 |
+
return {
|
544 |
+
"required": {
|
545 |
+
"model": ("MODEL",),
|
546 |
+
"image": ("IMAGE",),
|
547 |
+
"config": ([c.config_string for c in s.MODELS],),
|
548 |
+
},
|
549 |
+
"optional": {
|
550 |
+
"cond": ("CONDITIONING",),
|
551 |
+
"blended_cond": ("CONDITIONING",),
|
552 |
+
},
|
553 |
+
}
|
554 |
+
|
555 |
+
RETURN_TYPES = ("MODEL",)
|
556 |
+
FUNCTION = "apply_layered_diffusion"
|
557 |
+
CATEGORY = "layer_diffuse"
|
558 |
+
MODELS = (
|
559 |
+
LayeredDiffusionBase(
|
560 |
+
model_file_name="layer_sd15_fg2bg.safetensors",
|
561 |
+
model_url="https://huggingface.co/LayerDiffusion/layerdiffusion-v1/resolve/main/layer_sd15_fg2bg.safetensors",
|
562 |
+
sd_version=StableDiffusionVersion.SD1x,
|
563 |
+
attn_sharing=True,
|
564 |
+
frames=2,
|
565 |
+
cond_type=LayerType.FG,
|
566 |
+
),
|
567 |
+
LayeredDiffusionBase(
|
568 |
+
model_file_name="layer_sd15_bg2fg.safetensors",
|
569 |
+
model_url="https://huggingface.co/LayerDiffusion/layerdiffusion-v1/resolve/main/layer_sd15_bg2fg.safetensors",
|
570 |
+
sd_version=StableDiffusionVersion.SD1x,
|
571 |
+
attn_sharing=True,
|
572 |
+
frames=2,
|
573 |
+
cond_type=LayerType.BG,
|
574 |
+
),
|
575 |
+
)
|
576 |
+
|
577 |
+
def apply_layered_diffusion(
|
578 |
+
self,
|
579 |
+
model: ModelPatcher,
|
580 |
+
image,
|
581 |
+
config: str,
|
582 |
+
cond: Optional[List[List[torch.TensorType]]] = None,
|
583 |
+
blended_cond: Optional[List[List[torch.TensorType]]] = None,
|
584 |
+
):
|
585 |
+
ld_model = [m for m in self.MODELS if m.config_string == config][0]
|
586 |
+
assert get_model_sd_version(model) == ld_model.sd_version
|
587 |
+
assert ld_model.attn_sharing
|
588 |
+
work_model = ld_model.apply_layered_diffusion_attn_sharing(
|
589 |
+
model, control_img=image.movedim(-1, 1)
|
590 |
+
)[0]
|
591 |
+
work_model.model_options.setdefault("transformer_options", {})
|
592 |
+
work_model.model_options["transformer_options"]["cond_overwrite"] = [
|
593 |
+
cond[0][0] if cond is not None else None
|
594 |
+
for cond in (
|
595 |
+
cond,
|
596 |
+
blended_cond,
|
597 |
+
)
|
598 |
+
]
|
599 |
+
return (work_model,)
|
600 |
+
|
601 |
+
|
602 |
+
class LayeredDiffusionDiff:
|
603 |
+
"""Extract FG/BG from blended image.
|
604 |
+
- Blended + FG => BG
|
605 |
+
- Blended + BG => FG
|
606 |
+
"""
|
607 |
+
|
608 |
+
@classmethod
|
609 |
+
def INPUT_TYPES(s):
|
610 |
+
return {
|
611 |
+
"required": {
|
612 |
+
"model": ("MODEL",),
|
613 |
+
"cond": ("CONDITIONING",),
|
614 |
+
"uncond": ("CONDITIONING",),
|
615 |
+
"blended_latent": ("LATENT",),
|
616 |
+
"latent": ("LATENT",),
|
617 |
+
"config": ([c.config_string for c in s.MODELS],),
|
618 |
+
"weight": (
|
619 |
+
"FLOAT",
|
620 |
+
{"default": 1.0, "min": -1, "max": 3, "step": 0.05},
|
621 |
+
),
|
622 |
+
},
|
623 |
+
}
|
624 |
+
|
625 |
+
RETURN_TYPES = ("MODEL", "CONDITIONING", "CONDITIONING")
|
626 |
+
FUNCTION = "apply_layered_diffusion"
|
627 |
+
CATEGORY = "layer_diffuse"
|
628 |
+
MODELS = (
|
629 |
+
LayeredDiffusionBase(
|
630 |
+
model_file_name="layer_xl_fgble2bg.safetensors",
|
631 |
+
model_url="https://huggingface.co/LayerDiffusion/layerdiffusion-v1/resolve/main/layer_xl_fgble2bg.safetensors",
|
632 |
+
sd_version=StableDiffusionVersion.SDXL,
|
633 |
+
cond_type=LayerType.FG,
|
634 |
+
),
|
635 |
+
LayeredDiffusionBase(
|
636 |
+
model_file_name="layer_xl_bgble2fg.safetensors",
|
637 |
+
model_url="https://huggingface.co/LayerDiffusion/layerdiffusion-v1/resolve/main/layer_xl_bgble2fg.safetensors",
|
638 |
+
sd_version=StableDiffusionVersion.SDXL,
|
639 |
+
cond_type=LayerType.BG,
|
640 |
+
),
|
641 |
+
)
|
642 |
+
|
643 |
+
def apply_layered_diffusion(
|
644 |
+
self,
|
645 |
+
model: ModelPatcher,
|
646 |
+
cond,
|
647 |
+
uncond,
|
648 |
+
blended_latent,
|
649 |
+
latent,
|
650 |
+
config: str,
|
651 |
+
weight: float,
|
652 |
+
):
|
653 |
+
ld_model = [m for m in self.MODELS if m.config_string == config][0]
|
654 |
+
assert get_model_sd_version(model) == ld_model.sd_version
|
655 |
+
c_concat = model.model.latent_format.process_in(
|
656 |
+
torch.cat([latent["samples"], blended_latent["samples"]], dim=1)
|
657 |
+
)
|
658 |
+
return ld_model.apply_layered_diffusion(
|
659 |
+
model, weight
|
660 |
+
) + ld_model.apply_c_concat(cond, uncond, c_concat)
|
661 |
+
|
662 |
+
|
663 |
+
NODE_CLASS_MAPPINGS = {
|
664 |
+
"LayeredDiffusionApply": LayeredDiffusionFG,
|
665 |
+
"LayeredDiffusionJointApply": LayeredDiffusionJoint,
|
666 |
+
"LayeredDiffusionCondApply": LayeredDiffusionCond,
|
667 |
+
"LayeredDiffusionCondJointApply": LayeredDiffusionCondJoint,
|
668 |
+
"LayeredDiffusionDiffApply": LayeredDiffusionDiff,
|
669 |
+
"LayeredDiffusionDecode": LayeredDiffusionDecode,
|
670 |
+
"LayeredDiffusionDecodeRGBA": LayeredDiffusionDecodeRGBA,
|
671 |
+
"LayeredDiffusionDecodeSplit": LayeredDiffusionDecodeSplit,
|
672 |
+
}
|
673 |
+
|
674 |
+
NODE_DISPLAY_NAME_MAPPINGS = {
|
675 |
+
"LayeredDiffusionApply": "Layer Diffuse Apply",
|
676 |
+
"LayeredDiffusionJointApply": "Layer Diffuse Joint Apply",
|
677 |
+
"LayeredDiffusionCondApply": "Layer Diffuse Cond Apply",
|
678 |
+
"LayeredDiffusionCondJointApply": "Layer Diffuse Cond Joint Apply",
|
679 |
+
"LayeredDiffusionDiffApply": "Layer Diffuse Diff Apply",
|
680 |
+
"LayeredDiffusionDecode": "Layer Diffuse Decode",
|
681 |
+
"LayeredDiffusionDecodeRGBA": "Layer Diffuse Decode (RGBA)",
|
682 |
+
"LayeredDiffusionDecodeSplit": "Layer Diffuse Decode (Split)",
|
683 |
+
}
|
ComfyUI/custom_nodes/layerdiffuse/lib_layerdiffusion/__init__.py
ADDED
File without changes
|
ComfyUI/custom_nodes/layerdiffuse/lib_layerdiffusion/attention_sharing.py
ADDED
@@ -0,0 +1,360 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
1 |
+
# Currently only sd15
|
2 |
+
|
3 |
+
import functools
|
4 |
+
import torch
|
5 |
+
import einops
|
6 |
+
|
7 |
+
from comfy import model_management, utils
|
8 |
+
from comfy.ldm.modules.attention import optimized_attention
|
9 |
+
|
10 |
+
|
11 |
+
module_mapping_sd15 = {
|
12 |
+
0: "input_blocks.1.1.transformer_blocks.0.attn1",
|
13 |
+
1: "input_blocks.1.1.transformer_blocks.0.attn2",
|
14 |
+
2: "input_blocks.2.1.transformer_blocks.0.attn1",
|
15 |
+
3: "input_blocks.2.1.transformer_blocks.0.attn2",
|
16 |
+
4: "input_blocks.4.1.transformer_blocks.0.attn1",
|
17 |
+
5: "input_blocks.4.1.transformer_blocks.0.attn2",
|
18 |
+
6: "input_blocks.5.1.transformer_blocks.0.attn1",
|
19 |
+
7: "input_blocks.5.1.transformer_blocks.0.attn2",
|
20 |
+
8: "input_blocks.7.1.transformer_blocks.0.attn1",
|
21 |
+
9: "input_blocks.7.1.transformer_blocks.0.attn2",
|
22 |
+
10: "input_blocks.8.1.transformer_blocks.0.attn1",
|
23 |
+
11: "input_blocks.8.1.transformer_blocks.0.attn2",
|
24 |
+
12: "output_blocks.3.1.transformer_blocks.0.attn1",
|
25 |
+
13: "output_blocks.3.1.transformer_blocks.0.attn2",
|
26 |
+
14: "output_blocks.4.1.transformer_blocks.0.attn1",
|
27 |
+
15: "output_blocks.4.1.transformer_blocks.0.attn2",
|
28 |
+
16: "output_blocks.5.1.transformer_blocks.0.attn1",
|
29 |
+
17: "output_blocks.5.1.transformer_blocks.0.attn2",
|
30 |
+
18: "output_blocks.6.1.transformer_blocks.0.attn1",
|
31 |
+
19: "output_blocks.6.1.transformer_blocks.0.attn2",
|
32 |
+
20: "output_blocks.7.1.transformer_blocks.0.attn1",
|
33 |
+
21: "output_blocks.7.1.transformer_blocks.0.attn2",
|
34 |
+
22: "output_blocks.8.1.transformer_blocks.0.attn1",
|
35 |
+
23: "output_blocks.8.1.transformer_blocks.0.attn2",
|
36 |
+
24: "output_blocks.9.1.transformer_blocks.0.attn1",
|
37 |
+
25: "output_blocks.9.1.transformer_blocks.0.attn2",
|
38 |
+
26: "output_blocks.10.1.transformer_blocks.0.attn1",
|
39 |
+
27: "output_blocks.10.1.transformer_blocks.0.attn2",
|
40 |
+
28: "output_blocks.11.1.transformer_blocks.0.attn1",
|
41 |
+
29: "output_blocks.11.1.transformer_blocks.0.attn2",
|
42 |
+
30: "middle_block.1.transformer_blocks.0.attn1",
|
43 |
+
31: "middle_block.1.transformer_blocks.0.attn2",
|
44 |
+
}
|
45 |
+
|
46 |
+
|
47 |
+
def compute_cond_mark(cond_or_uncond, sigmas):
|
48 |
+
cond_or_uncond_size = int(sigmas.shape[0])
|
49 |
+
|
50 |
+
cond_mark = []
|
51 |
+
for cx in cond_or_uncond:
|
52 |
+
cond_mark += [cx] * cond_or_uncond_size
|
53 |
+
|
54 |
+
cond_mark = torch.Tensor(cond_mark).to(sigmas)
|
55 |
+
return cond_mark
|
56 |
+
|
57 |
+
|
58 |
+
class LoRALinearLayer(torch.nn.Module):
|
59 |
+
def __init__(self, in_features: int, out_features: int, rank: int = 256, org=None):
|
60 |
+
super().__init__()
|
61 |
+
self.down = torch.nn.Linear(in_features, rank, bias=False)
|
62 |
+
self.up = torch.nn.Linear(rank, out_features, bias=False)
|
63 |
+
self.org = [org]
|
64 |
+
|
65 |
+
def forward(self, h):
|
66 |
+
org_weight = self.org[0].weight.to(h)
|
67 |
+
org_bias = self.org[0].bias.to(h) if self.org[0].bias is not None else None
|
68 |
+
down_weight = self.down.weight
|
69 |
+
up_weight = self.up.weight
|
70 |
+
final_weight = org_weight + torch.mm(up_weight, down_weight)
|
71 |
+
return torch.nn.functional.linear(h, final_weight, org_bias)
|
72 |
+
|
73 |
+
|
74 |
+
class AttentionSharingUnit(torch.nn.Module):
|
75 |
+
# `transformer_options` passed to the most recent BasicTransformerBlock.forward
|
76 |
+
# call.
|
77 |
+
transformer_options: dict = {}
|
78 |
+
|
79 |
+
def __init__(self, module, frames=2, use_control=True, rank=256):
|
80 |
+
super().__init__()
|
81 |
+
|
82 |
+
self.heads = module.heads
|
83 |
+
self.frames = frames
|
84 |
+
self.original_module = [module]
|
85 |
+
q_in_channels, q_out_channels = (
|
86 |
+
module.to_q.in_features,
|
87 |
+
module.to_q.out_features,
|
88 |
+
)
|
89 |
+
k_in_channels, k_out_channels = (
|
90 |
+
module.to_k.in_features,
|
91 |
+
module.to_k.out_features,
|
92 |
+
)
|
93 |
+
v_in_channels, v_out_channels = (
|
94 |
+
module.to_v.in_features,
|
95 |
+
module.to_v.out_features,
|
96 |
+
)
|
97 |
+
o_in_channels, o_out_channels = (
|
98 |
+
module.to_out[0].in_features,
|
99 |
+
module.to_out[0].out_features,
|
100 |
+
)
|
101 |
+
|
102 |
+
hidden_size = k_out_channels
|
103 |
+
|
104 |
+
self.to_q_lora = [
|
105 |
+
LoRALinearLayer(q_in_channels, q_out_channels, rank, module.to_q)
|
106 |
+
for _ in range(self.frames)
|
107 |
+
]
|
108 |
+
self.to_k_lora = [
|
109 |
+
LoRALinearLayer(k_in_channels, k_out_channels, rank, module.to_k)
|
110 |
+
for _ in range(self.frames)
|
111 |
+
]
|
112 |
+
self.to_v_lora = [
|
113 |
+
LoRALinearLayer(v_in_channels, v_out_channels, rank, module.to_v)
|
114 |
+
for _ in range(self.frames)
|
115 |
+
]
|
116 |
+
self.to_out_lora = [
|
117 |
+
LoRALinearLayer(o_in_channels, o_out_channels, rank, module.to_out[0])
|
118 |
+
for _ in range(self.frames)
|
119 |
+
]
|
120 |
+
|
121 |
+
self.to_q_lora = torch.nn.ModuleList(self.to_q_lora)
|
122 |
+
self.to_k_lora = torch.nn.ModuleList(self.to_k_lora)
|
123 |
+
self.to_v_lora = torch.nn.ModuleList(self.to_v_lora)
|
124 |
+
self.to_out_lora = torch.nn.ModuleList(self.to_out_lora)
|
125 |
+
|
126 |
+
self.temporal_i = torch.nn.Linear(
|
127 |
+
in_features=hidden_size, out_features=hidden_size
|
128 |
+
)
|
129 |
+
self.temporal_n = torch.nn.LayerNorm(
|
130 |
+
hidden_size, elementwise_affine=True, eps=1e-6
|
131 |
+
)
|
132 |
+
self.temporal_q = torch.nn.Linear(
|
133 |
+
in_features=hidden_size, out_features=hidden_size
|
134 |
+
)
|
135 |
+
self.temporal_k = torch.nn.Linear(
|
136 |
+
in_features=hidden_size, out_features=hidden_size
|
137 |
+
)
|
138 |
+
self.temporal_v = torch.nn.Linear(
|
139 |
+
in_features=hidden_size, out_features=hidden_size
|
140 |
+
)
|
141 |
+
self.temporal_o = torch.nn.Linear(
|
142 |
+
in_features=hidden_size, out_features=hidden_size
|
143 |
+
)
|
144 |
+
|
145 |
+
self.control_convs = None
|
146 |
+
|
147 |
+
if use_control:
|
148 |
+
self.control_convs = [
|
149 |
+
torch.nn.Sequential(
|
150 |
+
torch.nn.Conv2d(256, 256, kernel_size=3, padding=1, stride=1),
|
151 |
+
torch.nn.SiLU(),
|
152 |
+
torch.nn.Conv2d(256, hidden_size, kernel_size=1),
|
153 |
+
)
|
154 |
+
for _ in range(self.frames)
|
155 |
+
]
|
156 |
+
self.control_convs = torch.nn.ModuleList(self.control_convs)
|
157 |
+
|
158 |
+
self.control_signals = None
|
159 |
+
|
160 |
+
def forward(self, h, context=None, value=None):
|
161 |
+
transformer_options = self.transformer_options
|
162 |
+
|
163 |
+
modified_hidden_states = einops.rearrange(
|
164 |
+
h, "(b f) d c -> f b d c", f=self.frames
|
165 |
+
)
|
166 |
+
|
167 |
+
if self.control_convs is not None:
|
168 |
+
context_dim = int(modified_hidden_states.shape[2])
|
169 |
+
control_outs = []
|
170 |
+
for f in range(self.frames):
|
171 |
+
control_signal = self.control_signals[context_dim].to(
|
172 |
+
modified_hidden_states
|
173 |
+
)
|
174 |
+
control = self.control_convs[f](control_signal)
|
175 |
+
control = einops.rearrange(control, "b c h w -> b (h w) c")
|
176 |
+
control_outs.append(control)
|
177 |
+
control_outs = torch.stack(control_outs, dim=0)
|
178 |
+
modified_hidden_states = modified_hidden_states + control_outs.to(
|
179 |
+
modified_hidden_states
|
180 |
+
)
|
181 |
+
|
182 |
+
if context is None:
|
183 |
+
framed_context = modified_hidden_states
|
184 |
+
else:
|
185 |
+
framed_context = einops.rearrange(
|
186 |
+
context, "(b f) d c -> f b d c", f=self.frames
|
187 |
+
)
|
188 |
+
|
189 |
+
framed_cond_mark = einops.rearrange(
|
190 |
+
compute_cond_mark(
|
191 |
+
transformer_options["cond_or_uncond"],
|
192 |
+
transformer_options["sigmas"],
|
193 |
+
),
|
194 |
+
"(b f) -> f b",
|
195 |
+
f=self.frames,
|
196 |
+
).to(modified_hidden_states)
|
197 |
+
|
198 |
+
attn_outs = []
|
199 |
+
for f in range(self.frames):
|
200 |
+
fcf = framed_context[f]
|
201 |
+
|
202 |
+
if context is not None:
|
203 |
+
cond_overwrite = transformer_options.get("cond_overwrite", [])
|
204 |
+
if len(cond_overwrite) > f:
|
205 |
+
cond_overwrite = cond_overwrite[f]
|
206 |
+
else:
|
207 |
+
cond_overwrite = None
|
208 |
+
if cond_overwrite is not None:
|
209 |
+
cond_mark = framed_cond_mark[f][:, None, None]
|
210 |
+
fcf = cond_overwrite.to(fcf) * (1.0 - cond_mark) + fcf * cond_mark
|
211 |
+
|
212 |
+
q = self.to_q_lora[f](modified_hidden_states[f])
|
213 |
+
k = self.to_k_lora[f](fcf)
|
214 |
+
v = self.to_v_lora[f](fcf)
|
215 |
+
o = optimized_attention(q, k, v, self.heads)
|
216 |
+
o = self.to_out_lora[f](o)
|
217 |
+
o = self.original_module[0].to_out[1](o)
|
218 |
+
attn_outs.append(o)
|
219 |
+
|
220 |
+
attn_outs = torch.stack(attn_outs, dim=0)
|
221 |
+
modified_hidden_states = modified_hidden_states + attn_outs.to(
|
222 |
+
modified_hidden_states
|
223 |
+
)
|
224 |
+
modified_hidden_states = einops.rearrange(
|
225 |
+
modified_hidden_states, "f b d c -> (b f) d c", f=self.frames
|
226 |
+
)
|
227 |
+
|
228 |
+
x = modified_hidden_states
|
229 |
+
x = self.temporal_n(x)
|
230 |
+
x = self.temporal_i(x)
|
231 |
+
d = x.shape[1]
|
232 |
+
|
233 |
+
x = einops.rearrange(x, "(b f) d c -> (b d) f c", f=self.frames)
|
234 |
+
|
235 |
+
q = self.temporal_q(x)
|
236 |
+
k = self.temporal_k(x)
|
237 |
+
v = self.temporal_v(x)
|
238 |
+
|
239 |
+
x = optimized_attention(q, k, v, self.heads)
|
240 |
+
x = self.temporal_o(x)
|
241 |
+
x = einops.rearrange(x, "(b d) f c -> (b f) d c", d=d)
|
242 |
+
|
243 |
+
modified_hidden_states = modified_hidden_states + x
|
244 |
+
|
245 |
+
return modified_hidden_states - h
|
246 |
+
|
247 |
+
@classmethod
|
248 |
+
def hijack_transformer_block(cls):
|
249 |
+
def register_get_transformer_options(func):
|
250 |
+
@functools.wraps(func)
|
251 |
+
def forward(self, x, context=None, transformer_options={}):
|
252 |
+
cls.transformer_options = transformer_options
|
253 |
+
return func(self, x, context, transformer_options)
|
254 |
+
|
255 |
+
return forward
|
256 |
+
|
257 |
+
from comfy.ldm.modules.attention import BasicTransformerBlock
|
258 |
+
|
259 |
+
BasicTransformerBlock.forward = register_get_transformer_options(
|
260 |
+
BasicTransformerBlock.forward
|
261 |
+
)
|
262 |
+
|
263 |
+
|
264 |
+
AttentionSharingUnit.hijack_transformer_block()
|
265 |
+
|
266 |
+
|
267 |
+
class AdditionalAttentionCondsEncoder(torch.nn.Module):
|
268 |
+
def __init__(self):
|
269 |
+
super().__init__()
|
270 |
+
|
271 |
+
self.blocks_0 = torch.nn.Sequential(
|
272 |
+
torch.nn.Conv2d(3, 32, kernel_size=3, padding=1, stride=1),
|
273 |
+
torch.nn.SiLU(),
|
274 |
+
torch.nn.Conv2d(32, 32, kernel_size=3, padding=1, stride=1),
|
275 |
+
torch.nn.SiLU(),
|
276 |
+
torch.nn.Conv2d(32, 64, kernel_size=3, padding=1, stride=2),
|
277 |
+
torch.nn.SiLU(),
|
278 |
+
torch.nn.Conv2d(64, 64, kernel_size=3, padding=1, stride=1),
|
279 |
+
torch.nn.SiLU(),
|
280 |
+
torch.nn.Conv2d(64, 128, kernel_size=3, padding=1, stride=2),
|
281 |
+
torch.nn.SiLU(),
|
282 |
+
torch.nn.Conv2d(128, 128, kernel_size=3, padding=1, stride=1),
|
283 |
+
torch.nn.SiLU(),
|
284 |
+
torch.nn.Conv2d(128, 256, kernel_size=3, padding=1, stride=2),
|
285 |
+
torch.nn.SiLU(),
|
286 |
+
torch.nn.Conv2d(256, 256, kernel_size=3, padding=1, stride=1),
|
287 |
+
torch.nn.SiLU(),
|
288 |
+
) # 64*64*256
|
289 |
+
|
290 |
+
self.blocks_1 = torch.nn.Sequential(
|
291 |
+
torch.nn.Conv2d(256, 256, kernel_size=3, padding=1, stride=2),
|
292 |
+
torch.nn.SiLU(),
|
293 |
+
torch.nn.Conv2d(256, 256, kernel_size=3, padding=1, stride=1),
|
294 |
+
torch.nn.SiLU(),
|
295 |
+
) # 32*32*256
|
296 |
+
|
297 |
+
self.blocks_2 = torch.nn.Sequential(
|
298 |
+
torch.nn.Conv2d(256, 256, kernel_size=3, padding=1, stride=2),
|
299 |
+
torch.nn.SiLU(),
|
300 |
+
torch.nn.Conv2d(256, 256, kernel_size=3, padding=1, stride=1),
|
301 |
+
torch.nn.SiLU(),
|
302 |
+
) # 16*16*256
|
303 |
+
|
304 |
+
self.blocks_3 = torch.nn.Sequential(
|
305 |
+
torch.nn.Conv2d(256, 256, kernel_size=3, padding=1, stride=2),
|
306 |
+
torch.nn.SiLU(),
|
307 |
+
torch.nn.Conv2d(256, 256, kernel_size=3, padding=1, stride=1),
|
308 |
+
torch.nn.SiLU(),
|
309 |
+
) # 8*8*256
|
310 |
+
|
311 |
+
self.blks = [self.blocks_0, self.blocks_1, self.blocks_2, self.blocks_3]
|
312 |
+
|
313 |
+
def __call__(self, h):
|
314 |
+
results = {}
|
315 |
+
for b in self.blks:
|
316 |
+
h = b(h)
|
317 |
+
results[int(h.shape[2]) * int(h.shape[3])] = h
|
318 |
+
return results
|
319 |
+
|
320 |
+
|
321 |
+
class HookerLayers(torch.nn.Module):
|
322 |
+
def __init__(self, layer_list):
|
323 |
+
super().__init__()
|
324 |
+
self.layers = torch.nn.ModuleList(layer_list)
|
325 |
+
|
326 |
+
|
327 |
+
class AttentionSharingPatcher(torch.nn.Module):
|
328 |
+
def __init__(self, unet, frames=2, use_control=True, rank=256):
|
329 |
+
super().__init__()
|
330 |
+
model_management.unload_model_clones(unet)
|
331 |
+
|
332 |
+
units = []
|
333 |
+
for i in range(32):
|
334 |
+
real_key = module_mapping_sd15[i]
|
335 |
+
attn_module = utils.get_attr(unet.model.diffusion_model, real_key)
|
336 |
+
u = AttentionSharingUnit(
|
337 |
+
attn_module, frames=frames, use_control=use_control, rank=rank
|
338 |
+
)
|
339 |
+
units.append(u)
|
340 |
+
unet.add_object_patch("diffusion_model." + real_key, u)
|
341 |
+
|
342 |
+
self.hookers = HookerLayers(units)
|
343 |
+
|
344 |
+
if use_control:
|
345 |
+
self.kwargs_encoder = AdditionalAttentionCondsEncoder()
|
346 |
+
else:
|
347 |
+
self.kwargs_encoder = None
|
348 |
+
|
349 |
+
self.dtype = torch.float32
|
350 |
+
if model_management.should_use_fp16(model_management.get_torch_device()):
|
351 |
+
self.dtype = torch.float16
|
352 |
+
self.hookers.half()
|
353 |
+
return
|
354 |
+
|
355 |
+
def set_control(self, img):
|
356 |
+
img = img.cpu().float() * 2.0 - 1.0
|
357 |
+
signals = self.kwargs_encoder(img)
|
358 |
+
for m in self.hookers.layers:
|
359 |
+
m.control_signals = signals
|
360 |
+
return
|
ComfyUI/custom_nodes/layerdiffuse/lib_layerdiffusion/enums.py
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from enum import Enum
|
2 |
+
|
3 |
+
|
4 |
+
class ResizeMode(Enum):
|
5 |
+
RESIZE = "Just Resize"
|
6 |
+
CROP_AND_RESIZE = "Crop and Resize"
|
7 |
+
RESIZE_AND_FILL = "Resize and Fill"
|
8 |
+
|
9 |
+
def int_value(self):
|
10 |
+
if self == ResizeMode.RESIZE:
|
11 |
+
return 0
|
12 |
+
elif self == ResizeMode.CROP_AND_RESIZE:
|
13 |
+
return 1
|
14 |
+
elif self == ResizeMode.RESIZE_AND_FILL:
|
15 |
+
return 2
|
16 |
+
return 0
|
17 |
+
|
18 |
+
|
19 |
+
class StableDiffusionVersion(Enum):
|
20 |
+
"""The version family of stable diffusion model."""
|
21 |
+
|
22 |
+
SD1x = "SD15"
|
23 |
+
SDXL = "SDXL"
|
ComfyUI/custom_nodes/layerdiffuse/lib_layerdiffusion/models.py
ADDED
@@ -0,0 +1,318 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import torch.nn as nn
|
2 |
+
import torch
|
3 |
+
import cv2
|
4 |
+
import numpy as np
|
5 |
+
|
6 |
+
from tqdm import tqdm
|
7 |
+
from typing import Optional, Tuple
|
8 |
+
from diffusers.configuration_utils import ConfigMixin, register_to_config
|
9 |
+
from diffusers.models.modeling_utils import ModelMixin
|
10 |
+
from diffusers.models.unet_2d_blocks import UNetMidBlock2D, get_down_block, get_up_block
|
11 |
+
|
12 |
+
|
13 |
+
def check_diffusers_version():
|
14 |
+
import diffusers
|
15 |
+
from packaging.version import parse
|
16 |
+
|
17 |
+
assert parse(diffusers.__version__) >= parse(
|
18 |
+
"0.25.0"
|
19 |
+
), "diffusers>=0.25.0 requirement not satisfied. Please install correct diffusers version."
|
20 |
+
|
21 |
+
|
22 |
+
check_diffusers_version()
|
23 |
+
|
24 |
+
|
25 |
+
def zero_module(module):
|
26 |
+
"""
|
27 |
+
Zero out the parameters of a module and return it.
|
28 |
+
"""
|
29 |
+
for p in module.parameters():
|
30 |
+
p.detach().zero_()
|
31 |
+
return module
|
32 |
+
|
33 |
+
|
34 |
+
class LatentTransparencyOffsetEncoder(torch.nn.Module):
|
35 |
+
def __init__(self, *args, **kwargs):
|
36 |
+
super().__init__(*args, **kwargs)
|
37 |
+
self.blocks = torch.nn.Sequential(
|
38 |
+
torch.nn.Conv2d(4, 32, kernel_size=3, padding=1, stride=1),
|
39 |
+
nn.SiLU(),
|
40 |
+
torch.nn.Conv2d(32, 32, kernel_size=3, padding=1, stride=1),
|
41 |
+
nn.SiLU(),
|
42 |
+
torch.nn.Conv2d(32, 64, kernel_size=3, padding=1, stride=2),
|
43 |
+
nn.SiLU(),
|
44 |
+
torch.nn.Conv2d(64, 64, kernel_size=3, padding=1, stride=1),
|
45 |
+
nn.SiLU(),
|
46 |
+
torch.nn.Conv2d(64, 128, kernel_size=3, padding=1, stride=2),
|
47 |
+
nn.SiLU(),
|
48 |
+
torch.nn.Conv2d(128, 128, kernel_size=3, padding=1, stride=1),
|
49 |
+
nn.SiLU(),
|
50 |
+
torch.nn.Conv2d(128, 256, kernel_size=3, padding=1, stride=2),
|
51 |
+
nn.SiLU(),
|
52 |
+
torch.nn.Conv2d(256, 256, kernel_size=3, padding=1, stride=1),
|
53 |
+
nn.SiLU(),
|
54 |
+
zero_module(torch.nn.Conv2d(256, 4, kernel_size=3, padding=1, stride=1)),
|
55 |
+
)
|
56 |
+
|
57 |
+
def __call__(self, x):
|
58 |
+
return self.blocks(x)
|
59 |
+
|
60 |
+
|
61 |
+
# 1024 * 1024 * 3 -> 16 * 16 * 512 -> 1024 * 1024 * 3
|
62 |
+
class UNet1024(ModelMixin, ConfigMixin):
|
63 |
+
@register_to_config
|
64 |
+
def __init__(
|
65 |
+
self,
|
66 |
+
in_channels: int = 3,
|
67 |
+
out_channels: int = 3,
|
68 |
+
down_block_types: Tuple[str] = (
|
69 |
+
"DownBlock2D",
|
70 |
+
"DownBlock2D",
|
71 |
+
"DownBlock2D",
|
72 |
+
"DownBlock2D",
|
73 |
+
"AttnDownBlock2D",
|
74 |
+
"AttnDownBlock2D",
|
75 |
+
"AttnDownBlock2D",
|
76 |
+
),
|
77 |
+
up_block_types: Tuple[str] = (
|
78 |
+
"AttnUpBlock2D",
|
79 |
+
"AttnUpBlock2D",
|
80 |
+
"AttnUpBlock2D",
|
81 |
+
"UpBlock2D",
|
82 |
+
"UpBlock2D",
|
83 |
+
"UpBlock2D",
|
84 |
+
"UpBlock2D",
|
85 |
+
),
|
86 |
+
block_out_channels: Tuple[int] = (32, 32, 64, 128, 256, 512, 512),
|
87 |
+
layers_per_block: int = 2,
|
88 |
+
mid_block_scale_factor: float = 1,
|
89 |
+
downsample_padding: int = 1,
|
90 |
+
downsample_type: str = "conv",
|
91 |
+
upsample_type: str = "conv",
|
92 |
+
dropout: float = 0.0,
|
93 |
+
act_fn: str = "silu",
|
94 |
+
attention_head_dim: Optional[int] = 8,
|
95 |
+
norm_num_groups: int = 4,
|
96 |
+
norm_eps: float = 1e-5,
|
97 |
+
):
|
98 |
+
super().__init__()
|
99 |
+
|
100 |
+
# input
|
101 |
+
self.conv_in = nn.Conv2d(
|
102 |
+
in_channels, block_out_channels[0], kernel_size=3, padding=(1, 1)
|
103 |
+
)
|
104 |
+
self.latent_conv_in = zero_module(
|
105 |
+
nn.Conv2d(4, block_out_channels[2], kernel_size=1)
|
106 |
+
)
|
107 |
+
|
108 |
+
self.down_blocks = nn.ModuleList([])
|
109 |
+
self.mid_block = None
|
110 |
+
self.up_blocks = nn.ModuleList([])
|
111 |
+
|
112 |
+
# down
|
113 |
+
output_channel = block_out_channels[0]
|
114 |
+
for i, down_block_type in enumerate(down_block_types):
|
115 |
+
input_channel = output_channel
|
116 |
+
output_channel = block_out_channels[i]
|
117 |
+
is_final_block = i == len(block_out_channels) - 1
|
118 |
+
|
119 |
+
down_block = get_down_block(
|
120 |
+
down_block_type,
|
121 |
+
num_layers=layers_per_block,
|
122 |
+
in_channels=input_channel,
|
123 |
+
out_channels=output_channel,
|
124 |
+
temb_channels=None,
|
125 |
+
add_downsample=not is_final_block,
|
126 |
+
resnet_eps=norm_eps,
|
127 |
+
resnet_act_fn=act_fn,
|
128 |
+
resnet_groups=norm_num_groups,
|
129 |
+
attention_head_dim=(
|
130 |
+
attention_head_dim
|
131 |
+
if attention_head_dim is not None
|
132 |
+
else output_channel
|
133 |
+
),
|
134 |
+
downsample_padding=downsample_padding,
|
135 |
+
resnet_time_scale_shift="default",
|
136 |
+
downsample_type=downsample_type,
|
137 |
+
dropout=dropout,
|
138 |
+
)
|
139 |
+
self.down_blocks.append(down_block)
|
140 |
+
|
141 |
+
# mid
|
142 |
+
self.mid_block = UNetMidBlock2D(
|
143 |
+
in_channels=block_out_channels[-1],
|
144 |
+
temb_channels=None,
|
145 |
+
dropout=dropout,
|
146 |
+
resnet_eps=norm_eps,
|
147 |
+
resnet_act_fn=act_fn,
|
148 |
+
output_scale_factor=mid_block_scale_factor,
|
149 |
+
resnet_time_scale_shift="default",
|
150 |
+
attention_head_dim=(
|
151 |
+
attention_head_dim
|
152 |
+
if attention_head_dim is not None
|
153 |
+
else block_out_channels[-1]
|
154 |
+
),
|
155 |
+
resnet_groups=norm_num_groups,
|
156 |
+
attn_groups=None,
|
157 |
+
add_attention=True,
|
158 |
+
)
|
159 |
+
|
160 |
+
# up
|
161 |
+
reversed_block_out_channels = list(reversed(block_out_channels))
|
162 |
+
output_channel = reversed_block_out_channels[0]
|
163 |
+
for i, up_block_type in enumerate(up_block_types):
|
164 |
+
prev_output_channel = output_channel
|
165 |
+
output_channel = reversed_block_out_channels[i]
|
166 |
+
input_channel = reversed_block_out_channels[
|
167 |
+
min(i + 1, len(block_out_channels) - 1)
|
168 |
+
]
|
169 |
+
|
170 |
+
is_final_block = i == len(block_out_channels) - 1
|
171 |
+
|
172 |
+
up_block = get_up_block(
|
173 |
+
up_block_type,
|
174 |
+
num_layers=layers_per_block + 1,
|
175 |
+
in_channels=input_channel,
|
176 |
+
out_channels=output_channel,
|
177 |
+
prev_output_channel=prev_output_channel,
|
178 |
+
temb_channels=None,
|
179 |
+
add_upsample=not is_final_block,
|
180 |
+
resnet_eps=norm_eps,
|
181 |
+
resnet_act_fn=act_fn,
|
182 |
+
resnet_groups=norm_num_groups,
|
183 |
+
attention_head_dim=(
|
184 |
+
attention_head_dim
|
185 |
+
if attention_head_dim is not None
|
186 |
+
else output_channel
|
187 |
+
),
|
188 |
+
resnet_time_scale_shift="default",
|
189 |
+
upsample_type=upsample_type,
|
190 |
+
dropout=dropout,
|
191 |
+
)
|
192 |
+
self.up_blocks.append(up_block)
|
193 |
+
prev_output_channel = output_channel
|
194 |
+
|
195 |
+
# out
|
196 |
+
self.conv_norm_out = nn.GroupNorm(
|
197 |
+
num_channels=block_out_channels[0], num_groups=norm_num_groups, eps=norm_eps
|
198 |
+
)
|
199 |
+
self.conv_act = nn.SiLU()
|
200 |
+
self.conv_out = nn.Conv2d(
|
201 |
+
block_out_channels[0], out_channels, kernel_size=3, padding=1
|
202 |
+
)
|
203 |
+
|
204 |
+
def forward(self, x, latent):
|
205 |
+
sample_latent = self.latent_conv_in(latent)
|
206 |
+
sample = self.conv_in(x)
|
207 |
+
emb = None
|
208 |
+
|
209 |
+
down_block_res_samples = (sample,)
|
210 |
+
for i, downsample_block in enumerate(self.down_blocks):
|
211 |
+
if i == 3:
|
212 |
+
sample = sample + sample_latent
|
213 |
+
|
214 |
+
sample, res_samples = downsample_block(hidden_states=sample, temb=emb)
|
215 |
+
down_block_res_samples += res_samples
|
216 |
+
|
217 |
+
sample = self.mid_block(sample, emb)
|
218 |
+
|
219 |
+
for upsample_block in self.up_blocks:
|
220 |
+
res_samples = down_block_res_samples[-len(upsample_block.resnets) :]
|
221 |
+
down_block_res_samples = down_block_res_samples[
|
222 |
+
: -len(upsample_block.resnets)
|
223 |
+
]
|
224 |
+
sample = upsample_block(sample, res_samples, emb)
|
225 |
+
|
226 |
+
sample = self.conv_norm_out(sample)
|
227 |
+
sample = self.conv_act(sample)
|
228 |
+
sample = self.conv_out(sample)
|
229 |
+
return sample
|
230 |
+
|
231 |
+
|
232 |
+
def checkerboard(shape):
|
233 |
+
return np.indices(shape).sum(axis=0) % 2
|
234 |
+
|
235 |
+
|
236 |
+
def fill_checkerboard_bg(y: torch.Tensor) -> torch.Tensor:
|
237 |
+
alpha = y[..., :1]
|
238 |
+
fg = y[..., 1:]
|
239 |
+
B, H, W, C = fg.shape
|
240 |
+
cb = checkerboard(shape=(H // 64, W // 64))
|
241 |
+
cb = cv2.resize(cb, (W, H), interpolation=cv2.INTER_NEAREST)
|
242 |
+
cb = (0.5 + (cb - 0.5) * 0.1)[None, ..., None]
|
243 |
+
cb = torch.from_numpy(cb).to(fg)
|
244 |
+
vis = fg * alpha + cb * (1 - alpha)
|
245 |
+
return vis
|
246 |
+
|
247 |
+
|
248 |
+
class TransparentVAEDecoder:
|
249 |
+
def __init__(self, sd, device, dtype):
|
250 |
+
self.load_device = device
|
251 |
+
self.dtype = dtype
|
252 |
+
|
253 |
+
model = UNet1024(in_channels=3, out_channels=4)
|
254 |
+
model.load_state_dict(sd, strict=True)
|
255 |
+
model.to(self.load_device, dtype=self.dtype)
|
256 |
+
model.eval()
|
257 |
+
self.model = model
|
258 |
+
|
259 |
+
@torch.no_grad()
|
260 |
+
def estimate_single_pass(self, pixel, latent):
|
261 |
+
y = self.model(pixel, latent)
|
262 |
+
return y
|
263 |
+
|
264 |
+
@torch.no_grad()
|
265 |
+
def estimate_augmented(self, pixel, latent):
|
266 |
+
args = [
|
267 |
+
[False, 0],
|
268 |
+
[False, 1],
|
269 |
+
[False, 2],
|
270 |
+
[False, 3],
|
271 |
+
[True, 0],
|
272 |
+
[True, 1],
|
273 |
+
[True, 2],
|
274 |
+
[True, 3],
|
275 |
+
]
|
276 |
+
|
277 |
+
result = []
|
278 |
+
|
279 |
+
for flip, rok in tqdm(args):
|
280 |
+
feed_pixel = pixel.clone()
|
281 |
+
feed_latent = latent.clone()
|
282 |
+
|
283 |
+
if flip:
|
284 |
+
feed_pixel = torch.flip(feed_pixel, dims=(3,))
|
285 |
+
feed_latent = torch.flip(feed_latent, dims=(3,))
|
286 |
+
|
287 |
+
feed_pixel = torch.rot90(feed_pixel, k=rok, dims=(2, 3))
|
288 |
+
feed_latent = torch.rot90(feed_latent, k=rok, dims=(2, 3))
|
289 |
+
|
290 |
+
eps = self.estimate_single_pass(feed_pixel, feed_latent).clip(0, 1)
|
291 |
+
eps = torch.rot90(eps, k=-rok, dims=(2, 3))
|
292 |
+
|
293 |
+
if flip:
|
294 |
+
eps = torch.flip(eps, dims=(3,))
|
295 |
+
|
296 |
+
result += [eps]
|
297 |
+
|
298 |
+
result = torch.stack(result, dim=0)
|
299 |
+
median = torch.median(result, dim=0).values
|
300 |
+
return median
|
301 |
+
|
302 |
+
@torch.no_grad()
|
303 |
+
def decode_pixel(
|
304 |
+
self, pixel: torch.TensorType, latent: torch.TensorType
|
305 |
+
) -> torch.TensorType:
|
306 |
+
# pixel.shape = [B, C=3, H, W]
|
307 |
+
assert pixel.shape[1] == 3
|
308 |
+
pixel_device = pixel.device
|
309 |
+
pixel_dtype = pixel.dtype
|
310 |
+
|
311 |
+
pixel = pixel.to(device=self.load_device, dtype=self.dtype)
|
312 |
+
latent = latent.to(device=self.load_device, dtype=self.dtype)
|
313 |
+
# y.shape = [B, C=4, H, W]
|
314 |
+
y = self.estimate_augmented(pixel, latent)
|
315 |
+
y = y.clip(0, 1)
|
316 |
+
assert y.shape[1] == 4
|
317 |
+
# Restore image to original device of input image.
|
318 |
+
return y.to(pixel_device, dtype=pixel_dtype)
|
ComfyUI/custom_nodes/layerdiffuse/lib_layerdiffusion/utils.py
ADDED
@@ -0,0 +1,135 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import numpy as np
|
2 |
+
from .enums import ResizeMode
|
3 |
+
import cv2
|
4 |
+
import torch
|
5 |
+
import os
|
6 |
+
from urllib.parse import urlparse
|
7 |
+
from typing import Optional
|
8 |
+
|
9 |
+
|
10 |
+
def rgba2rgbfp32(x):
|
11 |
+
rgb = x[..., :3].astype(np.float32) / 255.0
|
12 |
+
a = x[..., 3:4].astype(np.float32) / 255.0
|
13 |
+
return 0.5 + (rgb - 0.5) * a
|
14 |
+
|
15 |
+
|
16 |
+
def to255unit8(x):
|
17 |
+
return (x * 255.0).clip(0, 255).astype(np.uint8)
|
18 |
+
|
19 |
+
|
20 |
+
def safe_numpy(x):
|
21 |
+
# A very safe method to make sure that Apple/Mac works
|
22 |
+
y = x
|
23 |
+
|
24 |
+
# below is very boring but do not change these. If you change these Apple or Mac may fail.
|
25 |
+
y = y.copy()
|
26 |
+
y = np.ascontiguousarray(y)
|
27 |
+
y = y.copy()
|
28 |
+
return y
|
29 |
+
|
30 |
+
|
31 |
+
def high_quality_resize(x, size):
|
32 |
+
if x.shape[0] != size[1] or x.shape[1] != size[0]:
|
33 |
+
if (size[0] * size[1]) < (x.shape[0] * x.shape[1]):
|
34 |
+
interpolation = cv2.INTER_AREA
|
35 |
+
else:
|
36 |
+
interpolation = cv2.INTER_LANCZOS4
|
37 |
+
|
38 |
+
y = cv2.resize(x, size, interpolation=interpolation)
|
39 |
+
else:
|
40 |
+
y = x
|
41 |
+
return y
|
42 |
+
|
43 |
+
|
44 |
+
def crop_and_resize_image(detected_map, resize_mode, h, w):
|
45 |
+
if resize_mode == ResizeMode.RESIZE:
|
46 |
+
detected_map = high_quality_resize(detected_map, (w, h))
|
47 |
+
detected_map = safe_numpy(detected_map)
|
48 |
+
return detected_map
|
49 |
+
|
50 |
+
old_h, old_w, _ = detected_map.shape
|
51 |
+
old_w = float(old_w)
|
52 |
+
old_h = float(old_h)
|
53 |
+
k0 = float(h) / old_h
|
54 |
+
k1 = float(w) / old_w
|
55 |
+
|
56 |
+
def safeint(x):
|
57 |
+
return int(np.round(x))
|
58 |
+
|
59 |
+
if resize_mode == ResizeMode.RESIZE_AND_FILL:
|
60 |
+
k = min(k0, k1)
|
61 |
+
borders = np.concatenate([detected_map[0, :, :], detected_map[-1, :, :], detected_map[:, 0, :], detected_map[:, -1, :]], axis=0)
|
62 |
+
high_quality_border_color = np.median(borders, axis=0).astype(detected_map.dtype)
|
63 |
+
high_quality_background = np.tile(high_quality_border_color[None, None], [h, w, 1])
|
64 |
+
detected_map = high_quality_resize(detected_map, (safeint(old_w * k), safeint(old_h * k)))
|
65 |
+
new_h, new_w, _ = detected_map.shape
|
66 |
+
pad_h = max(0, (h - new_h) // 2)
|
67 |
+
pad_w = max(0, (w - new_w) // 2)
|
68 |
+
high_quality_background[pad_h:pad_h + new_h, pad_w:pad_w + new_w] = detected_map
|
69 |
+
detected_map = high_quality_background
|
70 |
+
detected_map = safe_numpy(detected_map)
|
71 |
+
return detected_map
|
72 |
+
else:
|
73 |
+
k = max(k0, k1)
|
74 |
+
detected_map = high_quality_resize(detected_map, (safeint(old_w * k), safeint(old_h * k)))
|
75 |
+
new_h, new_w, _ = detected_map.shape
|
76 |
+
pad_h = max(0, (new_h - h) // 2)
|
77 |
+
pad_w = max(0, (new_w - w) // 2)
|
78 |
+
detected_map = detected_map[pad_h:pad_h+h, pad_w:pad_w+w]
|
79 |
+
detected_map = safe_numpy(detected_map)
|
80 |
+
return detected_map
|
81 |
+
|
82 |
+
|
83 |
+
def pytorch_to_numpy(x):
|
84 |
+
return [np.clip(255. * y.cpu().numpy(), 0, 255).astype(np.uint8) for y in x]
|
85 |
+
|
86 |
+
|
87 |
+
def numpy_to_pytorch(x):
|
88 |
+
y = x.astype(np.float32) / 255.0
|
89 |
+
y = y[None]
|
90 |
+
y = np.ascontiguousarray(y.copy())
|
91 |
+
y = torch.from_numpy(y).float()
|
92 |
+
return y
|
93 |
+
|
94 |
+
|
95 |
+
def load_file_from_url(
|
96 |
+
url: str,
|
97 |
+
*,
|
98 |
+
model_dir: str,
|
99 |
+
progress: bool = True,
|
100 |
+
file_name: Optional[str] = None,
|
101 |
+
) -> str:
|
102 |
+
"""Download a file from `url` into `model_dir`, using the file present if possible.
|
103 |
+
|
104 |
+
Returns the path to the downloaded file.
|
105 |
+
"""
|
106 |
+
os.makedirs(model_dir, exist_ok=True)
|
107 |
+
if not file_name:
|
108 |
+
parts = urlparse(url)
|
109 |
+
file_name = os.path.basename(parts.path)
|
110 |
+
cached_file = os.path.abspath(os.path.join(model_dir, file_name))
|
111 |
+
if not os.path.exists(cached_file):
|
112 |
+
print(f'Downloading: "{url}" to {cached_file}\n')
|
113 |
+
from torch.hub import download_url_to_file
|
114 |
+
download_url_to_file(url, cached_file, progress=progress)
|
115 |
+
return cached_file
|
116 |
+
|
117 |
+
|
118 |
+
def to_lora_patch_dict(state_dict: dict) -> dict:
|
119 |
+
""" Convert raw lora state_dict to patch_dict that can be applied on
|
120 |
+
modelpatcher."""
|
121 |
+
patch_dict = {}
|
122 |
+
for k, w in state_dict.items():
|
123 |
+
model_key, patch_type, weight_index = k.split('::')
|
124 |
+
if model_key not in patch_dict:
|
125 |
+
patch_dict[model_key] = {}
|
126 |
+
if patch_type not in patch_dict[model_key]:
|
127 |
+
patch_dict[model_key][patch_type] = [None] * 16
|
128 |
+
patch_dict[model_key][patch_type][int(weight_index)] = w
|
129 |
+
|
130 |
+
patch_flat = {}
|
131 |
+
for model_key, v in patch_dict.items():
|
132 |
+
for patch_type, weight_list in v.items():
|
133 |
+
patch_flat[model_key] = (patch_type, weight_list)
|
134 |
+
|
135 |
+
return patch_flat
|
ComfyUI/custom_nodes/layerdiffuse/requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
diffusers>=0.25.0
|
2 |
+
opencv-python
|