From 7c1b347702c17f282f5da4d41d68e9fdeb7908fa Mon Sep 17 00:00:00 2001 From: qwjaskzxl <870384605@qq.com> Date: Wed, 15 Mar 2023 00:10:35 +0800 Subject: [PATCH] Update README.md (#2653) * Update README.md fix 2 bugs: (1) "previous_noisy_sample" should be in the FOR loop in line 87; (2) converting image to INT should be before "Image.fromarray" in line 91 * Apply suggestions from code review --------- Co-authored-by: Patrick von Platen --- README.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 6f829bba3a..22998e9fcf 100644 --- a/README.md +++ b/README.md @@ -84,13 +84,12 @@ input = noise for t in scheduler.timesteps: with torch.no_grad(): noisy_residual = model(input, t).sample - -previous_noisy_sample = scheduler.step(noisy_residual, t, input).prev_sample -input = previous_noisy_sample + prev_noisy_sample = scheduler.step(noisy_residual, t, input).prev_sample + input = prev_noisy_sample image = (input / 2 + 0.5).clamp(0, 1) image = image.cpu().permute(0, 2, 3, 1).numpy()[0] -image = Image.fromarray((image * 255)).round().astype("uint8") +image = Image.fromarray((image * 255).round().astype("uint8")) image ```