Skip to content

Correct timestep for initial noise addition #533

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

patrickvonplaten
Copy link
Contributor

After some experimentation, I am pretty sure that the wrong timestep is used for the additive noise for image-2-image.

Essentially what is happening here is that t+1 is used as the timestep to add noise to the original image, but [0, ..., t] is used afterwards for the denoising process. We should however also use t when adding the noise to the original image.

This can be quite easily verified by doing the following. Run a img2img with a small number of update steps and a very low strength because then differences between t and t+1 become quite clear.

E.g. when I run:

python scripts/img2img.py --prompt "A fantasy landscape, trending on artstation" --init-img ./sketch-mountains-input.jpg --strength 0.1 --seed 42 --n_samples 1 --ddim_steps 10

With the current code, I get the following output:
orig_sketch (1)

After the fix, I get some output which has much less noise, therefore showcasing that the noise addition and consecutive denoising process matches:
corr_sketch (1)

@patrickvonplaten
Copy link
Contributor Author

Closing because of inactivity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant