From 9f7e9f05478cc51c5f3de38a969756c20381cd08 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Sat, 21 Sep 2024 01:33:18 -0400 Subject: [PATCH] Add an error message when a controlnet needs a VAE but none is given. --- comfy/controlnet.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/comfy/controlnet.py b/comfy/controlnet.py index 4bd075e9..61a67f3f 100644 --- a/comfy/controlnet.py +++ b/comfy/controlnet.py @@ -88,6 +88,8 @@ class ControlBase: self.strength = strength self.timestep_percent_range = timestep_percent_range if self.latent_format is not None: + if vae is None: + logging.warning("WARNING: no VAE provided to the controlnet apply node when this controlnet requires one.") self.vae = vae self.extra_concat_orig = extra_concat.copy() if self.concat_mask and len(self.extra_concat_orig) == 0: @@ -222,6 +224,9 @@ class ControlNet(ControlBase): compression_ratio = self.compression_ratio if self.vae is not None: compression_ratio *= self.vae.downscale_ratio + else: + if self.latent_format is not None: + raise ValueError("This Controlnet needs a VAE but none was provided, please use a different ControlNetApply node with a VAE input.") self.cond_hint = comfy.utils.common_upscale(self.cond_hint_original, x_noisy.shape[3] * compression_ratio, x_noisy.shape[2] * compression_ratio, self.upscale_algorithm, "center") if self.vae is not None: loaded_models = comfy.model_management.loaded_models(only_currently_used=True)