Add spatial batching to latent upscale

This commit is contained in:
2026-09-03 15:12:42 +00:00
parent 2cb3c694f0
commit 36d9f4369c
5 changed files with 131 additions and 8 deletions
+25 -1
View File
@@ -463,13 +463,27 @@ class H3LatentUpscaleParams:
"tooltip": "How much the refinement pass may rewrite the upscaled latent. Lower = safer, higher = freer."}),
"megapixels": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 4.0, "step": 0.01,
"tooltip": "Primary target size for the latent refinement stage. If width and height are both set, they win; otherwise the node scales the current shot to this pixel budget while preserving aspect ratio. 0 keeps the incoming latent size."}),
"tile_width": ("INT", {"default": 512, "min": 32, "max": 4096, "step": 32,
"tooltip": "Spatial tile width for the refinement stage in pixels. 512 matches the upstream latent-split default."}),
"tile_height": ("INT", {"default": 512, "min": 32, "max": 4096, "step": 32,
"tooltip": "Spatial tile height for the refinement stage in pixels. 512 matches the upstream latent-split default."}),
"overlap": ("INT", {"default": 64, "min": 0, "max": 4096, "step": 32,
"tooltip": "Pixel overlap between neighbouring spatial tiles. 64 matches the upstream latent-split default."}),
"fade_width": ("INT", {"default": 0, "min": 0, "max": 4096, "step": 32,
"tooltip": "Width in pixels of the freeze-to-free transition inside each overlap strip. 0 freezes the whole strip, matching the upstream default."}),
"overlap_mode": (["earlier", "later"], {"default": "earlier",
"tooltip": "Which tile wins the overlap band when stitching the spatial batches back together."}),
}
}
def build(self, mode, model_name, method, width, height, device, precision, sampler_name, scheduler, steps, denoise, megapixels):
def build(self, mode, model_name, method, width, height, device, precision, sampler_name, scheduler, steps, denoise, megapixels, tile_width, tile_height, overlap, fade_width, overlap_mode):
width = int(width)
height = int(height)
steps = int(steps)
tile_width = int(tile_width)
tile_height = int(tile_height)
overlap = int(overlap)
fade_width = int(fade_width)
if mode == "off":
return ({
"mode": "off",
@@ -481,6 +495,11 @@ class H3LatentUpscaleParams:
"denoise": float(denoise),
"refine_denoise": float(denoise),
"megapixels": float(megapixels),
"tile_width": tile_width,
"tile_height": tile_height,
"overlap": overlap,
"fade_width": fade_width,
"overlap_mode": overlap_mode,
},)
if width > 0:
width = int(round(width / 32.0)) * 32
@@ -500,6 +519,11 @@ class H3LatentUpscaleParams:
"denoise": float(denoise),
"refine_denoise": float(denoise),
"megapixels": float(megapixels),
"tile_width": tile_width,
"tile_height": tile_height,
"overlap": overlap,
"fade_width": fade_width,
"overlap_mode": overlap_mode,
},)