Skip to content

Commit 178bdc5

Browse files
authored
Add handling for vace_context in context windows (#11386)
Co-authored-by: ozbayb <[email protected]>
1 parent 25a1bfa commit 178bdc5

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

comfy/context_windows.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,12 @@ def get_resized_cond(self, cond_in: list[dict], x_in: torch.Tensor, window: Inde
188188
audio_cond = cond_value.cond
189189
if audio_cond.ndim > 1 and audio_cond.size(1) == x_in.size(self.dim):
190190
new_cond_item[cond_key] = cond_value._copy_with(window.get_tensor(audio_cond, device, dim=1))
191+
# Handle vace_context (temporal dim is 3)
192+
elif cond_key == "vace_context" and hasattr(cond_value, "cond") and isinstance(cond_value.cond, torch.Tensor):
193+
vace_cond = cond_value.cond
194+
if vace_cond.ndim >= 4 and vace_cond.size(3) == x_in.size(self.dim):
195+
sliced_vace = window.get_tensor(vace_cond, device, dim=3, retain_index_list=self.cond_retain_index_list)
196+
new_cond_item[cond_key] = cond_value._copy_with(sliced_vace)
191197
# if has cond that is a Tensor, check if needs to be subset
192198
elif hasattr(cond_value, "cond") and isinstance(cond_value.cond, torch.Tensor):
193199
if (self.dim < cond_value.cond.ndim and cond_value.cond.size(self.dim) == x_in.size(self.dim)) or \

0 commit comments

Comments
 (0)