Correct timestep for img2img initial noise addition#1946
Merged
lstein merged 4 commits intoinvoke-ai:mainfrom Dec 15, 2022
wfng92:patch-3
Merged
Correct timestep for img2img initial noise addition#1946lstein merged 4 commits intoinvoke-ai:mainfrom wfng92:patch-3
lstein merged 4 commits intoinvoke-ai:mainfrom
wfng92:patch-3
Conversation
Collaborator
|
Thanks so much for finding this problem. I will test it out the proposed solution later today. |
lstein
approved these changes
Dec 12, 2022
Collaborator
lstein
left a comment
There was a problem hiding this comment.
Thank you for finding and fixing this. I have applied your fix to the inpaint and txt2img2img paths as well.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There seems to be difference between huggingface's diffusers and compvis's implementation for img2img as the wrong timestep is used for the additive noise for image-2-image.
Summary from the relevant PR raised by the HuggingFace team:
From
to
For example, using the following
init_imgand configuration:prompt: A fantasy landscape, trending on artstationstrength: 0.1seed: 42sampler_name: DDIMsteps: 10The existing code will generate an image with the following noise:
The new implementation will produce an image with lesser noise:
This PR affects only the img2img script. I realized that text2img2img and inpainting share the same code base but I am not sure if the same implementation should be applied as well.