From 755723ce647be0545548224e3a8845a961330ab3 Mon Sep 17 00:00:00 2001 From: yolain Date: Wed, 15 Oct 2025 21:28:01 +0800 Subject: [PATCH] Fix references to some official nodes --- py/nodes/adapter.py | 11 +++++++++-- py/nodes/image.py | 6 +++++- py/nodes/inpaint.py | 5 ++++- py/nodes/samplers.py | 38 +++++++++++++++++++++++--------------- 4 files changed, 41 insertions(+), 19 deletions(-) diff --git a/py/nodes/adapter.py b/py/nodes/adapter.py index 5c535d2..8f28c2a 100644 --- a/py/nodes/adapter.py +++ b/py/nodes/adapter.py @@ -1,5 +1,6 @@ import re import torch +import folder_paths import comfy.utils, comfy.sample, comfy.samplers, comfy.controlnet, comfy.model_base, comfy.model_management, comfy.sampler_helpers, comfy.supported_models from comfy_extras.nodes_compositing import JoinImageWithAlpha from comfy.clip_vision import load as load_clip_vision @@ -180,7 +181,10 @@ class icLightApply: image = self.removebg(image) else: mask = torch.full((1, height, width), 1.0, dtype=torch.float32, device="cpu") - image, = JoinImageWithAlpha().join_image_with_alpha(image, mask) + try: + image, = JoinImageWithAlpha().execute(image, mask) + except: + image, = JoinImageWithAlpha().join_image_with_alpha(image, mask) iclight = ICLight() if mode == 'Foreground': @@ -190,7 +194,10 @@ class icLightApply: if source not in ['Use Background Image', 'Use Flipped Background Image']: _, height, width, _ = lighting_image.shape mask = torch.full((1, height, width), 1.0, dtype=torch.float32, device="cpu") - lighting_image, = JoinImageWithAlpha().join_image_with_alpha(lighting_image, mask) + try: + lighting_image, = JoinImageWithAlpha().execute(lighting_image, mask) + except: + lighting_image, = JoinImageWithAlpha().join_image_with_alpha(lighting_image, mask) if batch_size < 2: image = self.batch(image, lighting_image) else: diff --git a/py/nodes/image.py b/py/nodes/image.py index f26a916..aa0933a 100644 --- a/py/nodes/image.py +++ b/py/nodes/image.py @@ -1396,7 +1396,11 @@ class humanSegmentation: alpha = 1.0 - mask - output_image, = JoinImageWithAlpha().join_image_with_alpha(image, alpha) + try: + output_image, = JoinImageWithAlpha().execute(image, alpha) + except: + output_image, = JoinImageWithAlpha().join_image_with_alpha(image, alpha) + elif method == "human_parts (deeplabv3p)": if method in cache: diff --git a/py/nodes/inpaint.py b/py/nodes/inpaint.py index db82768..ab1b1d0 100644 --- a/py/nodes/inpaint.py +++ b/py/nodes/inpaint.py @@ -331,7 +331,10 @@ class applyInpaint: new_pipe = self.inpaint_model_conditioning(new_pipe, image, vae, mask, grow_mask_by, noise_mask=noise_mask) cls = ALL_NODE_CLASS_MAPPINGS['DifferentialDiffusion'] if cls is not None: - model, = cls().apply(new_pipe['model']) + try: + model, = cls().execute(new_pipe['model']) + except Exception: + model, = cls().apply(new_pipe['model']) new_pipe['model'] = model else: raise Exception("Differential Diffusion not found,please update comfyui") diff --git a/py/nodes/samplers.py b/py/nodes/samplers.py index 15fea9c..c8ac6dc 100644 --- a/py/nodes/samplers.py +++ b/py/nodes/samplers.py @@ -1,6 +1,7 @@ import sys, re, time import torch import comfy.utils, comfy.sample, comfy.samplers, comfy.controlnet, comfy.model_base, comfy.model_management, comfy.sampler_helpers, comfy.supported_models +import folder_paths from comfy.model_patcher import ModelPatcher from comfy_extras.nodes_mask import GrowMask import comfy_extras.nodes_custom_sampler as custom_samplers @@ -118,7 +119,14 @@ class samplerFull: def get_custom_cls(self, sampler_name): try: cls = custom_samplers.__dict__[sampler_name] - return cls() + cls = cls() + if hasattr(cls, "get_sigmas"): + cls.execute = cls.get_sigmas + elif hasattr(cls, "get_guider"): + cls.execute = cls.get_guider + elif hasattr(cls, "get_sampler"): + cls.execute = cls.get_sampler + return cls except: raise Exception(f"Custom sampler {sampler_name} not found, Please updated your ComfyUI") @@ -156,15 +164,15 @@ class samplerFull: sigmas = optional_sigmas else: if scheduler == 'vp': - sigmas, = self.get_custom_cls('VPScheduler').get_sigmas(steps, beta_d, beta_min, eps_s) + sigmas, = self.get_custom_cls('VPScheduler').execute(steps, beta_d, beta_min, eps_s) elif scheduler == 'karrasADV': - sigmas, = self.get_custom_cls('KarrasScheduler').get_sigmas(steps, sigma_max, sigma_min, rho) + sigmas, = self.get_custom_cls('KarrasScheduler').execute(steps, sigma_max, sigma_min, rho) elif scheduler == 'exponentialADV': - sigmas, = self.get_custom_cls('ExponentialScheduler').get_sigmas(steps, sigma_max, sigma_min) + sigmas, = self.get_custom_cls('ExponentialScheduler').execute(steps, sigma_max, sigma_min) elif scheduler == 'polyExponential': - sigmas, = self.get_custom_cls('PolyexponentialScheduler').get_sigmas(steps, sigma_max, sigma_min, rho) + sigmas, = self.get_custom_cls('PolyexponentialScheduler').execute(steps, sigma_max, sigma_min, rho) elif scheduler == 'sdturbo': - sigmas, = self.get_custom_cls('SDTurboScheduler').get_sigmas(model, steps, denoise) + sigmas, = self.get_custom_cls('SDTurboScheduler').execute(model, steps, denoise) elif scheduler == 'alignYourSteps': model_type = get_sd_version(model) if model_type == 'unknown': @@ -173,11 +181,11 @@ class samplerFull: elif scheduler == 'gits': sigmas, = gitsScheduler().get_sigmas(coeff, steps, denoise) else: - sigmas, = self.get_custom_cls('BasicScheduler').get_sigmas(model, scheduler, steps, denoise) + sigmas, = self.get_custom_cls('BasicScheduler').execute(model, scheduler, steps, denoise) # filp_sigmas if flip_sigmas: - sigmas, = self.get_custom_cls('FlipSigmas').get_sigmas(sigmas) + sigmas, = self.get_custom_cls('FlipSigmas').execute(sigmas) ####################################################################################### # brushnet @@ -209,12 +217,12 @@ class samplerFull: positive = c if guider in ['CFG', 'IP2P+CFG']: - _guider, = self.get_custom_cls('CFGGuider').get_guider(model, positive, negative, cfg) + _guider, = self.get_custom_cls('CFGGuider').execute(model, positive, negative, cfg) elif guider in ['DualCFG', 'IP2P+DualCFG']: - _guider, = self.get_custom_cls('DualCFGGuider').get_guider(model, positive, middle, + _guider, = self.get_custom_cls('DualCFGGuider').execute(model, positive, middle, negative, cfg, cfg_negative) else: - _guider, = self.get_custom_cls('BasicGuider').get_guider(model, positive) + _guider, = self.get_custom_cls('BasicGuider').execute(model, positive) # sampler if optional_sampler: @@ -223,7 +231,7 @@ class samplerFull: if sampler_name == 'inversed_euler': _sampler, = self.get_inversed_euler_sampler() else: - _sampler, = self.get_custom_cls('KSamplerSelect').get_sampler(sampler_name) + _sampler, = self.get_custom_cls('KSamplerSelect').execute(sampler_name) return (_guider, _sampler, sigmas) @@ -277,18 +285,18 @@ class samplerFull: if width_downscale_factor > 1.75: log_node_warn("Patch model unet add downscale...") log_node_warn("Downscale factor:" + str(width_downscale_factor)) - (samp_model,) = cls().patch(samp_model, downscale_options['block_number'], width_downscale_factor, 0, 0.35, True, "bicubic", + (samp_model,) = cls().execute(samp_model, downscale_options['block_number'], width_downscale_factor, 0, 0.35, True, "bicubic", "bicubic") elif height_downscale_factor > 1.25: log_node_warn("Patch model unet add downscale....") log_node_warn("Downscale factor:" + str(height_downscale_factor)) - (samp_model,) = cls().patch(samp_model, downscale_options['block_number'], height_downscale_factor, 0, 0.35, True, "bicubic", + (samp_model,) = cls().execute(samp_model, downscale_options['block_number'], height_downscale_factor, 0, 0.35, True, "bicubic", "bicubic") else: cls = ALL_NODE_CLASS_MAPPINGS['PatchModelAddDownscale'] log_node_warn("Patch model unet add downscale....") log_node_warn("Downscale factor:" + str(downscale_options['downscale_factor'])) - (samp_model,) = cls().patch(samp_model, downscale_options['block_number'], downscale_options['downscale_factor'], downscale_options['start_percent'], downscale_options['end_percent'], downscale_options['downscale_after_skip'], downscale_options['downscale_method'], downscale_options['upscale_method']) + (samp_model,) = cls().execute(samp_model, downscale_options['block_number'], downscale_options['downscale_factor'], downscale_options['start_percent'], downscale_options['end_percent'], downscale_options['downscale_after_skip'], downscale_options['downscale_method'], downscale_options['upscale_method']) return samp_model def process_sample_state(pipe, samp_model, samp_clip, samp_samples, samp_vae, samp_seed, samp_positive,