Update README.md

This commit is contained in:
Patrick von Platen 2022-06-15 13:27:05 +02:00 committed by GitHub
parent cee56cc720
commit 97fcc4c6cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -98,7 +98,7 @@ num_prediction_steps = len(noise_scheduler)
for t in tqdm.tqdm(reversed(range(num_prediction_steps)), total=num_prediction_steps): for t in tqdm.tqdm(reversed(range(num_prediction_steps)), total=num_prediction_steps):
# predict noise residual # predict noise residual
with torch.no_grad(): with torch.no_grad():
residual = unet(image, t) residual = unet(image, t)
# predict previous mean of image x_t-1 # predict previous mean of image x_t-1
pred_prev_image = noise_scheduler.step(residual, image, t) pred_prev_image = noise_scheduler.step(residual, image, t)
@ -107,7 +107,7 @@ for t in tqdm.tqdm(reversed(range(num_prediction_steps)), total=num_prediction_s
variance = 0 variance = 0
if t > 0: if t > 0:
noise = torch.randn(image.shape, generator=generator).to(image.device) noise = torch.randn(image.shape, generator=generator).to(image.device)
variance = noise_scheduler.get_variance(t).sqrt() * noise variance = noise_scheduler.get_variance(t).sqrt() * noise
# set current image to prev_image: x_t -> x_t-1 # set current image to prev_image: x_t -> x_t-1
image = pred_prev_image + variance image = pred_prev_image + variance