Skip to content

Commit 2d06d95

Browse files
markmcwseaton
authored andcommitted
[API Server] arguments already have defaults, should always be present
There's no reason to use getattr() or repeat the default values for args, since they will always be present with the default specified in their declaration. Fixes: ``` File "/home/markmc/vllm-project/vllm/vllm/entrypoints/openai/cli_args.py", line 338, in validate_parsed_serve_args if getattr(args, "api_server_count", 1) > 1: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: '>' not supported between instances of 'NoneType' and 'int' ``` Signed-off-by: Mark McLoughlin <[email protected]>
1 parent da4f028 commit 2d06d95

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

vllm/entrypoints/openai/cli_args.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -333,13 +333,13 @@ def validate_parsed_serve_args(args: argparse.Namespace):
333333
# drain shutdown only supported in single-process mode
334334
shutdown_mode = getattr(args, "shutdown_mode", "immediate")
335335
if shutdown_mode == "drain":
336-
if getattr(args, "headless", False):
336+
if args.headless:
337337
raise ValueError("--shutdown-mode=drain is not supported in headless mode")
338-
if getattr(args, "api_server_count", 1) > 1:
338+
if args.api_server_count is not None and args.api_server_count > 1:
339339
raise ValueError(
340340
"--shutdown-mode=drain is not supported with --api-server-count > 1"
341341
)
342-
if getattr(args, "data_parallel_size", 1) > 1:
342+
if args.data_parallel_size > 1:
343343
raise ValueError(
344344
"--shutdown-mode=drain is not supported with --data-parallel-size > 1"
345345
)

0 commit comments

Comments
 (0)