The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.
Add compression_ratio to controlnet code.
comfyanonymous10860bcd28ca
diff --git a/comfy/controlnet.py b/comfy/controlnet.pyindex f859a50d4..602b2d3b0 100644--- a/comfy/controlnet.py+++ b/comfy/controlnet.py@@ -37,6 +37,7 @@ class ControlBase:self.timestep_percent_range = (0.0, 1.0)self.global_average_pooling = Falseself.timestep_range = None+ self.compression_ratio = 8if device is None:device = comfy.model_management.get_torch_device()@@ -158,11 +159,11 @@ class ControlNet(ControlBase):dtype = self.manual_cast_dtypeoutput_dtype = x_noisy.dtype- if self.cond_hint is None or x_noisy.shape[2] * 8 != self.cond_hint.shape[2] or x_noisy.shape[3] * 8 != self.cond_hint.shape[3]:+ if self.cond_hint is None or x_noisy.shape[2] * self.compression_ratio != self.cond_hint.shape[2] or x_noisy.shape[3] * self.compression_ratio != self.cond_hint.shape[3]:if self.cond_hint is not None:del self.cond_hintself.cond_hint = None- self.cond_hint = comfy.utils.common_upscale(self.cond_hint_original, x_noisy.shape[3] * 8, x_noisy.shape[2] * 8, 'nearest-exact', "center").to(dtype).to(self.device)+ self.cond_hint = comfy.utils.common_upscale(self.cond_hint_original, x_noisy.shape[3] * self.compression_ratio, x_noisy.shape[2] * self.compression_ratio, 'nearest-exact', "center").to(dtype).to(self.device)if x_noisy.shape[0] != self.cond_hint.shape[0]:self.cond_hint = broadcast_image_to(self.cond_hint, x_noisy.shape[0], batched_number)@@ -456,12 +457,12 @@ class T2IAdapter(ControlBase):else:return None- if self.cond_hint is None or x_noisy.shape[2] * 8 != self.cond_hint.shape[2] or x_noisy.shape[3] * 8 != self.cond_hint.shape[3]:+ if self.cond_hint is None or x_noisy.shape[2] * self.compression_ratio != self.cond_hint.shape[2] or x_noisy.shape[3] * self.compression_ratio != self.cond_hint.shape[3]:if self.cond_hint is not None:del self.cond_hintself.control_input = Noneself.cond_hint = None- width, height = self.scale_image_to(x_noisy.shape[3] * 8, x_noisy.shape[2] * 8)+ width, height = self.scale_image_to(x_noisy.shape[3] * self.compression_ratio, x_noisy.shape[2] * self.compression_ratio)self.cond_hint = comfy.utils.common_upscale(self.cond_hint_original, width, height, 'nearest-exact', "center").float().to(self.device)if self.channels_in == 1 and self.cond_hint.shape[1] > 1:self.cond_hint = torch.mean(self.cond_hint, 1, keepdim=True)