From 8c0cd148be47ffa2d47b0cf2c2151cc420be221a Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Sun, 19 Jul 2026 12:07:34 +0200 Subject: [PATCH] fix seedvr-7b Signed-off-by: Vladimir Mandic --- extensions-builtin/sdnext-modernui | 2 +- modules/postprocess/seedvr_model.py | 2 +- modules/seedvr/src/models/dit/patch.py | 15 +++++++++------ 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/extensions-builtin/sdnext-modernui b/extensions-builtin/sdnext-modernui index 235e3f71a..937554e88 160000 --- a/extensions-builtin/sdnext-modernui +++ b/extensions-builtin/sdnext-modernui @@ -1 +1 @@ -Subproject commit 235e3f71ab2835d9340767552d16774967b2e643 +Subproject commit 937554e88f653a5ca3f32890fa1956d49da3e947 diff --git a/modules/postprocess/seedvr_model.py b/modules/postprocess/seedvr_model.py index e419745cc..02aab0429 100644 --- a/modules/postprocess/seedvr_model.py +++ b/modules/postprocess/seedvr_model.py @@ -139,7 +139,7 @@ class UpscalerSeedVR(Upscaler): devices.torch_gc() return result - def do_upscale(self, img: Image.Image, selected_file, cfg_scale: float = 3.5, cfg_rescale: float = 0.0, steps: int = 1, seed: int = -1, scale: float | None = None, tile_size: int = 1024, tile_overlap: float = 0.25): + def do_upscale(self, img: Image.Image, selected_file, cfg_scale: float = 1.5, cfg_rescale: float = 0.0, steps: int = 1, seed: int = -1, scale: float | None = None, tile_size: int = 1024, tile_overlap: float = 0.25): self.load_model(selected_file) if self.model is None: return img diff --git a/modules/seedvr/src/models/dit/patch.py b/modules/seedvr/src/models/dit/patch.py index c273d0d5b..3dff6fd10 100644 --- a/modules/seedvr/src/models/dit/patch.py +++ b/modules/seedvr/src/models/dit/patch.py @@ -80,14 +80,15 @@ class NaPatchIn(PatchIn): ) -> torch.Tensor: 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 t > 1 and vid_shape[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[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: 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 vid = slice_inputs(vid, dim=0) @@ -120,12 +121,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)): + 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[i, 0] % t != 0: + vid[i] = vid[i][(t - vid_shape[i, 0] % t) :] 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, vid_shape = na.flatten(vid) return vid, vid_shape