| 74 | return ((z - mean) / std) * self.sigma_data |
| 75 | |
| 76 | def decode(self, z): |
| 77 | in_dtype = z.dtype |
| 78 | latent_ch = z.shape[1] |
| 79 | latent_t = z.shape[2] |
| 80 | mean = self.latent_mean.view(latent_ch, -1)[:, : latent_t].reshape([1, latent_ch, -1, 1, 1]).to(dtype=in_dtype, device=z.device) |
| 81 | std = self.latent_std.view(latent_ch, -1)[:, : latent_t].reshape([1, latent_ch, -1, 1, 1]).to(dtype=in_dtype, device=z.device) |
| 82 | z = z / self.sigma_data |
| 83 | z = z * std + mean |
| 84 | z = self.post_quant_conv(z) |
| 85 | return self.decoder(z) |
| 86 | |
| 87 | |
| 88 | def load_custom_video_vae(path): |