diff --git a/modules/impact/config.py b/modules/impact/config.py index 51038f2..f2e6a86 100644 --- a/modules/impact/config.py +++ b/modules/impact/config.py @@ -1,7 +1,7 @@ import configparser import os -version_code = [5, 15] +version_code = [5, 15, 1] version = f"V{version_code[0]}.{version_code[1]}" + (f'.{version_code[2]}' if len(version_code) > 2 else '') dependency_version = 21 diff --git a/modules/impact/core.py b/modules/impact/core.py index 8141b20..6c09d12 100644 --- a/modules/impact/core.py +++ b/modules/impact/core.py @@ -1637,7 +1637,7 @@ class PixelKSampleUpscaler: upscaled_latent, denoise) refined_latent = impact_sampling.impact_sample(model, seed, steps, cfg, sampler_name, scheduler, - positive, negative, upscaled_latent, denoise, scheduler_func_opt=self.scheduler_func) + positive, negative, upscaled_latent, denoise, scheduler_func=self.scheduler_func) return refined_latent def upscale_shape(self, step_info, samples, w, h, save_temp_prefix=None): @@ -1665,7 +1665,7 @@ class PixelKSampleUpscaler: upscaled_latent, denoise) refined_latent = impact_sampling.impact_sample(model, seed, steps, cfg, sampler_name, scheduler, - positive, negative, upscaled_latent, denoise, scheduler_func_opt=self.scheduler_func) + positive, negative, upscaled_latent, denoise, scheduler_func=self.scheduler_func) return refined_latent @@ -1858,7 +1858,7 @@ class PixelTiledKSampleUpscaler: def __init__(self, scale_method, model, vae, seed, steps, cfg, sampler_name, scheduler, positive, negative, denoise, tile_width, tile_height, tiling_strategy, - upscale_model_opt=None, hook_opt=None, tile_cnet_opt=None, tile_size=512): + upscale_model_opt=None, hook_opt=None, tile_cnet_opt=None, tile_size=512, tile_cnet_strength=1.0): self.params = scale_method, model, vae, seed, steps, cfg, sampler_name, scheduler, positive, negative, denoise self.vae = vae self.tile_params = tile_width, tile_height, tiling_strategy @@ -1867,6 +1867,7 @@ class PixelTiledKSampleUpscaler: self.tile_cnet = tile_cnet_opt self.tile_size = tile_size self.is_tiled = True + self.tile_cnet_strength = tile_cnet_strength def tiled_ksample(self, latent, images): if "BNK_TiledKSampler" in nodes.NODE_CLASS_MAPPINGS: @@ -1890,7 +1891,7 @@ class PixelTiledKSampleUpscaler: # might add capacity to set pyrUp_iters later, not needed for now though preprocessed = preprocessor.execute(images, pyrUp_iters=3, resolution=min(image_w, image_h))[0] apply_cnet = getattr(nodes.ControlNetApply(), nodes.ControlNetApply.FUNCTION) - positive = apply_cnet(positive, self.tile_cnet, preprocessed, strength=1.0)[0] + positive = apply_cnet(positive, self.tile_cnet, preprocessed, strength=self.tile_cnet_strength)[0] return TiledKSampler().sample(model, seed, tile_width, tile_height, tiling_strategy, steps, cfg, sampler_name, scheduler, positive, negative, latent, denoise)[0] diff --git a/modules/impact/impact_pack.py b/modules/impact/impact_pack.py index a342545..32ef7b7 100644 --- a/modules/impact/impact_pack.py +++ b/modules/impact/impact_pack.py @@ -947,6 +947,7 @@ class PixelTiledKSampleUpscalerProvider: "upscale_model_opt": ("UPSCALE_MODEL", ), "pk_hook_opt": ("PK_HOOK", ), "tile_cnet_opt": ("CONTROL_NET", ), + "tile_cnet_strength": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 1.0, "step": 0.01}), } } @@ -955,9 +956,12 @@ class PixelTiledKSampleUpscalerProvider: CATEGORY = "ImpactPack/Upscale" - def doit(self, scale_method, model, vae, seed, steps, cfg, sampler_name, scheduler, positive, negative, denoise, tile_width, tile_height, tiling_strategy, upscale_model_opt=None, pk_hook_opt=None, tile_cnet_opt=None): + def doit(self, scale_method, model, vae, seed, steps, cfg, sampler_name, scheduler, positive, negative, denoise, tile_width, tile_height, tiling_strategy, upscale_model_opt=None, + pk_hook_opt=None, tile_cnet_opt=None, tile_cnet_strength=1.0): if "BNK_TiledKSampler" in nodes.NODE_CLASS_MAPPINGS: - upscaler = core.PixelTiledKSampleUpscaler(scale_method, model, vae, seed, steps, cfg, sampler_name, scheduler, positive, negative, denoise, tile_width, tile_height, tiling_strategy, upscale_model_opt, pk_hook_opt, tile_cnet_opt, tile_size=max(tile_width, tile_height)) + upscaler = core.PixelTiledKSampleUpscaler(scale_method, model, vae, seed, steps, cfg, sampler_name, scheduler, positive, negative, denoise, + tile_width, tile_height, tiling_strategy, upscale_model_opt, pk_hook_opt, tile_cnet_opt, + tile_size=max(tile_width, tile_height), tile_cnet_strength=tile_cnet_strength) return (upscaler, ) else: print("[ERROR] PixelTiledKSampleUpscalerProvider: ComfyUI_TiledKSampler custom node isn't installed. You must install BlenderNeko/ComfyUI_TiledKSampler extension to use this node.") @@ -985,6 +989,7 @@ class PixelTiledKSampleUpscalerProviderPipe: "upscale_model_opt": ("UPSCALE_MODEL", ), "pk_hook_opt": ("PK_HOOK", ), "tile_cnet_opt": ("CONTROL_NET", ), + "tile_cnet_strength": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 1.0, "step": 0.01}), } } @@ -993,10 +998,13 @@ class PixelTiledKSampleUpscalerProviderPipe: CATEGORY = "ImpactPack/Upscale" - def doit(self, scale_method, seed, steps, cfg, sampler_name, scheduler, denoise, tile_width, tile_height, tiling_strategy, basic_pipe, upscale_model_opt=None, pk_hook_opt=None, tile_cnet_opt=None): + def doit(self, scale_method, seed, steps, cfg, sampler_name, scheduler, denoise, tile_width, tile_height, tiling_strategy, basic_pipe, upscale_model_opt=None, pk_hook_opt=None, + tile_cnet_opt=None, tile_cnet_strength=1.0): if "BNK_TiledKSampler" in nodes.NODE_CLASS_MAPPINGS: model, _, vae, positive, negative = basic_pipe - upscaler = core.PixelTiledKSampleUpscaler(scale_method, model, vae, seed, steps, cfg, sampler_name, scheduler, positive, negative, denoise, tile_width, tile_height, tiling_strategy, upscale_model_opt, pk_hook_opt, tile_cnet_opt, tile_size=max(tile_width, tile_height)) + upscaler = core.PixelTiledKSampleUpscaler(scale_method, model, vae, seed, steps, cfg, sampler_name, scheduler, positive, negative, denoise, + tile_width, tile_height, tiling_strategy, upscale_model_opt, pk_hook_opt, tile_cnet_opt, + tile_size=max(tile_width, tile_height), tile_cnet_strength=tile_cnet_strength) return (upscaler, ) else: print("[ERROR] PixelTiledKSampleUpscalerProviderPipe: ComfyUI_TiledKSampler custom node isn't installed. You must install BlenderNeko/ComfyUI_TiledKSampler extension to use this node.") diff --git a/modules/impact/impact_sampling.py b/modules/impact/impact_sampling.py index b107697..94b136e 100644 --- a/modules/impact/impact_sampling.py +++ b/modules/impact/impact_sampling.py @@ -197,7 +197,8 @@ def impact_sample(model, seed, steps, cfg, sampler_name, scheduler, positive, ne advanced_steps = math.floor(steps / denoise) start_at_step = advanced_steps - steps end_at_step = start_at_step + steps - return separated_sample(model, True, seed, advanced_steps, cfg, sampler_name, scheduler, positive, negative, latent_image, start_at_step, end_at_step, False, scheduler_func=scheduler_func) + return separated_sample(model, True, seed, advanced_steps, cfg, sampler_name, scheduler, positive, negative, latent_image, + start_at_step, end_at_step, False, scheduler_func=scheduler_func) def ksampler_wrapper(model, seed, steps, cfg, sampler_name, scheduler, positive, negative, latent_image, denoise, diff --git a/modules/impact/segs_nodes.py b/modules/impact/segs_nodes.py index 67c57f5..b901f05 100644 --- a/modules/impact/segs_nodes.py +++ b/modules/impact/segs_nodes.py @@ -109,7 +109,7 @@ class SEGSDetailer: refiner_ratio=refiner_ratio, refiner_model=refiner_model, refiner_clip=refiner_clip, refiner_positive=refiner_positive, refiner_negative=refiner_negative, control_net_wrapper=seg.control_net_wrapper, cycle=cycle, - inpaint_model=inpaint_model, noise_mask_feather=noise_mask_feather, scheduler_func_opt=scheduler_func_opt) + inpaint_model=inpaint_model, noise_mask_feather=noise_mask_feather, scheduler_func=scheduler_func_opt) if cnet_pils is not None: cnet_pil_list.extend(cnet_pils) diff --git a/pyproject.toml b/pyproject.toml index 64b7315..790c6e9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "comfyui-impact-pack" description = "This extension offers various detector nodes and detailer nodes that allow you to configure a workflow that automatically enhances facial details. And provide iterative upscaler." -version = "5.15" +version = "5.15.1" license = "LICENSE" dependencies = ["segment-anything", "scikit-image", "piexif", "transformers", "opencv-python-headless", "GitPython", "scipy>=1.11.4"]