Skip to content

Commit

Permalink
Fix FreeU not working when shape is tensor.
Browse files Browse the repository at this point in the history
  • Loading branch information
comfyanonymous committed May 23, 2024
1 parent 6507a9c commit b02bcce
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions comfy_extras/nodes_freelunch.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def patch(self, model, b1, b2, s1, s2):
on_cpu_devices = {}

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

def output_block_patch(h, hsp, transformer_options):
scale = scale_dict.get(h.shape[1], None)
scale = scale_dict.get(int(h.shape[1]), None)
if scale is not None:
hidden_mean = h.mean(1).unsqueeze(1)
B = hidden_mean.shape[0]
Expand Down

0 comments on commit b02bcce

Please sign in to comment.