Skip to content

Commit b02bcce

Browse files
Fix FreeU not working when shape is tensor.
1 parent 6507a9c commit b02bcce

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

comfy_extras/nodes_freelunch.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def patch(self, model, b1, b2, s1, s2):
4242
on_cpu_devices = {}
4343

4444
def output_block_patch(h, hsp, transformer_options):
45-
scale = scale_dict.get(h.shape[1], None)
45+
scale = scale_dict.get(int(h.shape[1]), None)
4646
if scale is not None:
4747
h[:,:h.shape[1] // 2] = h[:,:h.shape[1] // 2] * scale[0]
4848
if hsp.device not in on_cpu_devices:
@@ -81,7 +81,7 @@ def patch(self, model, b1, b2, s1, s2):
8181
on_cpu_devices = {}
8282

8383
def output_block_patch(h, hsp, transformer_options):
84-
scale = scale_dict.get(h.shape[1], None)
84+
scale = scale_dict.get(int(h.shape[1]), None)
8585
if scale is not None:
8686
hidden_mean = h.mean(1).unsqueeze(1)
8787
B = hidden_mean.shape[0]

0 commit comments

Comments
 (0)