mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-03-13 21:27:41 +08:00
Fix for long prompts
This commit is contained in:
parent
6769b918fb
commit
d879a33956
@ -511,6 +511,14 @@ class AITemplateModelWrapper:
|
||||
uncond = kwargs.pop("uncond")
|
||||
uncond = uncond[0][0]
|
||||
if uncond is not None and cond is not None:
|
||||
if cond.shape[1] > uncond.shape[1]:
|
||||
to_add = cond.shape[1] - uncond.shape[1]
|
||||
padding = torch.zeros((uncond.shape[0], to_add, uncond.shape[2]), device=uncond.device)
|
||||
uncond = torch.cat((uncond, padding), 1)
|
||||
elif uncond.shape[1] > cond.shape[1]:
|
||||
to_add = uncond.shape[1] - cond.shape[1]
|
||||
padding = torch.zeros((cond.shape[0], to_add, cond.shape[2]), device=cond.device)
|
||||
cond = torch.cat((cond, padding), 1)
|
||||
encoder_hidden_states = torch.cat((uncond, cond))
|
||||
elif cond is not None and uncond is None:
|
||||
encoder_hidden_states = torch.cat((cond, cond))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user