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
05e661e5
Commit
05e661e5
authored
Sep 23, 2023
by
comfyanonymous
Browse files
FreeU now works with the refiner.
parent
ae875436
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
comfy_extras/nodes_freelunch.py
comfy_extras/nodes_freelunch.py
+6
-6
No files found.
comfy_extras/nodes_freelunch.py
View file @
05e661e5
...
...
@@ -37,13 +37,13 @@ class FreeU:
CATEGORY
=
"_for_testing"
def
patch
(
self
,
model
,
b1
,
b2
,
s1
,
s2
):
model_channels
=
model
.
model
.
model_config
.
unet_config
[
"model_channels"
]
scale_dict
=
{
model_channels
*
4
:
(
b1
,
s1
),
model_channels
*
2
:
(
b2
,
s2
)}
def
output_block_patch
(
h
,
hsp
,
transformer_options
):
if
h
.
shape
[
1
]
==
1280
:
h
[:,:
640
]
=
h
[:,:
640
]
*
b1
hsp
=
Fourier_filter
(
hsp
,
threshold
=
1
,
scale
=
s1
)
if
h
.
shape
[
1
]
==
640
:
h
[:,:
320
]
=
h
[:,:
320
]
*
b2
hsp
=
Fourier_filter
(
hsp
,
threshold
=
1
,
scale
=
s2
)
scale
=
scale_dict
.
get
(
h
.
shape
[
1
],
None
)
if
scale
is
not
None
:
h
[:,:
h
.
shape
[
1
]
//
2
]
=
h
[:,:
h
.
shape
[
1
]
//
2
]
*
scale
[
0
]
hsp
=
Fourier_filter
(
hsp
,
threshold
=
1
,
scale
=
scale
[
1
])
return
h
,
hsp
m
=
model
.
clone
()
...
...
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