mirror of
https://github.com/invoke-ai/InvokeAI.git
synced 2026-02-10 17:35:03 -05:00
Same issue affects image2image, so do the same again
This commit is contained in:
committed by
Kent Keirsey
parent
7b5efc2203
commit
496b02a3bc
@@ -312,6 +312,12 @@ class AutoEncoder(nn.Module):
|
||||
Tensor: Encoded latent tensor. Shape: (batch_size, z_channels, latent_height, latent_width).
|
||||
"""
|
||||
|
||||
# VAE is broken in float16, use same logic in model loading to pick bfloat16 or float32
|
||||
if x.dtype == torch.float16:
|
||||
try:
|
||||
x = x.to(torch.bfloat16)
|
||||
except TypeError:
|
||||
x = x.to(torch.float32)
|
||||
z = self.reg(self.encoder(x), sample=sample, generator=generator)
|
||||
z = self.scale_factor * (z - self.shift_factor)
|
||||
return z
|
||||
|
||||
Reference in New Issue
Block a user