-
-
Notifications
You must be signed in to change notification settings - Fork 11.7k
[Core][Feature] Input metadata dump on crash #13407
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
Merged
Changes from 26 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
b8d2fa0
[Core][Feature] Input metadata dump on crash
wallashss 08c9f15
fix: mypy complaints
wallashss 0ef83a8
fix: mypy complaints
wallashss 84fe0af
Merge branch 'main' into dump-input-on-crash
wallashss d8f75b7
fix: dump report
wallashss d588fff
fix server hang on shutdown
wallashss 58cd9c9
Merge branch 'main' into dump-input-on-crash
wallashss 4eafa5e
Merge branch 'main' of github.com:wallashss/vllm into dump-input-on-c…
wallashss e3d945f
Merge branch 'main' into dump-input-on-crash
wallashss ea544f1
review feedback
wallashss 63f24ab
moved vllm/error_report.py to vllm/logging_utils/dump_input.py
wallashss 7d405d4
refact for review
wallashss b4a83eb
refactoring
wallashss 02e1673
refactoring
wallashss 6fe83ca
Merge branch 'main' into dump-input-on-crash
wallashss f66489d
fix lint
wallashss 5f82648
reverted change on llm_engine due to test
wallashss 93ae6dc
fix: ensure suppress exception in dump
wallashss 1320c87
Merge branch 'main' into dump-input-on-crash
wallashss 9764218
Merge branch 'main' into dump-input-on-crash
wallashss 80b9751
Merge branch 'main' into dump-input-on-crash
wallashss 3384055
feat: removed v0
wallashss 2f72a2f
Merge branch 'main' of github.com:wallashss/vllm into dump-input-on-c…
wallashss ad368f1
removed v0 support
wallashss 7c18e20
refact: code clean up
wallashss 94fa3fc
Merge branch 'main' of github.com:wallashss/vllm into dump-input-on-c…
wallashss 307d3cf
Merge branch 'main' into dump-input-on-crash
wallashss 8cbee30
refact: moved execute model to a separated method
wallashss 51596e4
Update vllm/v1/engine/core.py
wallashss 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| import contextlib | ||
| import enum | ||
| import json | ||
| from typing import Optional | ||
|
|
||
| import torch | ||
|
|
||
| from vllm.config import VllmConfig | ||
| from vllm.logger import init_logger | ||
| from vllm.v1.core.sched.output import SchedulerOutput | ||
| from vllm.v1.metrics.stats import SchedulerStats | ||
| from vllm.version import __version__ as VLLM_VERSION | ||
|
|
||
| logger = init_logger(__name__) | ||
|
|
||
|
|
||
| def prepare_object_to_dump(obj) -> str: | ||
| if isinstance(obj, str): | ||
| return "'{obj}'" # Double quotes | ||
| elif isinstance(obj, dict): | ||
| dict_str = ', '.join({f'{str(k)}: {prepare_object_to_dump(v)}' \ | ||
| for k, v in obj.items()}) | ||
| return f'{{{dict_str}}}' | ||
| elif isinstance(obj, list): | ||
| return f"[{', '.join([prepare_object_to_dump(v) for v in obj])}]" | ||
| elif isinstance(obj, set): | ||
| return f"[{', '.join([prepare_object_to_dump(v) for v in list(obj)])}]" | ||
| # return [prepare_object_to_dump(v) for v in list(obj)] | ||
| elif isinstance(obj, tuple): | ||
| return f"[{', '.join([prepare_object_to_dump(v) for v in obj])}]" | ||
| elif isinstance(obj, enum.Enum): | ||
| return repr(obj) | ||
| elif isinstance(obj, torch.Tensor): | ||
| # We only print the 'draft' of the tensor to not expose sensitive data | ||
| # and to get some metadata in case of CUDA runtime crashed | ||
| return (f"Tensor(shape={obj.shape}, " | ||
| f"device={obj.device}," | ||
| f"dtype={obj.dtype})") | ||
| elif hasattr(obj, 'anon_repr'): | ||
| return obj.anon_repr() | ||
| elif hasattr(obj, '__dict__'): | ||
| items = obj.__dict__.items() | ||
| dict_str = ','.join([f'{str(k)}={prepare_object_to_dump(v)}' \ | ||
| for k, v in items]) | ||
| return (f"{type(obj).__name__}({dict_str})") | ||
| else: | ||
| # Hacky way to make sure we can serialize the object in JSON format | ||
| try: | ||
| return json.dumps(obj) | ||
| except (TypeError, OverflowError): | ||
| return repr(obj) | ||
|
|
||
|
|
||
| def dump_engine_exception(config: VllmConfig, | ||
| scheduler_output: SchedulerOutput, | ||
| scheduler_stats: Optional[SchedulerStats]): | ||
| # NOTE: ensure we can log extra info without risking raises | ||
| # unexpected errors during logging | ||
| with contextlib.suppress(BaseException): | ||
| _dump_engine_exception(config, scheduler_output, scheduler_stats) | ||
|
|
||
|
|
||
| def _dump_engine_exception(config: VllmConfig, | ||
| scheduler_output: SchedulerOutput, | ||
| scheduler_stats: Optional[SchedulerStats]): | ||
| logger.error("Dumping input data") | ||
|
|
||
| logger.error( | ||
| "V1 LLM engine (v%s) with config: %s, ", | ||
| VLLM_VERSION, | ||
| config, | ||
| ) | ||
|
|
||
| try: | ||
| dump_obj = prepare_object_to_dump(scheduler_output) | ||
| logger.error("Dumping scheduler output for model execution:") | ||
| logger.error(dump_obj) | ||
| if scheduler_stats: | ||
| logger.error(scheduler_stats) | ||
| except BaseException as exception: | ||
| logger.error("Error preparing object to dump") | ||
| logger.error(repr(exception)) |
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.