Fix Flux Kontext ReferenceLatent and ControlNet shape mismatch

This commit is contained in:
Ivan R. 2025-08-05 04:48:13 +05:00
parent 03895dea7c
commit 9ce912099e

View File

@ -157,6 +157,11 @@ class Flux(nn.Module):
if i < len(control_i):
add = control_i[i]
if add is not None:
if img.shape[1] != add.shape[1]:
padding_size = img.shape[1] - add.shape[1]
if padding_size > 0:
padding = torch.zeros(add.shape[0], padding_size, add.shape[2], device=add.device, dtype=add.dtype)
add = torch.cat([add, padding], dim=1)
img += add
if img.dtype == torch.float16: