Skip to content

Commit

Permalink
Fix load config when using bools
Browse files Browse the repository at this point in the history
Signed-off-by: madt2709 <theodore.dias@hotmail.co.uk>
  • Loading branch information
madt2709 committed Oct 27, 2024
1 parent 67a6882 commit 66c6b6c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions tests/data/test_config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
port: 12312
served_model_name: mymodel
tensor_parallel_size: 2
trust_remote_code: true
2 changes: 2 additions & 0 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ def parser_with_config():
parser.add_argument('--config', type=str)
parser.add_argument('--port', type=int)
parser.add_argument('--tensor-parallel-size', type=int)
parser.add_argument('--trust-remote-code', action='store_true')
return parser


Expand Down Expand Up @@ -214,6 +215,7 @@ def test_config_args(parser_with_config):
args = parser_with_config.parse_args(
['serve', 'mymodel', '--config', './data/test_config.yaml'])
assert args.tensor_parallel_size == 2
assert args.trust_remote_code


def test_config_file(parser_with_config):
Expand Down
8 changes: 6 additions & 2 deletions vllm/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1283,8 +1283,12 @@ def _load_config_file(file_path: str) -> List[str]:
raise ex

for key, value in config.items():
processed_args.append('--' + key)
processed_args.append(str(value))
if isinstance(value, bool):
if value:
processed_args.append('--' + key)
else:
processed_args.append('--' + key)
processed_args.append(str(value))

return processed_args

Expand Down

0 comments on commit 66c6b6c

Please sign in to comment.