MCPcopy Create free account
hub / github.com/ali-vilab/ACE_plus / prepare_input

Method prepare_input

inference/ace_plus_diffusers.py:41–66  ·  view source on GitHub ↗
(self,
                      image,
                      mask,
                      batch_size=1,
                      dtype = torch.bfloat16,
                      num_images_per_prompt=1,
                      height=512,
                      width=512,
                      generator=None)

Source from the content-addressed store, hash-verified

39 self.load_default(cfg.DEFAULT_PARAS)
40
41 def prepare_input(self,
42 image,
43 mask,
44 batch_size=1,
45 dtype = torch.bfloat16,
46 num_images_per_prompt=1,
47 height=512,
48 width=512,
49 generator=None):
50 num_channels_latents = self.pipe.vae.config.latent_channels
51 # import pdb;pdb.set_trace()
52 mask, masked_image_latents = self.pipe.prepare_mask_latents(
53 mask.unsqueeze(0),
54 image.unsqueeze(0).to(we.device_id, dtype = dtype),
55 batch_size,
56 num_channels_latents,
57 num_images_per_prompt,
58 height,
59 width,
60 dtype,
61 we.device_id,
62 generator,
63 )
64 # import pdb;pdb.set_trace()
65 masked_image_latents = torch.cat((masked_image_latents, mask), dim=-1)
66 return masked_image_latents
67
68 @torch.no_grad()
69 def __call__(self,

Callers 1

__call__Method · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected