-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
fix num_assistant_tokens with heuristic schedule #28759
fix num_assistant_tokens with heuristic schedule #28759
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the fix and the tests 💛
Co-authored-by: Joao Gante <[email protected]>
Co-authored-by: Joao Gante <[email protected]>
check that candidate_generator.assistant_model exists since some some speculations (like ngram and PLD) don't have assistant_model attribute
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR!
Co-authored-by: Arthur <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding this!
For the code quality checks, you'll need to run make fixup
and push the changes.
From the docstring, it mentions behaviour about `"heuristic_transient" being reset, but I don't see logic relating to it in this diff. Does this already happen?
Co-authored-by: amyeroberts <[email protected]>
…transformers into fix_num_assistant_tokens
I just fixed docstring |
@jmamou Let's try and make the CI green :) You'll need to resolve the quality checks by running For the other failing tests, you'll need to try rebasing on main. |
@amyeroberts |
@jmamou Tbh, I'm not sure what the cause of these failures are. I would first suggest rebasing on main to make sure you have all of the most recent commits. This will trigger a re-run of the CI too. |
@amyeroberts |
@amyeroberts both CI failures seem unrelated to this PR, including |
@amyeroberts |
@jmamou Thanks for this contribution and your patience with our misbehaving CI! |
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. |
* fix heuristic num_assistant_tokens_schedule * Update src/transformers/generation/configuration_utils.py Co-authored-by: Joao Gante <[email protected]> * Update src/transformers/generation/candidate_generator.py Co-authored-by: Joao Gante <[email protected]> * Update utils.py check that candidate_generator.assistant_model exists since some some speculations (like ngram and PLD) don't have assistant_model attribute * Update src/transformers/generation/candidate_generator.py Co-authored-by: Arthur <[email protected]> * Update tests/generation/test_utils.py Co-authored-by: amyeroberts <[email protected]> * make fixup * merge conflict * fix docstring * make fixup --------- Co-authored-by: Joao Gante <[email protected]> Co-authored-by: Arthur <[email protected]> Co-authored-by: amyeroberts <[email protected]>
* fix heuristic num_assistant_tokens_schedule * Update src/transformers/generation/configuration_utils.py Co-authored-by: Joao Gante <[email protected]> * Update src/transformers/generation/candidate_generator.py Co-authored-by: Joao Gante <[email protected]> * Update utils.py check that candidate_generator.assistant_model exists since some some speculations (like ngram and PLD) don't have assistant_model attribute * Update src/transformers/generation/candidate_generator.py Co-authored-by: Arthur <[email protected]> * Update tests/generation/test_utils.py Co-authored-by: amyeroberts <[email protected]> * make fixup * merge conflict * fix docstring * make fixup --------- Co-authored-by: Joao Gante <[email protected]> Co-authored-by: Arthur <[email protected]> Co-authored-by: amyeroberts <[email protected]>
What does this PR do?
We have defined 2 different num_assistant_tokens_schedule values:
heuristic
: When all speculative tokens are correct, increasenum_assistant_tokens
by 2 else reduce by 1.num_assistant_tokens
value is persistent over multiple generation calls with the same assistant model.heuristic_transient
: Same as"heuristic
butnum_assistant_tokens
is reset to its initial value after each generation call.Fixes # (issue)
#27979 (comment)
Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
@gante @amyeroberts