From bed5a51f8b83403629f40f0f82ea72e6df0a7d81 Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Sun, 19 Jul 2026 10:52:55 +0200 Subject: [PATCH] fix skip processing Signed-off-by: Vladimir Mandic --- extensions-builtin/sdnext-modernui | 2 +- modules/processing_prompt.py | 2 +- modules/seedvr/src/models/dit/patch.py | 34 ++++++++++++++++---------- 3 files changed, 23 insertions(+), 15 deletions(-) diff --git a/extensions-builtin/sdnext-modernui b/extensions-builtin/sdnext-modernui index b98735978..235e3f71a 160000 --- a/extensions-builtin/sdnext-modernui +++ b/extensions-builtin/sdnext-modernui @@ -1 +1 @@ -Subproject commit b987359783ddd8e217f1727f7505486db6d76a73 +Subproject commit 235e3f71ab2835d9340767552d16774967b2e643 diff --git a/modules/processing_prompt.py b/modules/processing_prompt.py index 20ff18553..699e4fc94 100644 --- a/modules/processing_prompt.py +++ b/modules/processing_prompt.py @@ -23,7 +23,7 @@ def fix_prompt_batch(p, prompts, negative_prompts, prompts_2, negative_prompts_2 if type(negative_prompts) is str: negative_prompts = [negative_prompts] - if hasattr(p, 'init_images') and p.init_images is not None and len(p.init_images) > 1: + if hasattr(p, 'init_images') and (p.init_images is not None) and (len(p.init_images) > 1) and not getattr(p, 'skip_processing', False): while len(prompts) < len(p.init_images): prompts.append(prompts[-1] if prompts else '') while len(negative_prompts) < len(p.init_images): diff --git a/modules/seedvr/src/models/dit/patch.py b/modules/seedvr/src/models/dit/patch.py index c273d0d5b..ccd4265ce 100644 --- a/modules/seedvr/src/models/dit/patch.py +++ b/modules/seedvr/src/models/dit/patch.py @@ -77,19 +77,23 @@ class NaPatchIn(PatchIn): self, vid: torch.Tensor, # l c vid_shape: torch.LongTensor, + cache: Cache = Cache(disable=True), ) -> torch.Tensor: + cache = cache.namespace("patch") + vid_shape_before_patchify = cache("vid_shape_before_patchify", lambda: vid_shape) t, h, w = self.patch_size if not t == h == w == 1: - vid, vid_shape = na.rearrange( - vid, vid_shape, "(T t) (H h) (W w) c -> T H W (t h w c)", t=t, h=h, w=w - ) + vid = na.unflatten(vid, vid_shape) for i in range(len(vid)): - if h > 1 and vid_shape[i, 1] % h != 0: + if t > 1 and vid_shape_before_patchify[i, 0] % t != 0: + vid[i] = torch.cat([vid[i][:1]] * (t - vid[i].size(0) % t) + [vid[i]], dim=0) + if h > 1 and vid_shape_before_patchify[i, 1] % h != 0: vid[i] = torch.cat([vid[i][:, :1]] * (h - vid[i].size(1) % h) + [vid[i]], dim=1) - if w > 1 and vid_shape[i, 2] % w != 0: + if w > 1 and vid_shape_before_patchify[i, 2] % w != 0: vid[i] = torch.cat([vid[i][:, :, :1]] * (w - vid[i].size(2) % w) + [vid[i]], dim=2) + vid[i] = rearrange(vid[i], "(T t) (H h) (W w) c -> T H W (t h w c)", t=t, h=h, w=w) vid, vid_shape = na.flatten(vid) - # slice vid after patching in when using sequence parallelism + # slice vid after patchting in when using sequence parallelism vid = slice_inputs(vid, dim=0) if vid.dtype != self.proj.weight.dtype: vid = vid.to(self.proj.weight.dtype) @@ -107,6 +111,8 @@ class NaPatchOut(PatchOut): torch.FloatTensor, torch.LongTensor, ]: + cache = cache.namespace("patch") + vid_shape_before_patchify = cache.get("vid_shape_before_patchify") t, h, w = self.patch_size if vid.dtype != self.proj.weight.dtype: vid = vid.to(self.proj.weight.dtype) @@ -120,12 +126,14 @@ class NaPatchOut(PatchOut): cache=cache.namespace("vid"), ) if not t == h == w == 1: - vid, vid_shape = na.rearrange( - vid, vid_shape, "T H W (t h w c) -> (T t) (H h) (W w) c", t=t, h=h, w=w - ) + vid = na.unflatten(vid, vid_shape) for i in range(len(vid)): - if h > 1 and vid_shape[i, 1] % h != 0: - vid[i] = vid[i][:, (h - vid_shape[i, 1] % h) :] - if w > 1 and vid_shape[i, 2] % w != 0: - vid[i] = vid[i][:, :, (w - vid_shape[i, 2] % w) :] + vid[i] = rearrange(vid[i], "T H W (t h w c) -> (T t) (H h) (W w) c", t=t, h=h, w=w) + if t > 1 and vid_shape_before_patchify is not None and vid_shape_before_patchify[i, 0] % t != 0: + vid[i] = vid[i][(t - vid_shape_before_patchify[i, 0] % t) :] + if h > 1 and vid_shape_before_patchify is not None and vid_shape_before_patchify[i, 1] % h != 0: + vid[i] = vid[i][:, (h - vid_shape_before_patchify[i, 1] % h) :] + if w > 1 and vid_shape_before_patchify is not None and vid_shape_before_patchify[i, 2] % w != 0: + vid[i] = vid[i][:, :, (w - vid_shape_before_patchify[i, 2] % w) :] + vid, vid_shape = na.flatten(vid) return vid, vid_shape