-
Notifications
You must be signed in to change notification settings - Fork 31.5k
Reduce vRAM usage during generation by allowing to transfer logits to CPU #40870
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
base: main
Are you sure you want to change the base?
Reduce vRAM usage during generation by allowing to transfer logits to CPU #40870
Conversation
| @@ -0,0 +1,123 @@ | |||
| """ | |||
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.
(This script will of course be deleted before merging)
|
Thank you for the rapid response to the request! Since we’re at it, maybe it would be a good idea to do the same for output_attentions? |
Very fair point @YunruiZhang |
|
cc @gante |
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.
Please see my full reply here: #40794 (comment)
TL;DR the feature is desirable! But it will clash with an ongoing refactor, it will be much simpler if we add the feature after the refactor 💛
What
tests.generation.test_utils.test_offload_logits_to_cputo test non regressionHow to review
Testing performed
Benchmark
memory_test.pythat will be deleted before merging to showcase impactmax_new_tokens=1000: ~50% reduction of additional peak memory usage for <2% time overhead.