Skip to content
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

update StableDiffusion3Img2ImgPipeline.add image size validation #10166

Merged
merged 8 commits into from
Dec 12, 2024

Conversation

ZHJ19970917
Copy link
Contributor

What does this PR do?

Fixes #10153
Add support for height and width parameters in the call() method of the StableDiffusion3Img2ImgPipeline. Users can specify the output image size by providing these parameters. Additionally, implement input validation for height and width.

Referencing StableDiffusion3Pipeline, if height and width are not provided, default sizes should be calculated as:

height = height or self.default_sample_size * self.vae_scale_factor
width = width or self.default_sample_size * self.vae_scale_factor

instead of using the dimensions of the input image by default. This prevents errors in vector calculations caused by incompatible height and width values from the input image.

Before submitting

Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

Copy link
Collaborator

@hlky hlky left a comment

Choose a reason for hiding this comment

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

Thanks @ZHJ19970917! I've ran make style, and the only suggestion is to use keyword args to be consistent with other pipelines usage of self.image_processor.preprocess

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Copy link
Collaborator

@hlky hlky left a comment

Choose a reason for hiding this comment

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

We also need to replicate these changes to src/diffusers/pipelines/pag/pipeline_pag_sd_3_img2img.py and src/diffusers/pipelines/stable_diffusion_3/pipeline_stable_diffusion_3_inpaint.py due to Copied from

@ZHJ19970917
Copy link
Contributor Author

ok,I will replicate these changes to src/diffusers/pipelines/pag/pipeline_pag_sd_3_img2img.py and src/diffusers/pipelines/stable_diffusion_3/pipeline_stable_diffusion_3_inpaint.py

@yiyixuxu yiyixuxu merged commit bdbaea8 into huggingface:main Dec 12, 2024
12 checks passed
@yiyixuxu
Copy link
Collaborator

thanks @ZHJ19970917 and @hlky !

sayakpaul pushed a commit that referenced this pull request Dec 23, 2024
)

* update StableDiffusion3Img2ImgPipeline.add image size validation

---------

Co-authored-by: hlky <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants