-
Notifications
You must be signed in to change notification settings - Fork 546
[Cherry-pick] PRs #1975 #2076 #2071 #2093 #2084 #2115 #2133 #2146 #2064 #2159 #2112 #2179
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
Changes from all commits
9aa05fe
ae88d67
0a34b32
453f706
92c5ce4
354a358
dc5dea3
114961a
d9d1bf5
903b95d
b0a4347
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,6 +14,7 @@ | |
| # limitations under the License. | ||
|
|
||
| import dataclasses | ||
| import warnings | ||
| from collections.abc import Callable | ||
| from typing import Any | ||
|
|
||
|
|
@@ -66,6 +67,7 @@ def calibrate_loop(model: Any) -> None: | |
| NewRequestData, | ||
| req_id=req_id, | ||
| prompt_token_ids=input_ids_list, | ||
| prefill_token_ids=input_ids_list, | ||
| mm_kwargs=[], | ||
| mm_hashes=[], | ||
| mm_positions=[], | ||
|
|
@@ -95,10 +97,39 @@ def calibrate_loop(model: Any) -> None: | |
| structured_output_request_ids={}, | ||
| grammar_bitmask=None, | ||
| ) | ||
| output = self.execute_model(scheduler_output) | ||
| if hasattr(self, "sample_tokens"): | ||
| if output is None: # TODO: make this default when vllm <= 0.11 is outdated | ||
| self.sample_tokens(None) | ||
| try: | ||
| output = self.execute_model(scheduler_output) | ||
| if hasattr(self, "sample_tokens"): | ||
| if output is None: # TODO: make this default when vllm <= 0.11 is outdated | ||
| self.sample_tokens(None) | ||
| finally: | ||
| # finish_requests runs before add_requests inside execute_model, so | ||
| # req IDs aren't registered yet at that point — call it directly after. | ||
| # Wrap in try/except so a cleanup error never masks the original exception. | ||
| try: | ||
| if hasattr(self.model_runner, "finish_requests"): | ||
| cleanup_output = _create_new_data_cls( | ||
| type(scheduler_output), | ||
| scheduled_new_reqs=[], | ||
| scheduled_cached_reqs=scheduler_output.scheduled_cached_reqs, | ||
| num_scheduled_tokens={}, | ||
| total_num_scheduled_tokens=0, | ||
| scheduled_spec_decode_tokens={}, | ||
| scheduled_encoder_inputs={}, | ||
| num_common_prefix_blocks=scheduler_output.num_common_prefix_blocks, | ||
| finished_req_ids=set(num_scheduled_tokens.keys()), | ||
| free_encoder_mm_hashes=[], | ||
| kv_connector_metadata=None, | ||
| structured_output_request_ids={}, | ||
| grammar_bitmask=None, | ||
| ) | ||
| self.model_runner.finish_requests(cleanup_output) | ||
| else: | ||
| warnings.warn( | ||
| "model_runner.finish_requests not found; request state may leak during calibration." | ||
| ) | ||
| except Exception: | ||
| warnings.warn("Failed to clean up request state after calibration batch.") | ||
|
Comment on lines
+105
to
+132
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. 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win Fail calibration when request cleanup fails after a successful batch. If Preserve an exception from 🤖 Prompt for AI Agents |
||
|
|
||
| return calibrate_loop | ||
|
|
||
|
|
||
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.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
Do not make the complete workspace world-writable.
Line 34 makes
Model-Optimizerwritable by every container user. A second process can modify editable Python source or cached extensions before thevllmprocess imports them.Use
chown -R vllm:vllm /workspaceand grant write access only to/workspace/torch_extensionsif required.🤖 Prompt for AI Agents