-
-
Notifications
You must be signed in to change notification settings - Fork 11k
[BugFix][ModelRunner] properly handle unused buffer #25380
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1084,6 +1084,8 @@ def _prepare_inputs( | |
| logits_indices = query_start_loc[1:] - 1 | ||
| num_draft_tokens = None | ||
| spec_decode_metadata = None | ||
| self.num_draft_tokens.gpu = None | ||
| self.num_accepted_tokens.gpu = None | ||
|
Comment on lines
+1087
to
+1088
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Setting To fix this, you should ensure the GPU tensors are re-initialized if they are For example, in the if self.num_draft_tokens.gpu is None:
self.num_draft_tokens.gpu = self.num_draft_tokens.cpu.to(self.device)
self.num_draft_tokens.copy_to_gpu()And similarly for if self.num_accepted_tokens.gpu is None:
self.num_accepted_tokens.gpu = self.num_accepted_tokens.cpu.to(self.device)
self.num_accepted_tokens.copy_to_gpu()Without this change, this PR introduces a latent bug that can cause crashes in mixed speculative/non-speculative workloads. |
||
| else: | ||
| # Get the number of draft tokens for each request. | ||
| # Iterate over the dictionary rather than all requests since not all | ||
|
|
||
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.
I prefer to change in init function for
num_decode_draft_tokensandnum_accepted_tokensThere 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.
yep that's what I was suggesting
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 suggestion. I need confirm this using my workload. Will update soon.