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 11
11
import vllm .entrypoints .cli .run_batch
12
12
import vllm .entrypoints .cli .serve
13
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
15
from vllm .utils import FlexibleArgumentParser
16
16
17
17
CMD_MODULES = [
@@ -37,7 +37,7 @@ def main():
37
37
38
38
parser = FlexibleArgumentParser (
39
39
description = "vLLM CLI" ,
40
- epilog = VLLM_SERVE_PARSER_EPILOG ,
40
+ epilog = VLLM_SUBCMD_PARSER_EPILOG ,
41
41
)
42
42
parser .add_argument ('-v' ,
43
43
'--version' ,
Original file line number Diff line number Diff line change 10
10
from vllm .entrypoints .logger import logger
11
11
from vllm .entrypoints .openai .run_batch import main as run_batch_main
12
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 )
13
15
from vllm .utils import FlexibleArgumentParser
14
16
from vllm .version import __version__ as VLLM_VERSION
15
17
@@ -49,7 +51,11 @@ def subparser_init(
49
51
usage =
50
52
"vllm run-batch -i INPUT.jsonl -o OUTPUT.jsonl --model <model>" ,
51
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
53
59
54
60
55
61
def cmd_init () -> list [CLISubcommand ]:
Original file line number Diff line number Diff line change 16
16
setup_server )
17
17
from vllm .entrypoints .openai .cli_args import (make_arg_parser ,
18
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
20
show_filtered_argument_or_group_from_help )
21
21
from vllm .executor .multiproc_worker_utils import _add_prefix
22
22
from vllm .logger import init_logger
@@ -101,8 +101,8 @@ def subparser_init(
101
101
)
102
102
103
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
106
return serve_parser
107
107
108
108
Original file line number Diff line number Diff line change 14
14
15
15
logger = init_logger (__name__ )
16
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 "
19
20
" - To view a argument group: --help=ModelConfig\n "
20
21
" - To view a single argument: --help=max-num-seqs\n "
21
22
" - To search by keyword: --help=max\n "
@@ -173,8 +174,15 @@ def _validate_truncation_size(
173
174
return truncate_prompt_tokens
174
175
175
176
176
- def show_filtered_argument_or_group_from_help (parser ):
177
+ def show_filtered_argument_or_group_from_help (parser , subcommand_name ):
177
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
+
178
186
for arg in sys .argv :
179
187
if arg .startswith ('--help=' ):
180
188
search_keyword = arg .split ('=' , 1 )[1 ]
You can’t perform that action at this time.
0 commit comments