-
Notifications
You must be signed in to change notification settings - Fork 27.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 cache_position
initialisation for generation with use_cache=False
#30485
Fix cache_position
initialisation for generation with use_cache=False
#30485
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.
Thanks! Let's maybe avoid relying on the model's cache position initialization !
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.
LGTM, thank you for the fix 👍
@ArthurZucker tbh, when we have use_cache=False
, we shouldn't even be creating or using cache_positions
at all (as the name of the variable indicates, its purpose is cache-related). ATM, the only dependency is the causal mask creation function, which uses cache_positions
as a proxy for the sequence length (i.e. we can easily rearrange the code to avoid using it when there is no cache :) )
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.
Yes @gante, agreed would split both paths a bit better
Can you just rebase on main? 🤗 |
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. |
Co-authored-by: Arthur <48595927+ArthurZucker@users.noreply.github.com>
7b9c0ba
to
e1b1c10
Compare
@ArthurZucker , done ✔️ |
Thanks 🤗 |
What does this PR do?
Fixes #30482
Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
@ArthurZucker @younesbelkada @gante