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.

Fix ace step VAE decode crashing on non bf16 GPUs. (#16405)

comfyanonymous3c80da7f87ee
diff --git a/comfy/sd.py b/comfy/sd.py
index 230d4cf82..4380cffa5 100644
--- a/comfy/sd.py
+++ b/comfy/sd.py
@@ -1095,6 +1095,9 @@ class VAE:
self.patcher = mp(self.first_stage_model, load_device=self.device, offload_device=offload_device, fast_disk=fast_disk)
m, u = self.first_stage_model.load_state_dict(sd, strict=False, assign=self.patcher.is_dynamic())
+ if not self.patcher.is_dynamic():
+ # Lazy parameters only exist after loading the state dict.
+ self.first_stage_model.to(self.vae_dtype)
if len(m) > 0:
logging.warning("Missing VAE keys {}".format(m))