Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
vllm_cscc
Commits
8dbf6ed7
Unverified
Commit
8dbf6ed7
authored
Aug 27, 2025
by
rongfu.leng
Committed by
GitHub
Aug 27, 2025
Browse files
[Bugfix] fix when config.yaml config value is list parse error (#23528)
Signed-off-by:
rongfu.leng
<
rongfu.leng@daocloud.io
>
parent
9de25c29
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
2 deletions
+48
-2
tests/utils_/test_utils.py
tests/utils_/test_utils.py
+41
-0
vllm/utils/__init__.py
vllm/utils/__init__.py
+7
-2
No files found.
tests/utils_/test_utils.py
View file @
8dbf6ed7
...
...
@@ -5,13 +5,17 @@
import
asyncio
import
hashlib
import
json
import
os
import
pickle
import
socket
import
tempfile
from
collections.abc
import
AsyncIterator
from
pathlib
import
Path
from
unittest.mock
import
patch
import
pytest
import
torch
import
yaml
import
zmq
from
transformers
import
AutoTokenizer
from
vllm_test_utils.monitor
import
monitor
...
...
@@ -991,3 +995,40 @@ def test_current_stream_multithread():
child_thread
.
join
(
timeout
=
5
)
if
child_thread
.
is_alive
():
pytest
.
fail
(
"Child thread failed to exit properly"
)
def
test_load_config_file
(
tmp_path
):
# Define the configuration data
config_data
=
{
"enable-logging"
:
True
,
"list-arg"
:
[
"item1"
,
"item2"
],
"port"
:
12323
,
"tensor-parallel-size"
:
4
}
# Write the configuration data to a temporary YAML file
config_file_path
=
tmp_path
/
"config.yaml"
with
open
(
config_file_path
,
"w"
)
as
config_file
:
yaml
.
dump
(
config_data
,
config_file
)
# Initialize the parser
parser
=
FlexibleArgumentParser
()
# Call the function with the temporary file path
processed_args
=
parser
.
load_config_file
(
str
(
config_file_path
))
# Expected output
expected_args
=
[
"--enable-logging"
,
"--list-arg"
,
"item1"
,
"item2"
,
"--port"
,
"12323"
,
"--tensor-parallel-size"
,
"4"
,
]
# Assert that the processed arguments match the expected output
assert
processed_args
==
expected_args
os
.
remove
(
str
(
config_file_path
))
vllm/utils/__init__.py
View file @
8dbf6ed7
...
...
@@ -1974,7 +1974,7 @@ class FlexibleArgumentParser(ArgumentParser):
file_path
=
args
[
index
+
1
]
config_args
=
self
.
_
load_config_file
(
file_path
)
config_args
=
self
.
load_config_file
(
file_path
)
# 0th index is for {serve,chat,complete}
# optionally followed by model_tag (only for serve)
...
...
@@ -2005,7 +2005,7 @@ class FlexibleArgumentParser(ArgumentParser):
return
args
def
_
load_config_file
(
self
,
file_path
:
str
)
->
list
[
str
]:
def
load_config_file
(
self
,
file_path
:
str
)
->
list
[
str
]:
"""Loads a yaml file and returns the key value pairs as a
flattened list with argparse like pattern
```yaml
...
...
@@ -2046,6 +2046,11 @@ class FlexibleArgumentParser(ArgumentParser):
if
isinstance
(
value
,
bool
)
and
key
not
in
store_boolean_arguments
:
if
value
:
processed_args
.
append
(
'--'
+
key
)
elif
isinstance
(
value
,
list
):
if
value
:
processed_args
.
append
(
'--'
+
key
)
for
item
in
value
:
processed_args
.
append
(
str
(
item
))
else
:
processed_args
.
append
(
'--'
+
key
)
processed_args
.
append
(
str
(
value
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment