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
Standardize on using image
argument in all pipelines
#1361
Standardize on using image
argument in all pipelines
#1361
Conversation
The documentation is not available anymore as the PR was closed or merged. |
37d4299
to
ce1fd9f
Compare
image
in all pipelinesimage
argument in all pipelines
013aced
to
2f84003
Compare
@@ -66,7 +66,7 @@ def __init__( | |||
@torch.no_grad() | |||
def __call__( | |||
self, | |||
init_image: Union[torch.Tensor, PIL.Image.Image], | |||
image: Union[torch.Tensor, PIL.Image.Image], |
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.
we will have to deprecate init_image
here to not surprise the user here too much. Could you implement the same logic we're using for schedulers for all pipelines:
predict_epsilon = deprecate("predict_epsilon", "0.10.0", message, take_from=kwargs) |
Here would should do the following in addition to renaming init_image
to image
:
- Add a
**kwargs
argument to the function call
message = (
"Please make sure to use `image` instead of `init_image`."
)
init_image = deprecate("init_image", "0.12.0", message, take_from=kwargs)
image = init_image or image
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.
We should do this for all pipelines :-)
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.
Super nice PR @fboulnois !
Everything looks very nice to me except for deprecating init_image
correctly.
Could you try to implement https://github.com/huggingface/diffusers/pull/1361/files#r1033477098 for all pipelines (src/pipelines) + community?
Let me know if you need any help :-)
2f84003
to
2656a78
Compare
@patrickvonplaten Done! Rebased on main, added deprecation warnings to community and core pipelines, and all tests pass. |
@@ -540,6 +541,10 @@ def __call__( | |||
list of `bool`s denoting whether the corresponding generated image likely represents "not-safe-for-work" | |||
(nsfw) content, according to the `safety_checker`. | |||
""" | |||
message = "Please use `image` instead of `init_image`." | |||
init_image = deprecate("init_image", "0.12.0", message, take_from=kwargs) |
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.
great!
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.
Super clean! Great job @fboulnois 🥳
Merging :-)
This standardizes the use of the argument
image
in all pipelines instead of a mix ofinit_image
andimage
.Resolves #1257