Skip to content

Commit f719f9c

Browse files
authored
sd: delay VAE dtype archive until after override (#12388)
VAEs have host specific dtype logic that should override the dynamic _model_dtype. Defer the archiving of model dtypes until after.
1 parent fe053ba commit f719f9c

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

comfy/sd.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -793,8 +793,6 @@ def estimate_memory(shape, dtype, num_layers = 16, kv_cache_multiplier = 2):
793793
self.first_stage_model = AutoencoderKL(**(config['params']))
794794
self.first_stage_model = self.first_stage_model.eval()
795795

796-
model_management.archive_model_dtypes(self.first_stage_model)
797-
798796
if device is None:
799797
device = model_management.vae_device()
800798
self.device = device
@@ -803,6 +801,7 @@ def estimate_memory(shape, dtype, num_layers = 16, kv_cache_multiplier = 2):
803801
dtype = model_management.vae_dtype(self.device, self.working_dtypes)
804802
self.vae_dtype = dtype
805803
self.first_stage_model.to(self.vae_dtype)
804+
model_management.archive_model_dtypes(self.first_stage_model)
806805
self.output_device = model_management.intermediate_device()
807806

808807
mp = comfy.model_patcher.CoreModelPatcher

0 commit comments

Comments
 (0)