This commit is contained in:
Matt Tancik committed 2023-02-14 09:46:34 -08:00
1 parent b8d99713f3
commit caa914830a
1 file changed
+2 -2
+2 -2
View File
@@ -210,7 +210,7 @@ class StableDiffusion(nn.Module):
# perform guidance # perform guidance
noise_pred_uncond, noise_pred_text = noise_pred.chunk(2) noise_pred_uncond, noise_pred_text = noise_pred.chunk(2)
noise_pred = noise_pred_uncond + guidance_scale * (noise_pred_text - noise_pred_uncond) noise_pred = noise_pred_text + guidance_scale * (noise_pred_text - noise_pred_uncond)
# w(t), sigma_t^2 # w(t), sigma_t^2
w = 1 - self.alphas[t] w = 1 - self.alphas[t]
@@ -266,7 +266,7 @@ class StableDiffusion(nn.Module):
# perform guidance # perform guidance
noise_pred_uncond, noise_pred_text = noise_pred.chunk(2) noise_pred_uncond, noise_pred_text = noise_pred.chunk(2)
noise_pred = noise_pred_uncond + guidance_scale * (noise_pred_text - noise_pred_uncond) noise_pred = noise_pred_text + guidance_scale * (noise_pred_text - noise_pred_uncond)
# compute the previous noisy sample x_t -> x_t-1 # compute the previous noisy sample x_t -> x_t-1
latents = self.scheduler.step(noise_pred, t, latents)["prev_sample"] # type: ignore latents = self.scheduler.step(noise_pred, t, latents)["prev_sample"] # type: ignore