From 81111940b913ccc9795100ef1f8e9ffd249b0d02 Mon Sep 17 00:00:00 2001 From: Mel Massadian Date: Thu, 7 Aug 2025 17:40:06 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20allow=20multiple=20vace?= =?UTF-8?q?=20embeds=20with=20context?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nodes.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/nodes.py b/nodes.py index 233338f2..974854e8 100644 --- a/nodes.py +++ b/nodes.py @@ -2744,9 +2744,15 @@ def predict_with_cfg(z, cfg_scale, positive_embeds, negative_embeds, timestep, i if vace_data is not None: window_vace_data = [] for vace_entry in vace_data: - partial_context = vace_entry["context"][0][:, c] + vace_tensor = vace_entry["context"][0] + vace_len = vace_tensor.shape[1] + + safe_c = [min(idx, vace_len - 1) for idx in c] + + partial_context = vace_tensor[:, safe_c] + if has_ref: - partial_context[:, 0] = vace_entry["context"][0][:, 0] + partial_context[:, 0] = vace_tensor[:, 0] window_vace_data.append({ "context": [partial_context], @@ -2754,7 +2760,7 @@ def predict_with_cfg(z, cfg_scale, positive_embeds, negative_embeds, timestep, i "start": vace_entry["start"], "end": vace_entry["end"], "seq_len": vace_entry["seq_len"] - }) + }) partial_vace_context = window_vace_data