mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-02-13 15:02:37 +08:00
Make conditioning broadcasting more robust, allows t.shape[0] to be any non-zero value
This commit is contained in:
parent
18617967e5
commit
c3f0e312c1
@ -38,8 +38,10 @@ def broadcast_cond(cond, batch, device):
|
|||||||
copy = []
|
copy = []
|
||||||
for p in cond:
|
for p in cond:
|
||||||
t = p[0]
|
t = p[0]
|
||||||
if t.shape[0] < batch:
|
if t.shape[0] != batch:
|
||||||
t = torch.cat([t] * batch)
|
t_list = [t for _ in range(batch // t.shape[0])]
|
||||||
|
t_list.append(t[:batch % t.shape[0]])
|
||||||
|
t = torch.cat(t_list)
|
||||||
t = t.to(device)
|
t = t.to(device)
|
||||||
copy += [[t] + p[1:]]
|
copy += [[t] + p[1:]]
|
||||||
return copy
|
return copy
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user