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

Method encode_condition_image

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

Source from the content-addressed store, hash-verified

133
134 @torch.no_grad()
135 def encode_condition_image(self, images):
136 dtype = next(self.pipeline.vae.parameters()).dtype
137 image_pil = [v2.functional.to_pil_image(images[i]) for i in range(images.shape[0])]
138 image_pt = self.pipeline.feature_extractor_vae(images=image_pil, return_tensors="pt").pixel_values
139 image_pt = image_pt.to(device=self.device, dtype=dtype)
140 latents = self.pipeline.vae.encode(image_pt).latent_dist.sample()
141 return latents
142
143 @torch.no_grad()
144 def encode_target_images(self, images):

Callers 1

training_stepMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected