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

[docs/nits] Fix return values based on return_dict and minor doc updates #7105

Merged
merged 11 commits into from
Mar 9, 2024

Conversation

a-r-r-o-w
Copy link
Member

What does this PR do?

I noticed that the return_dict parameter was not correctly honored when output_type="latent" and have made corrections to the relevant pipelines based on what I believe is the expected behaviour.

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.

@DN6 @yiyixuxu

@@ -71,17 +71,14 @@ def tensor2vid(video: torch.Tensor, processor: "VaeImageProcessor", output_type:
for batch_idx in range(batch_size):
Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe this tensor2vid function could be moved into the utils folder because it has common use across multiple pipelines and there is yet to be a case where the implementation would be different? @ DN6

@yiyixuxu yiyixuxu requested a review from DN6 February 26, 2024 19:14
@yiyixuxu
Copy link
Collaborator

@DN6 can you take a look here?

outputs.append(batch_output)

if output_type == "np":
outputs = np.stack(outputs)

elif output_type == "pt":
elif output_type == "pt" or output_type == "latent":
Copy link
Collaborator

@yiyixuxu yiyixuxu Feb 26, 2024

Choose a reason for hiding this comment

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

how would the latent type output be used for animate diff?
can we pass them as input to this or another pipeline?

Copy link
Member Author

Choose a reason for hiding this comment

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

We already support latents as input to __call__ right? Animate vid2vid, pia, controlnet, etc. can use latents generated by other pipelines.

The main focus of this PR is to handle return_dict correctly because all pipelines here would return a class object when return_dict=False and output_type=latent , but the expected is a tuple. Since pt and latent are essentially the same output type, like the other pipelines, the extra if-statement doesn't make sense in post processing.

Copy link
Member Author

@a-r-r-o-w a-r-r-o-w Feb 26, 2024

Choose a reason for hiding this comment

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

I'm AFK for the next few hours so please hold on if this gets approved for merge 😔 The return_dict parameter is not properly implemented in the community pipelines of animatediff as well. This is causing some issues on a downstream repo, so making the behaviour consistent and fixing across all pipes here would be awesome.

@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

@DN6 DN6 left a comment

Choose a reason for hiding this comment

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

Looks good to me. Nice clean up 👍🏽

@sayakpaul
Copy link
Member

@a-r-r-o-w let's resolve the merge conflicts and ship it!

@a-r-r-o-w
Copy link
Member Author

@a-r-r-o-w let's resolve the merge conflicts and ship it!

Thanks, I believe this is ready 🤗

@sayakpaul
Copy link
Member

@DN6 @yiyixuxu okay to merge?

@yiyixuxu yiyixuxu merged commit cd6e1f1 into huggingface:main Mar 9, 2024
15 checks passed
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.

5 participants