[Frontend] Advertise --enable-x/--disable-x for boolean CLI flags (#61479)
Signed-off-by: mgoin <mgoin64@gmail.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
48f17b77bb
commit
1c4c319792
@@ -67,7 +67,7 @@ class PoolerConfig:
|
||||
"""
|
||||
Whether the engine-side late-interaction scorer may use the fused
|
||||
flash-maxsim Triton kernel. Disabled automatically when the API server
|
||||
is started with `--no-enable-flash-late-interaction`; the reference
|
||||
is started with `--disable-flash-late-interaction`; the reference
|
||||
scorer is used instead.
|
||||
"""
|
||||
|
||||
|
||||
+5
-5
@@ -2177,10 +2177,10 @@ class VllmConfig:
|
||||
self._verify_aux_output_compatibility()
|
||||
|
||||
# Hybrid KV cache manager (HMA) runtime rules:
|
||||
# - Explicit enable (--no-disable-kv-cache-manager): error if runtime
|
||||
# - Explicit enable (--enable-hybrid-kv-cache-manager): error if runtime
|
||||
# disables it
|
||||
# - No preference: auto-disable for unsupported features or connector configs
|
||||
# - Explicit disable (--disable-kv-cache-manager): always respect it
|
||||
# - Explicit disable (--disable-hybrid-kv-cache-manager): always respect it
|
||||
need_disable_hybrid_kv_cache_manager = False
|
||||
# logger should only print warning message for hybrid models. As we
|
||||
# can't know whether the model is hybrid or not now, so we don't log
|
||||
@@ -2241,7 +2241,7 @@ class VllmConfig:
|
||||
raise ValueError(
|
||||
"Hybrid KV cache manager was explicitly enabled but is not "
|
||||
"supported in this configuration. Consider omitting the "
|
||||
"--no-disable-hybrid-kv-cache-manager flag to let vLLM decide"
|
||||
"--enable-hybrid-kv-cache-manager flag to let vLLM decide"
|
||||
" automatically."
|
||||
)
|
||||
|
||||
@@ -3410,7 +3410,7 @@ class VllmConfig:
|
||||
if self.cache_config.mamba_cache_mode != "none":
|
||||
raise ValueError(
|
||||
"FlashInfer ReplaySSM speculative decoding does not support "
|
||||
"prefix caching; use --no-enable-prefix-caching"
|
||||
"prefix caching; use --disable-prefix-caching"
|
||||
)
|
||||
query_len = 1 + self.num_speculative_tokens
|
||||
if self.cache_config.replayssm_buffer_len < query_len:
|
||||
@@ -3429,7 +3429,7 @@ class VllmConfig:
|
||||
if self.cache_config.mamba_cache_mode == "align":
|
||||
raise ValueError(
|
||||
"FlashInfer ReplaySSM does not support prefix caching yet; "
|
||||
"use --no-enable-prefix-caching"
|
||||
"use --disable-prefix-caching"
|
||||
)
|
||||
elif self.mamba_config.backend != MambaBackendEnum.TRITON:
|
||||
raise ValueError(
|
||||
|
||||
@@ -2531,7 +2531,7 @@ class NixlBaseConnectorWorker:
|
||||
"is not supported for Mamba hybrid models. "
|
||||
f"Local: {self._physical_blocks_per_logical_kv_block}, "
|
||||
f"Remote: {remote_physical_per_logical}. "
|
||||
"Disable prefix caching with --no-enable-prefix-caching."
|
||||
"Disable prefix caching with --disable-prefix-caching."
|
||||
)
|
||||
|
||||
if block_size_ratio != 1:
|
||||
|
||||
@@ -557,7 +557,7 @@ def create_parser_for_docs() -> FlexibleArgumentParser:
|
||||
|
||||
|
||||
def propagate_flash_late_interaction(args, engine_args) -> None:
|
||||
"""Propagate `--no-enable-flash-late-interaction` into the engine config.
|
||||
"""Propagate `--disable-flash-late-interaction` into the engine config.
|
||||
|
||||
The frontend flag alone only disables the API-server scoring path;
|
||||
mirroring it into `PoolerConfig.enable_flash_late_interaction` lets the
|
||||
|
||||
@@ -11,6 +11,7 @@ from argparse import (
|
||||
ArgumentDefaultsHelpFormatter,
|
||||
ArgumentParser,
|
||||
ArgumentTypeError,
|
||||
BooleanOptionalAction,
|
||||
Namespace,
|
||||
RawDescriptionHelpFormatter,
|
||||
_ArgumentGroup,
|
||||
@@ -116,6 +117,42 @@ class SortedHelpFormatter(ArgumentDefaultsHelpFormatter, RawDescriptionHelpForma
|
||||
super().add_arguments(actions)
|
||||
|
||||
|
||||
class EnableDisableAction(BooleanOptionalAction):
|
||||
"""`BooleanOptionalAction` that pairs `--enable-x` with `--disable-x`.
|
||||
|
||||
`--no-enable-x` and `--no-disable-x` are still accepted for backwards
|
||||
compatibility, but are hidden from help.
|
||||
"""
|
||||
|
||||
_inverse_prefixes = {"--enable-": "--disable-", "--disable-": "--enable-"}
|
||||
|
||||
def __init__(self, option_strings, dest, *args, **kwargs):
|
||||
super().__init__(option_strings, dest, *args, **kwargs)
|
||||
inverses = [
|
||||
inverse + opt.removeprefix(prefix)
|
||||
for opt in option_strings
|
||||
for prefix, inverse in self._inverse_prefixes.items()
|
||||
if opt.startswith(prefix)
|
||||
]
|
||||
negated = {opt for opt in self.option_strings if opt not in option_strings}
|
||||
self.negative_option_strings = negated | set(inverses)
|
||||
self.visible_option_strings = (
|
||||
[*option_strings, *inverses] if inverses else list(self.option_strings)
|
||||
)
|
||||
self.option_strings = [*self.option_strings, *inverses]
|
||||
|
||||
def __call__(self, parser, namespace, values, option_string=None):
|
||||
setattr(namespace, self.dest, option_string not in self.negative_option_strings)
|
||||
|
||||
|
||||
def _register_action(action: Action, deprecated: bool, deprecated_actions: set):
|
||||
# Hidden option strings stay registered with the parser but leave help.
|
||||
if isinstance(action, EnableDisableAction):
|
||||
action.option_strings = action.visible_option_strings
|
||||
if deprecated:
|
||||
deprecated_actions.add(action)
|
||||
|
||||
|
||||
class FlexibleArgumentParser(ArgumentParser):
|
||||
"""ArgumentParser that allows both underscore and dash in names."""
|
||||
|
||||
@@ -139,6 +176,7 @@ class FlexibleArgumentParser(ArgumentParser):
|
||||
# Pop kwarg "add_json_tip" to control whether to add the JSON tip
|
||||
self.add_json_tip = kwargs.pop("add_json_tip", True)
|
||||
super().__init__(*args, **kwargs)
|
||||
self.register("action", BooleanOptionalAction, EnableDisableAction)
|
||||
self._show_serve_task_hint = False
|
||||
|
||||
def error(self, message: str) -> NoReturn:
|
||||
@@ -169,29 +207,28 @@ class FlexibleArgumentParser(ArgumentParser):
|
||||
logger.warning_once("argument '%s' is deprecated", dest)
|
||||
return namespace, args
|
||||
|
||||
def add_argument(self, *args, **kwargs):
|
||||
# Python 3.13+ handles the deprecated kwarg natively
|
||||
deprecated = sys.version_info < (3, 13) and kwargs.pop("deprecated", False)
|
||||
action = super().add_argument(*args, **kwargs)
|
||||
_register_action(action, deprecated, self._deprecated)
|
||||
return action
|
||||
|
||||
class _FlexibleArgumentGroup(_ArgumentGroup):
|
||||
def __init__(self, container, *args, **kwargs):
|
||||
super().__init__(container, *args, **kwargs)
|
||||
self._deprecated: set[Action] = container._deprecated
|
||||
|
||||
def add_argument(self, *args, **kwargs):
|
||||
deprecated = kwargs.pop("deprecated", False)
|
||||
deprecated = sys.version_info < (3, 13) and kwargs.pop("deprecated", False)
|
||||
action = super().add_argument(*args, **kwargs)
|
||||
if deprecated:
|
||||
self._deprecated.add(action)
|
||||
_register_action(action, deprecated, self._deprecated)
|
||||
return action
|
||||
|
||||
class _FlexibleArgumentGroup(_ArgumentGroup):
|
||||
def __init__(self, container, *args, **kwargs):
|
||||
super().__init__(container, *args, **kwargs)
|
||||
self._deprecated: set[Action] = container._deprecated
|
||||
|
||||
def add_argument(self, *args, **kwargs):
|
||||
deprecated = kwargs.pop("deprecated", False)
|
||||
action = super().add_argument(*args, **kwargs)
|
||||
if deprecated:
|
||||
self._deprecated.add(action)
|
||||
return action
|
||||
|
||||
def add_argument_group(self, *args, **kwargs):
|
||||
group = self._FlexibleArgumentGroup(self, *args, **kwargs)
|
||||
self._action_groups.append(group)
|
||||
return group
|
||||
def add_argument_group(self, *args, **kwargs):
|
||||
group = self._FlexibleArgumentGroup(self, *args, **kwargs)
|
||||
self._action_groups.append(group)
|
||||
return group
|
||||
|
||||
def format_help(self):
|
||||
# Only use custom help formatting for bottom level parsers
|
||||
|
||||
Reference in New Issue
Block a user