mirror of
https://git.datalinker.icu/vllm-project/vllm.git
synced 2025-12-10 07:57:45 +08:00
[Bugfix] Fix --config arg expansion called from api_server.py (#23944)
Signed-off-by: Jean-Francois Dube <dubejf+gh@gmail.com> Co-authored-by: Jean-Francois Dube <dubejf+gh@gmail.com> Co-authored-by: Cyrus Leung <tlleungac@connect.ust.hk>
This commit is contained in:
parent
d660c98c1b
commit
5b31cb1781
@ -27,6 +27,28 @@ def serve_parser():
|
|||||||
return make_arg_parser(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
|
### Tests for LoRA module parsing
|
||||||
def test_valid_key_value_format(serve_parser):
|
def test_valid_key_value_format(serve_parser):
|
||||||
# Test old format: name=path
|
# Test old format: name=path
|
||||||
|
|||||||
@ -1976,13 +1976,16 @@ class FlexibleArgumentParser(ArgumentParser):
|
|||||||
|
|
||||||
config_args = self.load_config_file(file_path)
|
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)
|
# optionally followed by model_tag (only for serve)
|
||||||
# followed by config args
|
# followed by config args
|
||||||
# followed by rest of cli args.
|
# followed by rest of cli args.
|
||||||
# maintaining this order will enforce the precedence
|
# maintaining this order will enforce the precedence
|
||||||
# of cli > config > defaults
|
# 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_cli = len(args) > 1 and not args[1].startswith('-')
|
||||||
model_in_config = any(arg == '--model' for arg in config_args)
|
model_in_config = any(arg == '--model' for arg in config_args)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user