A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 15, 07:15 UTC
[Frontend] improve vllm run-batch --help display (#19187)
Signed-off-by: reidliu41 <reid201711@gmail.com> Co-authored-by: reidliu41 <reid201711@gmail.com>
Reid committed
Jun 5, 2025 at 19:16 UTC
1aeb925f34495f505bf3053e4f66b8ca4886452e
4 files changed
+23
-9
vllm/entrypoints/cli/main.py
+2
-2
@@ -11,7 +11,7 @@ import vllm.entrypoints.cli.openai
11
import vllm.entrypoints.cli.run_batch
12
import vllm.entrypoints.cli.serve
13
import vllm.version
14
-from vllm.entrypoints.utils import VLLM_SERVE_PARSER_EPILOG, cli_env_setup
14
+from vllm.entrypoints.utils import VLLM_SUBCMD_PARSER_EPILOG, cli_env_setup
15
from vllm.utils import FlexibleArgumentParser
16
17
CMD_MODULES = [
@@ -37,7 +37,7 @@ def main():
37
38
parser = FlexibleArgumentParser(
39
description="vLLM CLI",
40
- epilog=VLLM_SERVE_PARSER_EPILOG,
40
+ epilog=VLLM_SUBCMD_PARSER_EPILOG,
41
)
42
parser.add_argument('-v',
43
'--version',
vllm/entrypoints/cli/run_batch.py
+7
-1
@@ -10,6 +10,8 @@ from vllm.entrypoints.cli.types import CLISubcommand
10
from vllm.entrypoints.logger import logger
11
from vllm.entrypoints.openai.run_batch import main as run_batch_main
12
from vllm.entrypoints.openai.run_batch import make_arg_parser
13
+from vllm.entrypoints.utils import (VLLM_SUBCMD_PARSER_EPILOG,
14
+ show_filtered_argument_or_group_from_help)
15
from vllm.utils import FlexibleArgumentParser
16
from vllm.version import __version__ as VLLM_VERSION
17
@@ -49,7 +51,11 @@ class RunBatchSubcommand(CLISubcommand):
51
usage=
52
"vllm run-batch -i INPUT.jsonl -o OUTPUT.jsonl --model <model>",
53
)
52
- return make_arg_parser(run_batch_parser)
54
+ run_batch_parser = make_arg_parser(run_batch_parser)
55
+ show_filtered_argument_or_group_from_help(run_batch_parser,
56
+ "run-batch")
57
+ run_batch_parser.epilog = VLLM_SUBCMD_PARSER_EPILOG
58
+ return run_batch_parser
59
60
61
def cmd_init() -> list[CLISubcommand]:
vllm/entrypoints/cli/serve.py
+3
-3
@@ -16,7 +16,7 @@ from vllm.entrypoints.openai.api_server import (run_server, run_server_worker,
16
setup_server)
17
from vllm.entrypoints.openai.cli_args import (make_arg_parser,
18
validate_parsed_serve_args)
19
-from vllm.entrypoints.utils import (VLLM_SERVE_PARSER_EPILOG,
19
+from vllm.entrypoints.utils import (VLLM_SUBCMD_PARSER_EPILOG,
20
show_filtered_argument_or_group_from_help)
21
from vllm.executor.multiproc_worker_utils import _add_prefix
22
from vllm.logger import init_logger
@@ -101,8 +101,8 @@ class ServeSubcommand(CLISubcommand):
101
)
102
103
serve_parser = make_arg_parser(serve_parser)
104
- show_filtered_argument_or_group_from_help(serve_parser)
105
- serve_parser.epilog = VLLM_SERVE_PARSER_EPILOG
104
+ show_filtered_argument_or_group_from_help(serve_parser, "serve")
105
+ serve_parser.epilog = VLLM_SUBCMD_PARSER_EPILOG
106
return serve_parser
107
108
vllm/entrypoints/utils.py
+11
-3
@@ -14,8 +14,9 @@ from vllm.logger import init_logger
14
15
logger = init_logger(__name__)
16
17
-VLLM_SERVE_PARSER_EPILOG = (
18
- "Tip: Use `vllm serve --help=<keyword>` to explore arguments from help.\n"
17
+VLLM_SUBCMD_PARSER_EPILOG = (
18
+ "Tip: Use `vllm [serve|run-batch] --help=<keyword>` "
19
+ "to explore arguments from help.\n"
20
" - To view a argument group: --help=ModelConfig\n"
21
" - To view a single argument: --help=max-num-seqs\n"
22
" - To search by keyword: --help=max\n"
@@ -173,8 +174,15 @@ def _validate_truncation_size(
174
return truncate_prompt_tokens
175
176
176
-def show_filtered_argument_or_group_from_help(parser):
177
+def show_filtered_argument_or_group_from_help(parser, subcommand_name):
178
import sys
179
+
180
+ # Only handle --help=<keyword> for the current subcommand.
181
+ # Since subparser_init() runs for all subcommands during CLI setup,
182
+ # we skip processing if the subcommand name is not in sys.argv.
183
+ if subcommand_name not in sys.argv:
184
+ return
185
+
186
for arg in sys.argv:
187
if arg.startswith('--help='):
188
search_keyword = arg.split('=', 1)[1]