-
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
Cache: use batch_size
instead of max_batch_size
#32657
Conversation
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. |
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.
Great, thanks for making it clearer!
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 updating, we could keep the name and make sure the description is better as well!
if max_batch_size is not None: | ||
logger.warning_once( | ||
f"The 'max_batch_size' argument of {self.__class__.__name__} is deprecated and will be removed in " | ||
"v4.46. Use the more precisely named 'batch_size' argument instead." | ||
) | ||
|
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.
code on the hub will complain but yes it makes sense
Co-authored-by: Arthur <[email protected]>
What does this PR do?
Renames the input argument
max_batch_size
, present in static-shaped caches, tobatch_size
.max_batch_size
is imprecise: the cache needs the EXACT batch size being used.The imprecise variable name and description was a source of issues, e.g. here.
NOTE: while it is technically feasible to accept smaller batch sizes in static-shaped caches, we would be slicing the cache at each layer. Slicing is an expensive operation, and the point of using static-shaped caches is to be fast. In other words, we would be enabling a silent incorrect usage of the class 🤗
✅ all chances are backwards compatible, and the user will only see a warning if passing the batch size through the deprecated keyword argument