Skip to content

Correct timestep for initial noise addition#533

Closed
patrickvonplaten wants to merge 1 commit intoCompVis:mainfrom
patrickvonplaten:patch-1
Closed

Correct timestep for initial noise addition#533
patrickvonplaten wants to merge 1 commit intoCompVis:mainfrom
patrickvonplaten:patch-1

Conversation

@patrickvonplaten
Copy link
Copy Markdown
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
Copy Markdown
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