fix seedvr-7b

Signed-off-by: Vladimir Mandic <mandic00@live.com>
This commit is contained in:
Vladimir Mandic
2026-07-19 12:07:34 +02:00
parent c39a0ab488
commit 8c0cd148be
3 changed files with 11 additions and 8 deletions
+1 -1
View File
@@ -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
+9 -6
View File
@@ -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