Fix no half vae

This commit is contained in:
Disty0
2024-08-21 22:45:02 +03:00
parent b706083541
commit 963940b9ae
2 changed files with 5 additions and 2 deletions
+4 -1
View File
@@ -44,7 +44,10 @@ def full_vae_decode(latents, model):
upcast = (model.vae.dtype == torch.float16) and getattr(model.vae.config, 'force_upcast', False) and hasattr(model, 'upcast_vae')
if upcast: # this is done by diffusers automatically if output_type != 'latent'
model.upcast_vae()
if getattr(model.vae, "post_quant_conv", None) is not None:
if shared.opts.no_half_vae:
latents = latents.to(torch.float32)
elif getattr(model.vae, "post_quant_conv", None) is not None:
latents = latents.to(next(iter(model.vae.post_quant_conv.parameters())).dtype)
# normalize latents