Skip to content

Commit 7e99159

Browse files
committed
Add model_tag in front of config_args
1 parent 255df7d commit 7e99159

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

vllm/utils.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1138,6 +1138,12 @@ def parse_args(self, args=None, namespace=None):
11381138
args = FlexibleArgumentParser._pull_args_from_config(args)
11391139

11401140
# Convert underscores to dashes and vice versa in argument names
1141+
processed_args = self._format_args(args)
1142+
1143+
return super().parse_args(processed_args, namespace)
1144+
1145+
def _format_args(self, args: List[str]) -> List[str]:
1146+
"""Convert underscores to dashes and vice versa in argument names"""
11411147
processed_args = []
11421148
for arg in args:
11431149
if arg.startswith('--'):
@@ -1150,13 +1156,9 @@ def parse_args(self, args=None, namespace=None):
11501156
arg[len('--'):].replace('_', '-'))
11511157
else:
11521158
processed_args.append(arg)
1153-
args, argv = super().parse_known_args(processed_args, namespace)
1154-
# Raise error if there are more unknown args than --dummy-tag
1155-
if len(argv) > 1:
1156-
msg = 'unrecognized arguments: {}'.format(' '.join(argv))
1157-
raise argparse.ArgumentError(None, msg)
1158-
return args
11591159

1160+
return processed_args
1161+
11601162
@staticmethod
11611163
def _pull_args_from_config(args: List[str]) -> List[str]:
11621164
"""Method to pull arguments specified in the config file
@@ -1205,12 +1207,12 @@ def _pull_args_from_config(args: List[str]) -> List[str]:
12051207
config_args = FlexibleArgumentParser._load_config_file(file_path)
12061208

12071209
# 0th index is for {serve,chat,complete}
1210+
# followed by model_tag
12081211
# followed by config args
12091212
# followed by rest of cli args.
12101213
# maintaining this order will enforce the precedence
1211-
# of cli > config > defaults
1212-
args = [args[0]] + config_args + ['--dummy-tag'] + \
1213-
args[1:index] + args[index + 2:]
1214+
# of cli > config > defaults
1215+
args = [args[0]] + [args[1]] + config_args + args[2:index] + args[index+2:]
12141216

12151217
return args
12161218

0 commit comments

Comments
 (0)