Skip to content

Commit 8edbc7e

Browse files
committed
added tile_size input to tiled advanced base only
1 parent 31abb04 commit 8edbc7e

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

mikey_nodes.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2719,9 +2719,9 @@ def match_histograms(source, reference):
27192719
return matched_img
27202720

27212721

2722-
def split_image(img):
2722+
def split_image(img, tile_size=1024):
27232723
"""Generate tiles for a given image."""
2724-
tile_width, tile_height = 1024, 1024
2724+
tile_width, tile_height = tile_size, tile_size
27252725
width, height = img.width, img.height
27262726

27272727
# Determine the number of tiles needed
@@ -2854,9 +2854,9 @@ def run_tiler(enlarged_img, base_model, vae, seed, positive_cond_base, negative_
28542854

28552855
return result
28562856

2857-
def run_tiler_for_steps(enlarged_img, base_model, vae, seed, cfg, sampler_name, scheduler, positive_cond_base, negative_cond_base, steps=20, denoise=0.25):
2857+
def run_tiler_for_steps(enlarged_img, base_model, vae, seed, cfg, sampler_name, scheduler, positive_cond_base, negative_cond_base, steps=20, denoise=0.25, tile_size=1024):
28582858
# Split the enlarged image into overlapping tiles
2859-
tiles = split_image(enlarged_img)
2859+
tiles = split_image(enlarged_img, tile_size=tile_size)
28602860

28612861
# Resample each tile using the AI model
28622862
start_step = int(steps - (steps * denoise))
@@ -3028,7 +3028,8 @@ def INPUT_TYPES(s):
30283028
"sampler_name": (comfy.samplers.KSampler.SAMPLERS, ),
30293029
"scheduler": (comfy.samplers.KSampler.SCHEDULERS, ),
30303030
"upscale_by": ("FLOAT", {"default": 1.0, "min": 0.1, "max": 10.0, "step": 0.1}),
3031-
"tiler_denoise": ("FLOAT", {"default": 0.25, "min": 0.0, "max": 1.0, "step": 0.05}),},
3031+
"tiler_denoise": ("FLOAT", {"default": 0.25, "min": 0.0, "max": 1.0, "step": 0.05}),
3032+
"tile_size": ("INT", {"default": 1024, "min": 256, "max": 4096, "step": 64})},
30323033
"optional": {"image_optional": ("IMAGE",),}}
30333034

30343035
RETURN_TYPES = ('IMAGE', )
@@ -3073,7 +3074,7 @@ def upscale_image(self, samples, vae,
30733074
return img, upscaled_width, upscaled_height
30743075

30753076
def run(self, seed, base_model, vae, samples, positive_cond_base, negative_cond_base,
3076-
model_name, upscale_by=2.0, tiler_denoise=0.4,
3077+
model_name, upscale_by=2.0, tiler_denoise=0.4, tile_size=1024,
30773078
upscale_method='normal', denoise_image=1.0, steps=30, cfg=6.5,
30783079
sampler_name='dpmpp_sde_gpu', scheduler='karras', image_optional=None):
30793080
# if image not none replace samples with decoded image
@@ -3090,7 +3091,7 @@ def run(self, seed, base_model, vae, samples, positive_cond_base, negative_cond_
30903091
img = self.upscale_image(samples, vae, upscale_by, model_name)
30913092
img = tensor2pil(img)
30923093
# phase 2: run tiler
3093-
tiled_image = run_tiler_for_steps(img, base_model, vae, seed, cfg, sampler_name, scheduler, positive_cond_base, negative_cond_base, steps, tiler_denoise)
3094+
tiled_image = run_tiler_for_steps(img, base_model, vae, seed, cfg, sampler_name, scheduler, positive_cond_base, negative_cond_base, steps, tiler_denoise, tile_size)
30943095
return (tiled_image, )
30953096

30963097
class MikeySamplerTiledBaseOnly(MikeySamplerTiled):

0 commit comments

Comments
 (0)