Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions tests/entrypoints/openai/test_cli_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,28 @@ def serve_parser():
return make_arg_parser(parser)


### Test config parsing
def test_config_arg_parsing(serve_parser, cli_config_file):
args = serve_parser.parse_args([])
assert args.port == 8000
args = serve_parser.parse_args(['--config', cli_config_file])
assert args.port == 12312
args = serve_parser.parse_args([
'--config',
cli_config_file,
'--port',
'9000',
])
assert args.port == 9000
args = serve_parser.parse_args([
'--port',
'9000',
'--config',
cli_config_file,
])
assert args.port == 9000


### Tests for LoRA module parsing
def test_valid_key_value_format(serve_parser):
# Test old format: name=path
Expand Down
7 changes: 5 additions & 2 deletions vllm/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1976,13 +1976,16 @@ def _pull_args_from_config(self, args: list[str]) -> list[str]:

config_args = self.load_config_file(file_path)

# 0th index is for {serve,chat,complete}
# 0th index might be the sub command {serve,chat,complete,...}
# optionally followed by model_tag (only for serve)
# followed by config args
# followed by rest of cli args.
# maintaining this order will enforce the precedence
# of cli > config > defaults
if args[0] == "serve":
if args[0].startswith('-'):
# No sub command (e.g., api_server entry point)
args = config_args + args[0:index] + args[index + 2:]
elif args[0] == "serve":
model_in_cli = len(args) > 1 and not args[1].startswith('-')
model_in_config = any(arg == '--model' for arg in config_args)

Expand Down