MCPcopy Create free account
hub / github.com/TencentARC/InstantMesh / encode_target_images

Method encode_target_images

zero123plus/model.py:144–151  ·  view source on GitHub ↗
(self, images)

Source from the content-addressed store, hash-verified

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

Callers 1

training_stepMethod · 0.95

Calls 1

scale_latentsFunction · 0.70

Tested by

no test coverage detected