MCPcopy
hub / github.com/junshutang/Make-It-3D / get_img_embeds

Method get_img_embeds

nerf/sd.py:87–95  ·  view source on GitHub ↗
(self, prompt_img)

Source from the content-addressed store, hash-verified

85 return text_embeddings
86
87 def get_img_embeds(self, prompt_img):
88 # Tokenize text and get embeddings
89 prompt_img = prompt_img.squeeze(0)
90 img_input = self.processor(images=prompt_img.detach().cpu().numpy(), return_tensors='pt')
91
92 with torch.no_grad():
93 img_embeddings = self.image_encoder(img_input.pixel_values.to(self.device))[0]
94
95 return img_embeddings
96
97 def img_clip_loss(self, clip_model, rgb1, rgb2):
98 image_z_1 = clip_model.encode_image(self.aug(rgb1))

Callers

nothing calls this directly

Calls 2

cpuMethod · 0.45
toMethod · 0.45

Tested by

no test coverage detected