Skip to content

Conversation

@fboulnois
Copy link
Contributor

This standardizes the use of the argument image in all pipelines instead of a mix of init_image and image.

Resolves #1257

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Nov 21, 2022

The documentation is not available anymore as the PR was closed or merged.

@fboulnois fboulnois force-pushed the switch-init-image-arg branch from 37d4299 to ce1fd9f Compare November 21, 2022 19:06
@fboulnois fboulnois changed the title Standardize on using image in all pipelines Standardize on using image argument in all pipelines Nov 21, 2022
@fboulnois fboulnois marked this pull request as ready for review November 21, 2022 19:13
@fboulnois fboulnois force-pushed the switch-init-image-arg branch from 013aced to 2f84003 Compare November 21, 2022 19:52
def __call__(
self,
init_image: Union[torch.Tensor, PIL.Image.Image],
image: Union[torch.Tensor, PIL.Image.Image],
Copy link
Contributor

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:

  1. 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

Copy link
Contributor

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 :-)

Copy link
Contributor

@patrickvonplaten patrickvonplaten left a 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 :-)

@fboulnois fboulnois force-pushed the switch-init-image-arg branch from 2f84003 to 2656a78 Compare November 28, 2022 17:52
@fboulnois
Copy link
Contributor Author

@patrickvonplaten Done! Rebased on main, added deprecation warnings to community and core pipelines, and all tests pass.

(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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great!

Copy link
Contributor

@patrickvonplaten patrickvonplaten left a 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 :-)

@patrickvonplaten patrickvonplaten merged commit 52eb034 into huggingface:main Dec 1, 2022
@fboulnois fboulnois deleted the switch-init-image-arg branch December 1, 2022 16:04
tcapelle pushed a commit to tcapelle/diffusers that referenced this pull request Dec 12, 2022
)

* feat: switch core pipelines to use image arg

* test: update tests for core pipelines

* feat: switch examples to use image arg

* docs: update docs to use image arg

* style: format code using black and doc-builder

* fix: deprecate use of init_image in all pipelines
sliard pushed a commit to sliard/diffusers that referenced this pull request Dec 21, 2022
)

* feat: switch core pipelines to use image arg

* test: update tests for core pipelines

* feat: switch examples to use image arg

* docs: update docs to use image arg

* style: format code using black and doc-builder

* fix: deprecate use of init_image in all pipelines
yoonseokjin pushed a commit to yoonseokjin/diffusers that referenced this pull request Dec 25, 2023
)

* feat: switch core pipelines to use image arg

* test: update tests for core pipelines

* feat: switch examples to use image arg

* docs: update docs to use image arg

* style: format code using black and doc-builder

* fix: deprecate use of init_image in all pipelines
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.

Standardize on init_image for img2img, inpaint, and others

3 participants