Skip to content

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 an error message when a controlnet needs a VAE but none is given.

comfyanonymous9f7e9f05478c
diff --git a/comfy/controlnet.py b/comfy/controlnet.py
index 4bd075e9d..61a67f3f4 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)