The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.
Remove some useless code.
comfyanonymous907010e0824e
diff --git a/comfy/samplers.py b/comfy/samplers.pyindex 19ebc97d9..15527224e 100644--- a/comfy/samplers.py+++ b/comfy/samplers.py@@ -7,23 +7,6 @@ from comfy import model_managementfrom .ldm.models.diffusion.ddim import DDIMSamplerfrom .ldm.modules.diffusionmodules.util import make_ddim_timesteps-class CFGDenoiser(torch.nn.Module):- def __init__(self, model):- super().__init__()- self.inner_model = model-- def forward(self, x, sigma, uncond, cond, cond_scale):- if len(uncond[0]) == len(cond[0]) and x.shape[0] * x.shape[2] * x.shape[3] < (96 * 96): #TODO check memory instead- x_in = torch.cat([x] * 2)- sigma_in = torch.cat([sigma] * 2)- cond_in = torch.cat([uncond, cond])- uncond, cond = self.inner_model(x_in, sigma_in, cond=cond_in).chunk(2)- else:- cond = self.inner_model(x, sigma, cond=cond)- uncond = self.inner_model(x, sigma, cond=uncond)- return uncond + (cond - uncond) * cond_scale--#The main sampling function shared by all the samplers#Returns predicted noisedef sampling_function(model_function, x, timestep, uncond, cond, cond_scale, cond_concat=None, model_options={}):