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

[WIP] [tests] test encode_prompt() in isolation #10438

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

sayakpaul
Copy link
Member

@sayakpaul sayakpaul commented Jan 3, 2025

What does this PR do?

encode_prompt() is often used in isolation to lift off memory requirements and to also compute prompt embeddings in many trainers. It's important that we test encode_prompt() properly.

This PR adds a test suite to do that. Since we cannot reliably map the outputs of encode_prompt() into keyword arguments of a pipeline call, I propose to add a test class attribute called prompt_embed_kwargs to pack the prompt embeddings related kwargs appropriately.

This PR is a PoC of what the changes might look like at the test level.

Once we agree on the common structure I will propagate to the rest of the pipelines.

The closest test we have currently is this:

class SDXLOptionalComponentsTesterMixin:

But, IMO, this should be extended to the other pipelines on a more general basis.

TODOs

  • Propagate to the rest of the pipelines once we agree on the structure.
  • Fix encode_prompt() to work in isolation in the pipelines if needed.
  • Remove SDXLOptionalComponentsTesterMixin if needed.

@sayakpaul sayakpaul requested review from DN6 and hlky January 3, 2025 06:31
@sayakpaul
Copy link
Member Author

@hlky now that the PRs have been merged to support this, let's brainstorm if this is how we want to test encode_prompt()?

@sayakpaul
Copy link
Member Author

@DN6 a gentle ping.

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.

1 participant