-
-
Notifications
You must be signed in to change notification settings - Fork 11.7k
[V1] Aggregate chunked prompt logprobs in model runner #14875
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
Merged
robertgshaw2-redhat
merged 9 commits into
vllm-project:main
from
njhill:agg-prompt-logprob-chunks
Mar 24, 2025
Merged
Changes from 4 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
0d450f8
[V1] Aggregate prompt logprobs in model runner
njhill 59e10c0
fix dtype
njhill 3a3deb1
Fix edge case
njhill 34daab3
Merge remote-tracking branch 'refs/remotes/origin/main' into agg-prom…
njhill b9d1873
Merge remote-tracking branch 'origin/main' into agg-prompt-logprob-ch…
njhill 931d7e4
add comment per review
njhill 196f1a9
Merge remote-tracking branch 'origin/main' into agg-prompt-logprob-ch…
njhill fec7927
address review comments
njhill acbbfc0
move LogprobsTensors construction to static method
njhill File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -100,15 +100,8 @@ def update_from_output(self, output: "EngineCoreOutput", | |
| num_new_generation_tokens = len(output.new_token_ids) | ||
|
|
||
| self.num_generation_tokens += num_new_generation_tokens | ||
| if is_prefilling and num_new_generation_tokens > 0: | ||
| # TODO(andy): we used to assert that num_new_generation_tokens | ||
| # > 0 with an invariant that EngineCore does not stream outputs | ||
| # for partially completed prefills (scheduler.update_from_output | ||
| # makes EngineCoreOutput iff num_computed_tokens == num_tokens). | ||
| # When prompt logprobs are enabled, we currently stream out the | ||
| # partially completed prompt. | ||
| # This will be reverted in a follow up PR and we should re-enable | ||
| # this assertion / invariant. | ||
| if is_prefilling: | ||
|
Contributor
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. Might want @markmc 's review on stats, although this all looks good to me. |
||
| assert num_new_generation_tokens > 0 | ||
| self.num_prompt_tokens += prompt_len | ||
|
|
||
| first_token_latency = self._time_since(req_stats.arrival_time) | ||
|
|
@@ -123,16 +116,12 @@ def update_from_output(self, output: "EngineCoreOutput", | |
|
|
||
| # Process the batch-level "new tokens" engine core event | ||
| if is_prefilling: | ||
| # TODO: re-enable no-output-for-partial-prefills invariant as above | ||
| if num_new_generation_tokens > 0: | ||
| req_stats.first_token_ts = engine_core_timestamp | ||
| req_stats.first_token_ts = engine_core_timestamp | ||
| else: | ||
| tpot = engine_core_timestamp - req_stats.last_token_ts | ||
| self.time_per_output_tokens_iter.append(tpot) | ||
|
|
||
| # TODO: re-enable no-output-for-partial-prefills invariant as above | ||
| if num_new_generation_tokens > 0: | ||
| req_stats.last_token_ts = engine_core_timestamp | ||
| req_stats.last_token_ts = engine_core_timestamp | ||
|
|
||
| def update_from_events(self, req_id: str, events: list["EngineCoreEvent"], | ||
| is_prefilling: bool, req_stats: RequestStateStats, | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.