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

[Doc] Improved level of clarity for latents_to_rgb. #9529

Merged
merged 3 commits into from
Sep 25, 2024
Merged

[Doc] Improved level of clarity for latents_to_rgb. #9529

merged 3 commits into from
Sep 25, 2024

Conversation

LagPixelLOL
Copy link
Contributor

What does this PR do?

This PR fixes the latents_to_rgb function in the doc which will result in an error because the function only gets the first channel then performs permutation on 3 channels.

Before submitting

Who can review?

@stevhliu @sayakpaul

@sayakpaul sayakpaul requested a review from asomoza September 25, 2024 09:21
@asomoza
Copy link
Member

asomoza commented Sep 25, 2024

can you please post and example of why the old version would fail? Apart from reducing LoC I see that you just pass the latents without the batch dimension.

Just to clarify, I think your version is good but I'm curious as to why do you say it fails before.

@LagPixelLOL
Copy link
Contributor Author

LagPixelLOL commented Sep 25, 2024

Oh I think it's an error on my part, I was passing without batch dim to the function before, since I assumed as the function returns only a single image, it should only accept a single latent as the input. It will result in an error at the image_array = image_array.transpose(1, 2, 0) line with an error message of ValueError: axes don't match array.

I just tested with passing in with the batch dim and it will run successfully.

This PR still do improve LoC by only accepting without batch and returning a single image, as I got confused by the input value and assumed the function contains an error.

@LagPixelLOL LagPixelLOL changed the title Fixed latents_to_rgb doc. [Doc] Improved level of clarity for latents_to_rgb. Sep 25, 2024
@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.

@asomoza
Copy link
Member

asomoza commented Sep 25, 2024

thanks for explaining, LGTM, I will merge it when the tests pass.

@asomoza asomoza merged commit aa3c46d into huggingface:main Sep 25, 2024
1 check passed
@LagPixelLOL LagPixelLOL deleted the fix-latents_to_rgb-doc branch September 26, 2024 09:42
leisuzz pushed a commit to leisuzz/diffusers that referenced this pull request Oct 11, 2024
Fixed latents_to_rgb doc.

Co-authored-by: Álvaro Somoza <[email protected]>
sayakpaul pushed a commit that referenced this pull request Dec 23, 2024
Fixed latents_to_rgb doc.

Co-authored-by: Álvaro Somoza <[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
Development

Successfully merging this pull request may close these issues.

3 participants