-
Notifications
You must be signed in to change notification settings - Fork 287
fix(dynamo): multimodal chat processor, hybrid KV cache compat, subprocess env passthrough #2053
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
Open
praateekmahajan
wants to merge
2
commits into
NVIDIA-NeMo:main
Choose a base branch
from
praateekmahajan:praateek/dynamo-server-fixes
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
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 |
|---|---|---|
|
|
@@ -181,6 +181,11 @@ def aggregated_model_uses_exact_kv_events( | |
| return router_kv_events | ||
|
|
||
|
|
||
| def explicit_hybrid_kv_cache_manager_enabled(engine_kwargs: dict[str, Any]) -> bool: | ||
| """True when vLLM should receive ``--no-disable-hybrid-kv-cache-manager``.""" | ||
| return engine_kwargs.get("disable_hybrid_kv_cache_manager") is False | ||
|
|
||
|
|
||
| def build_worker_kv_events_config( | ||
| model_config: DynamoVLLMModelConfig, | ||
| *, | ||
|
|
@@ -189,13 +194,7 @@ def build_worker_kv_events_config( | |
| port_seed: int, | ||
| enabled: bool, | ||
| ) -> str: | ||
| """JSON blob for ``--kv-events-config``. | ||
|
|
||
| Always passed explicitly. Without this, Dynamo's ``args.py`` auto-creates | ||
| a ``KVEventsConfig`` bound to ``tcp://*:20080`` when ``prefix_caching`` is | ||
| enabled (vLLM >=0.16 default), causing every worker on the same node to | ||
| fight over the same port. | ||
| """ | ||
| """JSON blob for ``--kv-events-config`` when Curator chooses to pass one.""" | ||
| template = dict(model_config.kv_events_config) | ||
|
|
||
| if not enabled: | ||
|
|
@@ -321,13 +320,17 @@ def _launch_vllm_worker( # noqa: PLR0913 | |
| kv_events_enabled = is_rank_zero and aggregated_model_uses_exact_kv_events( | ||
| model_config, router_mode=router_mode, router_kv_events=router_kv_events | ||
| ) | ||
| kv_events_config = build_worker_kv_events_config( | ||
| model_config, | ||
| pg=pg, | ||
| bundle_index=node_rank, | ||
| port_seed=20080 + replica_index + node_rank, | ||
| enabled=kv_events_enabled, | ||
| ) | ||
| kv_events_config = None | ||
| # vLLM treats any non-None kv_events_config as incompatible with explicitly | ||
| # enabled hybrid KV cache manager, even when enable_kv_cache_events=False. | ||
| if kv_events_enabled or not explicit_hybrid_kv_cache_manager_enabled(model_config.engine_kwargs): | ||
|
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. Do we need this same check in the _launch_disagg_role() as well? |
||
| kv_events_config = build_worker_kv_events_config( | ||
| model_config, | ||
| pg=pg, | ||
| bundle_index=node_rank, | ||
| port_seed=20080 + replica_index + node_rank, | ||
| enabled=kv_events_enabled, | ||
| ) | ||
|
|
||
| python_args: list[str] = [ | ||
| "-m", | ||
|
|
@@ -351,7 +354,8 @@ def _launch_vllm_worker( # noqa: PLR0913 | |
| else: | ||
| python_args.append("--headless") | ||
|
|
||
| python_args += ["--kv-events-config", kv_events_config] | ||
| if kv_events_config is not None: | ||
| python_args += ["--kv-events-config", kv_events_config] | ||
|
|
||
| if spec.is_multi_node: | ||
| assert master_addr is not None, "master_addr must be set for multi-node replicas" # noqa: S101 | ||
|
|
@@ -492,11 +496,9 @@ def _launch_disagg_role( # noqa: PLR0913 | |
| # Global-enough seed so concurrent workers on one node don't collide. | ||
| nixl_port = get_free_port_in_bundle(pg, 0, _DISAGG_NIXL_PORT_SEED + worker_index) | ||
|
|
||
| # Always pass an explicit ``--kv-events-config``. Decode workers set | ||
| # ``enable_kv_cache_events=False`` — without the flag, Dynamo's | ||
| # args.py auto-creates a KVEventsConfig bound to ``tcp://*:20080`` | ||
| # when ``prefix_caching`` is enabled (vLLM >=0.16 default), causing | ||
| # every decode worker on the same node to fight over that port. | ||
| # Disaggregated workers pass an explicit ``--kv-events-config`` so | ||
| # prefill workers can publish events and decode workers can explicitly | ||
| # stay non-publishing. | ||
| kv_events_config = build_worker_kv_events_config( | ||
| model_config, | ||
| pg=pg, | ||
|
|
||
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
Oops, something went wrong.
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.
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.
--no-<flag>emitted for allFalsebooleans, not onlyBooleanOptionalActiononesThe docstring now states this is for vLLM
BooleanOptionalActionarguments, but the code applies the rule to everyboolvalue that isFalsein any kwargs dict — includingdynamo_kwargs,router_kwargs, and future users of this helper. vLLM (and Dynamo) have many flags that usestore_trueand have no--no-<flag>form; passing an unrecognised--no-*flag will cause the subprocess to exit with an argument-parsing error. There is no guard, validator, or documented list of which flags are safe to set toFalse.