The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.
Invert the start and end percentages in the code.
comfyanonymousdcec1047e6bb
diff --git a/comfy/controlnet.py b/comfy/controlnet.pyindex 098681582..433381df6 100644--- a/comfy/controlnet.py+++ b/comfy/controlnet.py@@ -33,7 +33,7 @@ class ControlBase:self.cond_hint_original = Noneself.cond_hint = Noneself.strength = 1.0- self.timestep_percent_range = (1.0, 0.0)+ self.timestep_percent_range = (0.0, 1.0)self.timestep_range = Noneif device is None:@@ -42,7 +42,7 @@ class ControlBase:self.previous_controlnet = Noneself.global_average_pooling = False- def set_cond_hint(self, cond_hint, strength=1.0, timestep_percent_range=(1.0, 0.0)):+ def set_cond_hint(self, cond_hint, strength=1.0, timestep_percent_range=(0.0, 1.0)):self.cond_hint_original = cond_hintself.strength = strengthself.timestep_percent_range = timestep_percent_rangediff --git a/comfy/model_sampling.py b/comfy/model_sampling.pyindex a2935d47d..d5b1642ef 100644--- a/comfy/model_sampling.py+++ b/comfy/model_sampling.py@@ -76,5 +76,10 @@ class ModelSamplingDiscrete(torch.nn.Module):return log_sigma.exp()def percent_to_sigma(self, percent):+ if percent <= 0.0:+ return torch.tensor(999999999.9)+ if percent >= 1.0:+ return torch.tensor(0.0)+ percent = 1.0 - percentreturn self.sigma(torch.tensor(percent * 999.0))diff --git a/comfy/samplers.py b/comfy/samplers.pyindex d8037d8ea..1d012a514 100644--- a/comfy/samplers.py+++ b/comfy/samplers.py@@ -220,6 +220,8 @@ def sampling_function(model, x, timestep, uncond, cond, cond_scale, model_optiontransformer_options["patches"] = patchestransformer_options["cond_or_uncond"] = cond_or_uncond[:]+ transformer_options["sigmas"] = timestep+c['transformer_options'] = transformer_optionsif 'model_function_wrapper' in model_options:diff --git a/comfy_extras/nodes_model_advanced.py b/comfy_extras/nodes_model_advanced.pyindex 399123eaa..c8c4b4a1e 100644--- a/comfy_extras/nodes_model_advanced.py+++ b/comfy_extras/nodes_model_advanced.py@@ -66,6 +66,11 @@ class ModelSamplingDiscreteLCM(torch.nn.Module):return log_sigma.exp()def percent_to_sigma(self, percent):+ if percent <= 0.0:+ return torch.tensor(999999999.9)+ if percent >= 1.0:+ return torch.tensor(0.0)+ percent = 1.0 - percentreturn self.sigma(torch.tensor(percent * 999.0))diff --git a/nodes.py b/nodes.pyindex 2bbfd8fe8..e8cfb5e6a 100644--- a/nodes.py+++ b/nodes.py@@ -248,8 +248,8 @@ class ConditioningSetTimestepRange:c = []for t in conditioning:d = t[1].copy()- d['start_percent'] = 1.0 - start- d['end_percent'] = 1.0 - end+ d['start_percent'] = start+ d['end_percent'] = endn = [t[0], d]c.append(n)return (c, )@@ -685,7 +685,7 @@ class ControlNetApplyAdvanced:if prev_cnet in cnets:c_net = cnets[prev_cnet]else:- c_net = control_net.copy().set_cond_hint(control_hint, strength, (1.0 - start_percent, 1.0 - end_percent))+ c_net = control_net.copy().set_cond_hint(control_hint, strength, (start_percent, end_percent))c_net.set_previous_controlnet(prev_cnet)cnets[prev_cnet] = c_net