add cross-attention support to im2img; prevent inpainting from crashing

This commit is contained in:
Damian at mba
2022-10-18 23:23:38 +02:00
parent 2b79a716aa
commit 582880b314
4 changed files with 15 additions and 5 deletions

View File

@ -32,7 +32,7 @@ class Img2Img(Generator):
) # move to latent space
t_enc = int(strength * steps)
uc, c = conditioning
uc, c, ec, edit_opcodes = conditioning
def make_image(x_T):
# encode (scaled latent)
@ -49,7 +49,10 @@ class Img2Img(Generator):
img_callback = step_callback,
unconditional_guidance_scale=cfg_scale,
unconditional_conditioning=uc,
init_latent = self.init_latent, # changes how noising is performed in ksampler
init_latent = self.init_latent,
edited_conditioning = ec,
conditioning_edit_opcodes = edit_opcodes
# changes how noising is performed in ksampler
)
return self.sample_to_image(samples)

View File

@ -45,7 +45,8 @@ class Inpaint(Img2Img):
) # move to latent space
t_enc = int(strength * steps)
uc, c = conditioning
# todo: support cross-attention control
uc, c, _, _ = conditioning
print(f">> target t_enc is {t_enc} steps")