fix broken DDIM with img2img

This commit is contained in:
AUTOMATIC 2022-09-28 22:30:52 +03:00
parent a703f56d73
commit d62954c2bc

View File

@ -136,6 +136,8 @@ class VanillaStableDiffusionSampler:
def sample_img2img(self, p, x, noise, conditioning, unconditional_conditioning, steps=None):
steps, t_enc = setup_img2img_steps(p, steps)
self.initialize(p)
# existing code fails with cetain step counts, like 9
try:
self.sampler.make_schedule(ddim_num_steps=steps, ddim_eta=self.eta, ddim_discretize=p.ddim_discretize, verbose=False)
@ -144,8 +146,6 @@ class VanillaStableDiffusionSampler:
x1 = self.sampler.stochastic_encode(x, torch.tensor([t_enc] * int(x.shape[0])).to(shared.device), noise=noise)
self.initialize(p)
self.init_latent = x
self.step = 0