Skip to content

Commit

Permalink
Fixed img2imgalt after inpainting update
Browse files Browse the repository at this point in the history
  • Loading branch information
random-thoughtss authored and AUTOMATIC1111 committed Oct 22, 2022
1 parent ffea9b1 commit 7613ea1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion scripts/img2imgalt.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ def find_noise_for_image(p, cond, uncond, cfg_scale, steps):
sigma_in = torch.cat([sigmas[i] * s_in] * 2)
cond_in = torch.cat([uncond, cond])

image_conditioning = torch.cat([p.image_conditioning] * 2)
cond_in = {"c_concat": [image_conditioning], "c_crossattn": [cond_in]}

c_out, c_in = [K.utils.append_dims(k, x_in.ndim) for k in dnw.get_scalings(sigma_in)]
t = dnw.sigma_to_t(sigma_in)

Expand Down Expand Up @@ -78,6 +81,9 @@ def find_noise_for_image_sigma_adjustment(p, cond, uncond, cfg_scale, steps):
sigma_in = torch.cat([sigmas[i - 1] * s_in] * 2)
cond_in = torch.cat([uncond, cond])

image_conditioning = torch.cat([p.image_conditioning] * 2)
cond_in = {"c_concat": [image_conditioning], "c_crossattn": [cond_in]}

c_out, c_in = [K.utils.append_dims(k, x_in.ndim) for k in dnw.get_scalings(sigma_in)]

if i == 1:
Expand Down Expand Up @@ -194,7 +200,7 @@ def sample_extra(conditioning, unconditional_conditioning, seeds, subseeds, subs

p.seed = p.seed + 1

return sampler.sample_img2img(p, p.init_latent, noise_dt, conditioning, unconditional_conditioning)
return sampler.sample_img2img(p, p.init_latent, noise_dt, conditioning, unconditional_conditioning, image_conditioning=p.image_conditioning)

p.sample = sample_extra

Expand Down

0 comments on commit 7613ea1

Please sign in to comment.