Compare commits

...

2 Commits

Author SHA1 Message Date
asagi4
6b2fc129bb
Merge 945a8aa963 into e346d8584e 2025-04-10 13:40:42 +09:00
asagi4
945a8aa963 Resize control if there is a tensor size mismatch
Fixes PatchModelAddDownscale when used with controlnets, and possibly some other
nodes doing similar things as well.

Fixes #3022
2024-07-01 13:11:28 +03:00

View File

@ -367,6 +367,8 @@ def apply_control(h, control, name):
ctrl = control[name].pop()
if ctrl is not None:
try:
if ctrl.shape[2] != h.shape[2] or ctrl.shape[3] != h.shape[3]:
ctrl = F.interpolate(ctrl.float(), size=(h.shape[2], h.shape[3]), mode="bicubic", align_corners=False).to(h.dtype)
h += ctrl
except:
logging.warning("warning control could not be applied {} {}".format(h.shape, ctrl.shape))