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

Avoid dummy token in PLD to optimize performance #29445

Merged
merged 1 commit into from
Mar 6, 2024

Conversation

ofirzaf
Copy link
Contributor

@ofirzaf ofirzaf commented Mar 4, 2024

What does this PR do?

Current PLD implementation adds a dummy token in case there is no match found in the prompt to avoid issues. In previous PR #28508 the code was fixed to handle zero candidate tokens so there is no need for the dummy token in PLD now. Not inserting this additional token can accelerate PDL on weaker HW where doing inference with the target with 2 tokens is significantly slower than doing inference with 1 token.

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline,
    Pull Request section?
  • Was this discussed/approved via a Github issue or the forum? Please add a link
    to it if that's the case.
  • Did you make sure to update the documentation with your changes? Here are the
    documentation guidelines, and
    here are tips on formatting docstrings.
  • Did you write any new necessary tests?

@gante

Copy link
Member

@gante gante left a comment

Choose a reason for hiding this comment

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

@ofirzaf Thank you for the optimization!

For future reference, could you share your test script (ideally paired up with the output numbers in your hardware)?

@gante gante requested a review from ArthurZucker March 5, 2024 13:55
Copy link
Collaborator

@ArthurZucker ArthurZucker 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 thanks for following up on this

@ofirzaf
Copy link
Contributor Author

ofirzaf commented Mar 6, 2024

@gante I am unable to share my measurements since I am working on HW that wasn't released yet. Is it blocking the merge?

@gante
Copy link
Member

gante commented Mar 6, 2024

@ofirzaf no :) I'm going to merge the PR

In any case, if you have the script to reproduce your measurements, it would be a nice addition

@gante gante merged commit 0a5b051 into huggingface:main Mar 6, 2024
20 checks passed
damithsenanayake pushed a commit to damithsenanayake/transformers that referenced this pull request Mar 7, 2024
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