-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Add support for different model prediction types in DDIMInverseScheduler #2619
Add support for different model prediction types in DDIMInverseScheduler #2619
Conversation
00bab47
to
fcee91a
Compare
The documentation is not available anymore as the PR was closed or merged. |
Resolve alpha_prod_t_prev index issue for final step of inversion
2b7a9dc
to
3d93466
Compare
37f3096
to
01747ff
Compare
Derive predicted noise from model output before dist. regularization Style cleanup
01747ff
to
1a0c13c
Compare
This reverts commit 76ea9c8.
…improve-ddim-inverse
@patrickvonplaten |
Thanks so much! What's pending in this PR? Maybe we should mention
in the Pix2PixZero docs? |
src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_pix2pix_zero.py
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for working on this!
I see some non-trivial changes in the scheduler script. Do you mind elaborating a bit more on those?
@sayakpaul I just need to add new tests for Pix2Pix Zero with Stable Diffusion V2, which require uploading target images that are slightly different from what exists for current tests, but which are semantically and stylistically nearly identical. |
Sure, thanks for letting us know! Let us know if we can help in unblocking anything for you here. |
256042e
to
f029a4e
Compare
@sayakpaul @patrickvonplaten In order to upload expected results for a Pix2PixZero slow test with SD 2, I need to update the following repo: |
src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_pix2pix_zero.py
Show resolved
Hide resolved
tests/pipelines/stable_diffusion/test_stable_diffusion_pix2pix_zero.py
Outdated
Show resolved
Hide resolved
tests/pipelines/stable_diffusion/test_stable_diffusion_pix2pix_zero.py
Outdated
Show resolved
Hide resolved
def test_stable_diffusion_2_pix2pix_full(self): | ||
# numpy array of https://huggingface.co/datasets/hf-internal-testing/diffusers-images/blob/main/pix2pix/dog_2.png | ||
expected_image = load_numpy( | ||
"https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/pix2pix/dog_2.npy" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this needs to be in https://huggingface.co/datasets/hf-internal-testing/diffusers-images/tree/main/pix2pix? Feel free to open a PR to the repository to add it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, could you maybe open a PR to add the numpy image? This would be very nice!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://huggingface.co/datasets/hf-internal-testing/diffusers-images/discussions/10
Can't currently publish due to rate limiting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for opening it - merged it!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we're in a very good shape to merge this. Thanks so much for this important PR :)
Yeah feel free to open a PR to https://huggingface.co/datasets/hf-internal-testing/diffusers-images following instructions from https://huggingface.co/datasets/hf-internal-testing/diffusers-images/discussions (Click on "New pull request" and follow the instructions). |
tests/pipelines/stable_diffusion/test_stable_diffusion_pix2pix_zero.py
Outdated
Show resolved
Hide resolved
tests/pipelines/stable_diffusion/test_stable_diffusion_pix2pix_zero.py
Outdated
Show resolved
Hide resolved
Great work @clarencechen - thanks! |
…ler (huggingface#2619) * Add support for different model prediction types in DDIMInverseScheduler Resolve alpha_prod_t_prev index issue for final step of inversion * Fix old bug introduced when prediction type is "sample" * Add support for sample clipping for numerical stability and deprecate old kwarg * Detach sample, alphas, betas Derive predicted noise from model output before dist. regularization Style cleanup * Log loss for debugging * Revert "Log loss for debugging" This reverts commit 76ea9c8. * Add comments * Add inversion equivalence test * Add expected data for Pix2PixZero pipeline tests with SD 2 * Update tests/pipelines/stable_diffusion/test_stable_diffusion_pix2pix_zero.py * Remove cruft and add more explanatory comments --------- Co-authored-by: Patrick von Platen <[email protected]>
…ler (huggingface#2619) * Add support for different model prediction types in DDIMInverseScheduler Resolve alpha_prod_t_prev index issue for final step of inversion * Fix old bug introduced when prediction type is "sample" * Add support for sample clipping for numerical stability and deprecate old kwarg * Detach sample, alphas, betas Derive predicted noise from model output before dist. regularization Style cleanup * Log loss for debugging * Revert "Log loss for debugging" This reverts commit 76ea9c8. * Add comments * Add inversion equivalence test * Add expected data for Pix2PixZero pipeline tests with SD 2 * Update tests/pipelines/stable_diffusion/test_stable_diffusion_pix2pix_zero.py * Remove cruft and add more explanatory comments --------- Co-authored-by: Patrick von Platen <[email protected]>
…ler (huggingface#2619) * Add support for different model prediction types in DDIMInverseScheduler Resolve alpha_prod_t_prev index issue for final step of inversion * Fix old bug introduced when prediction type is "sample" * Add support for sample clipping for numerical stability and deprecate old kwarg * Detach sample, alphas, betas Derive predicted noise from model output before dist. regularization Style cleanup * Log loss for debugging * Revert "Log loss for debugging" This reverts commit 76ea9c8. * Add comments * Add inversion equivalence test * Add expected data for Pix2PixZero pipeline tests with SD 2 * Update tests/pipelines/stable_diffusion/test_stable_diffusion_pix2pix_zero.py * Remove cruft and add more explanatory comments --------- Co-authored-by: Patrick von Platen <[email protected]>
Resolve
alpha_prod_t_prev
index issue for final step of inversion@patrickvonplaten TODO: Update numerical tests to reflect two more steps of inversion