(self, images)
| 142 | |
| 143 | @torch.no_grad() |
| 144 | def encode_target_images(self, images): |
| 145 | dtype = next(self.pipeline.vae.parameters()).dtype |
| 146 | # equals to scaling images to [-1, 1] first and then call scale_image |
| 147 | images = (images - 0.5) / 0.8 # [-0.625, 0.625] |
| 148 | posterior = self.pipeline.vae.encode(images.to(dtype)).latent_dist |
| 149 | latents = posterior.sample() * self.pipeline.vae.config.scaling_factor |
| 150 | latents = scale_latents(latents) |
| 151 | return latents |
| 152 | |
| 153 | def forward_unet(self, latents, t, prompt_embeds, cond_latents): |
| 154 | dtype = next(self.pipeline.unet.parameters()).dtype |
no test coverage detected