Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
ComfyUI
Commits
94cc718e
Commit
94cc718e
authored
Nov 14, 2023
by
comfyanonymous
Browse files
Add a way to add patches to the input block.
parent
8509bd58
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
0 deletions
+8
-0
comfy/ldm/modules/diffusionmodules/openaimodel.py
comfy/ldm/modules/diffusionmodules/openaimodel.py
+5
-0
comfy/model_patcher.py
comfy/model_patcher.py
+3
-0
No files found.
comfy/ldm/modules/diffusionmodules/openaimodel.py
View file @
94cc718e
...
...
@@ -624,6 +624,11 @@ class UNetModel(nn.Module):
transformer_options
[
"block"
]
=
(
"input"
,
id
)
h
=
forward_timestep_embed
(
module
,
h
,
emb
,
context
,
transformer_options
)
h
=
apply_control
(
h
,
control
,
'input'
)
if
"input_block_patch"
in
transformer_patches
:
patch
=
transformer_patches
[
"input_block_patch"
]
for
p
in
patch
:
h
=
p
(
h
,
transformer_options
)
hs
.
append
(
h
)
transformer_options
[
"block"
]
=
(
"middle"
,
0
)
...
...
comfy/model_patcher.py
View file @
94cc718e
...
...
@@ -96,6 +96,9 @@ class ModelPatcher:
def
set_model_attn2_output_patch
(
self
,
patch
):
self
.
set_model_patch
(
patch
,
"attn2_output_patch"
)
def
set_model_input_block_patch
(
self
,
patch
):
self
.
set_model_patch
(
patch
,
"input_block_patch"
)
def
set_model_output_block_patch
(
self
,
patch
):
self
.
set_model_patch
(
patch
,
"output_block_patch"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment