File tree Expand file tree Collapse file tree 4 files changed +23
-9
lines changed
Expand file tree Collapse file tree 4 files changed +23
-9
lines changed Original file line number Diff line number Diff line change 1111import vllm .entrypoints .cli .run_batch
1212import vllm .entrypoints .cli .serve
1313import 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
1515from vllm .utils import FlexibleArgumentParser
1616
1717CMD_MODULES = [
@@ -37,7 +37,7 @@ def main():
3737
3838 parser = FlexibleArgumentParser (
3939 description = "vLLM CLI" ,
40- epilog = VLLM_SERVE_PARSER_EPILOG ,
40+ epilog = VLLM_SUBCMD_PARSER_EPILOG ,
4141 )
4242 parser .add_argument ('-v' ,
4343 '--version' ,
Original file line number Diff line number Diff line change 1010from vllm .entrypoints .logger import logger
1111from vllm .entrypoints .openai .run_batch import main as run_batch_main
1212from 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 )
1315from vllm .utils import FlexibleArgumentParser
1416from vllm .version import __version__ as VLLM_VERSION
1517
@@ -49,7 +51,11 @@ def subparser_init(
4951 usage =
5052 "vllm run-batch -i INPUT.jsonl -o OUTPUT.jsonl --model <model>" ,
5153 )
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
5359
5460
5561def cmd_init () -> list [CLISubcommand ]:
Original file line number Diff line number Diff line change 1616 setup_server )
1717from vllm .entrypoints .openai .cli_args import (make_arg_parser ,
1818 validate_parsed_serve_args )
19- from vllm .entrypoints .utils import (VLLM_SERVE_PARSER_EPILOG ,
19+ from vllm .entrypoints .utils import (VLLM_SUBCMD_PARSER_EPILOG ,
2020 show_filtered_argument_or_group_from_help )
2121from vllm .executor .multiproc_worker_utils import _add_prefix
2222from vllm .logger import init_logger
@@ -101,8 +101,8 @@ def subparser_init(
101101 )
102102
103103 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
106106 return serve_parser
107107
108108
Original file line number Diff line number Diff line change 1414
1515logger = init_logger (__name__ )
1616
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 "
1920 " - To view a argument group: --help=ModelConfig\n "
2021 " - To view a single argument: --help=max-num-seqs\n "
2122 " - To search by keyword: --help=max\n "
@@ -173,8 +174,15 @@ def _validate_truncation_size(
173174 return truncate_prompt_tokens
174175
175176
176- def show_filtered_argument_or_group_from_help (parser ):
177+ def show_filtered_argument_or_group_from_help (parser , subcommand_name ):
177178 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+
178186 for arg in sys .argv :
179187 if arg .startswith ('--help=' ):
180188 search_keyword = arg .split ('=' , 1 )[1 ]
You can’t perform that action at this time.
0 commit comments