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
686623c5
Unverified
Commit
686623c5
authored
Apr 18, 2025
by
Harry Mellor
Committed by
GitHub
Apr 18, 2025
Browse files
Fix `nullable_kvs` fallback (#16837)
Signed-off-by:
Harry Mellor
<
19981378+hmellor@users.noreply.github.com
>
parent
aadb6565
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
27 additions
and
19 deletions
+27
-19
tests/engine/test_arg_utils.py
tests/engine/test_arg_utils.py
+1
-1
tests/entrypoints/openai/test_audio.py
tests/entrypoints/openai/test_audio.py
+3
-1
tests/entrypoints/openai/test_video.py
tests/entrypoints/openai/test_video.py
+3
-1
tests/entrypoints/openai/test_vision.py
tests/entrypoints/openai/test_vision.py
+3
-1
tests/entrypoints/openai/test_vision_embedding.py
tests/entrypoints/openai/test_vision_embedding.py
+3
-1
tests/models/decoder_only/audio_language/test_ultravox.py
tests/models/decoder_only/audio_language/test_ultravox.py
+2
-1
vllm/config.py
vllm/config.py
+3
-4
vllm/engine/arg_utils.py
vllm/engine/arg_utils.py
+9
-9
No files found.
tests/engine/test_arg_utils.py
View file @
686623c5
...
@@ -10,7 +10,7 @@ from vllm.utils import FlexibleArgumentParser
...
@@ -10,7 +10,7 @@ from vllm.utils import FlexibleArgumentParser
@
pytest
.
mark
.
parametrize
((
"arg"
,
"expected"
),
[
@
pytest
.
mark
.
parametrize
((
"arg"
,
"expected"
),
[
(
None
,
None
),
(
None
,
dict
()
),
(
"image=16"
,
{
(
"image=16"
,
{
"image"
:
16
"image"
:
16
}),
}),
...
...
tests/entrypoints/openai/test_audio.py
View file @
686623c5
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: Apache-2.0
import
json
import
openai
import
openai
import
pytest
import
pytest
import
pytest_asyncio
import
pytest_asyncio
...
@@ -27,7 +29,7 @@ def server():
...
@@ -27,7 +29,7 @@ def server():
"--enforce-eager"
,
"--enforce-eager"
,
"--trust-remote-code"
,
"--trust-remote-code"
,
"--limit-mm-per-prompt"
,
"--limit-mm-per-prompt"
,
str
({
"audio"
:
MAXIMUM_AUDIOS
}),
json
.
dumps
({
"audio"
:
MAXIMUM_AUDIOS
}),
]
]
with
RemoteOpenAIServer
(
MODEL_NAME
,
args
)
as
remote_server
:
with
RemoteOpenAIServer
(
MODEL_NAME
,
args
)
as
remote_server
:
...
...
tests/entrypoints/openai/test_video.py
View file @
686623c5
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: Apache-2.0
import
json
import
openai
import
openai
import
pytest
import
pytest
import
pytest_asyncio
import
pytest_asyncio
...
@@ -31,7 +33,7 @@ def server():
...
@@ -31,7 +33,7 @@ def server():
"--enforce-eager"
,
"--enforce-eager"
,
"--trust-remote-code"
,
"--trust-remote-code"
,
"--limit-mm-per-prompt"
,
"--limit-mm-per-prompt"
,
str
({
"video"
:
MAXIMUM_VIDEOS
}),
json
.
dumps
({
"video"
:
MAXIMUM_VIDEOS
}),
]
]
with
RemoteOpenAIServer
(
MODEL_NAME
,
args
)
as
remote_server
:
with
RemoteOpenAIServer
(
MODEL_NAME
,
args
)
as
remote_server
:
...
...
tests/entrypoints/openai/test_vision.py
View file @
686623c5
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: Apache-2.0
import
json
import
openai
import
openai
import
pytest
import
pytest
import
pytest_asyncio
import
pytest_asyncio
...
@@ -35,7 +37,7 @@ def server():
...
@@ -35,7 +37,7 @@ def server():
"--enforce-eager"
,
"--enforce-eager"
,
"--trust-remote-code"
,
"--trust-remote-code"
,
"--limit-mm-per-prompt"
,
"--limit-mm-per-prompt"
,
str
({
"image"
:
MAXIMUM_IMAGES
}),
json
.
dumps
({
"image"
:
MAXIMUM_IMAGES
}),
]
]
with
RemoteOpenAIServer
(
MODEL_NAME
,
args
)
as
remote_server
:
with
RemoteOpenAIServer
(
MODEL_NAME
,
args
)
as
remote_server
:
...
...
tests/entrypoints/openai/test_vision_embedding.py
View file @
686623c5
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: Apache-2.0
import
json
import
pytest
import
pytest
import
requests
import
requests
from
PIL
import
Image
from
PIL
import
Image
...
@@ -37,7 +39,7 @@ def server():
...
@@ -37,7 +39,7 @@ def server():
"--enforce-eager"
,
"--enforce-eager"
,
"--trust-remote-code"
,
"--trust-remote-code"
,
"--limit-mm-per-prompt"
,
"--limit-mm-per-prompt"
,
str
({
"image"
:
MAXIMUM_IMAGES
}),
json
.
dumps
({
"image"
:
MAXIMUM_IMAGES
}),
"--chat-template"
,
"--chat-template"
,
str
(
vlm2vec_jinja_path
),
str
(
vlm2vec_jinja_path
),
]
]
...
...
tests/models/decoder_only/audio_language/test_ultravox.py
View file @
686623c5
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: Apache-2.0
import
json
from
typing
import
Optional
from
typing
import
Optional
import
numpy
as
np
import
numpy
as
np
...
@@ -50,7 +51,7 @@ def server(request, audio_assets):
...
@@ -50,7 +51,7 @@ def server(request, audio_assets):
args
=
[
args
=
[
"--dtype"
,
"bfloat16"
,
"--max-model-len"
,
"4096"
,
"--enforce-eager"
,
"--dtype"
,
"bfloat16"
,
"--max-model-len"
,
"4096"
,
"--enforce-eager"
,
"--limit-mm-per-prompt"
,
"--limit-mm-per-prompt"
,
str
({
"audio"
:
len
(
audio_assets
)}),
"--trust-remote-code"
json
.
dumps
({
"audio"
:
len
(
audio_assets
)}),
"--trust-remote-code"
]
+
[
]
+
[
f
"--
{
key
.
replace
(
'_'
,
'-'
)
}
=
{
value
}
"
f
"--
{
key
.
replace
(
'_'
,
'-'
)
}
=
{
value
}
"
for
key
,
value
in
request
.
param
.
items
()
for
key
,
value
in
request
.
param
.
items
()
...
...
vllm/config.py
View file @
686623c5
...
@@ -10,7 +10,6 @@ import sys
...
@@ -10,7 +10,6 @@ import sys
import
textwrap
import
textwrap
import
warnings
import
warnings
from
collections
import
Counter
from
collections
import
Counter
from
collections.abc
import
Mapping
from
contextlib
import
contextmanager
from
contextlib
import
contextmanager
from
dataclasses
import
(
MISSING
,
dataclass
,
field
,
fields
,
is_dataclass
,
from
dataclasses
import
(
MISSING
,
dataclass
,
field
,
fields
,
is_dataclass
,
replace
)
replace
)
...
@@ -355,7 +354,7 @@ class ModelConfig:
...
@@ -355,7 +354,7 @@ class ModelConfig:
disable_cascade_attn
:
bool
=
False
,
disable_cascade_attn
:
bool
=
False
,
skip_tokenizer_init
:
bool
=
False
,
skip_tokenizer_init
:
bool
=
False
,
served_model_name
:
Optional
[
Union
[
str
,
list
[
str
]]]
=
None
,
served_model_name
:
Optional
[
Union
[
str
,
list
[
str
]]]
=
None
,
limit_mm_per_prompt
:
Optional
[
Mapping
[
str
,
int
]]
=
None
,
limit_mm_per_prompt
:
Optional
[
dict
[
str
,
int
]]
=
None
,
use_async_output_proc
:
bool
=
True
,
use_async_output_proc
:
bool
=
True
,
config_format
:
ConfigFormat
=
ConfigFormat
.
AUTO
,
config_format
:
ConfigFormat
=
ConfigFormat
.
AUTO
,
hf_token
:
Optional
[
Union
[
bool
,
str
]]
=
None
,
hf_token
:
Optional
[
Union
[
bool
,
str
]]
=
None
,
...
@@ -578,7 +577,7 @@ class ModelConfig:
...
@@ -578,7 +577,7 @@ class ModelConfig:
self
.
tokenizer
=
s3_tokenizer
.
dir
self
.
tokenizer
=
s3_tokenizer
.
dir
def
_init_multimodal_config
(
def
_init_multimodal_config
(
self
,
limit_mm_per_prompt
:
Optional
[
Mapping
[
str
,
int
]]
self
,
limit_mm_per_prompt
:
Optional
[
dict
[
str
,
int
]]
)
->
Optional
[
"MultiModalConfig"
]:
)
->
Optional
[
"MultiModalConfig"
]:
if
self
.
registry
.
is_multimodal_model
(
self
.
architectures
):
if
self
.
registry
.
is_multimodal_model
(
self
.
architectures
):
return
MultiModalConfig
(
limit_per_prompt
=
limit_mm_per_prompt
or
{})
return
MultiModalConfig
(
limit_per_prompt
=
limit_mm_per_prompt
or
{})
...
@@ -2730,7 +2729,7 @@ class PromptAdapterConfig:
...
@@ -2730,7 +2729,7 @@ class PromptAdapterConfig:
class
MultiModalConfig
:
class
MultiModalConfig
:
"""Controls the behavior of multimodal models."""
"""Controls the behavior of multimodal models."""
limit_per_prompt
:
Mapping
[
str
,
int
]
=
field
(
default_factory
=
dict
)
limit_per_prompt
:
dict
[
str
,
int
]
=
field
(
default_factory
=
dict
)
"""
"""
The maximum number of input items allowed per prompt for each modality.
The maximum number of input items allowed per prompt for each modality.
This should be a JSON string that will be parsed into a dictionary.
This should be a JSON string that will be parsed into a dictionary.
...
...
vllm/engine/arg_utils.py
View file @
686623c5
...
@@ -7,7 +7,7 @@ import json
...
@@ -7,7 +7,7 @@ import json
import
re
import
re
import
threading
import
threading
from
dataclasses
import
MISSING
,
dataclass
,
fields
from
dataclasses
import
MISSING
,
dataclass
,
fields
from
typing
import
(
TYPE_CHECKING
,
Any
,
Callable
,
Dict
,
List
,
Literal
,
Mapping
,
from
typing
import
(
TYPE_CHECKING
,
Any
,
Callable
,
Dict
,
List
,
Literal
,
Optional
,
Tuple
,
Type
,
TypeVar
,
Union
,
cast
,
get_args
,
Optional
,
Tuple
,
Type
,
TypeVar
,
Union
,
cast
,
get_args
,
get_origin
)
get_origin
)
...
@@ -112,14 +112,14 @@ def nullable_kvs(val: str) -> Optional[dict[str, int]]:
...
@@ -112,14 +112,14 @@ def nullable_kvs(val: str) -> Optional[dict[str, int]]:
def
optional_dict
(
val
:
str
)
->
Optional
[
dict
[
str
,
int
]]:
def
optional_dict
(
val
:
str
)
->
Optional
[
dict
[
str
,
int
]]:
try
:
if
re
.
match
(
"^{.*}$"
,
val
)
:
return
optional_arg
(
val
,
json
.
loads
)
return
optional_arg
(
val
,
json
.
loads
)
except
ValueError
:
logger
.
warning
(
logger
.
warning
(
"Failed to parse JSON string. Attempting to parse as "
"Failed to parse JSON string. Attempting to parse as "
"comma-separated key=value pairs. This will be deprecated in a "
"comma-separated key=value pairs. This will be deprecated in a "
"future release."
)
"future release."
)
return
nullable_kvs
(
val
)
return
nullable_kvs
(
val
)
@
dataclass
@
dataclass
...
@@ -191,7 +191,7 @@ class EngineArgs:
...
@@ -191,7 +191,7 @@ class EngineArgs:
TokenizerPoolConfig
.
pool_type
TokenizerPoolConfig
.
pool_type
tokenizer_pool_extra_config
:
dict
[
str
,
Any
]
=
\
tokenizer_pool_extra_config
:
dict
[
str
,
Any
]
=
\
get_field
(
TokenizerPoolConfig
,
"extra_config"
)
get_field
(
TokenizerPoolConfig
,
"extra_config"
)
limit_mm_per_prompt
:
Mapping
[
str
,
int
]
=
\
limit_mm_per_prompt
:
dict
[
str
,
int
]
=
\
get_field
(
MultiModalConfig
,
"limit_per_prompt"
)
get_field
(
MultiModalConfig
,
"limit_per_prompt"
)
mm_processor_kwargs
:
Optional
[
Dict
[
str
,
Any
]]
=
None
mm_processor_kwargs
:
Optional
[
Dict
[
str
,
Any
]]
=
None
disable_mm_preprocessor_cache
:
bool
=
False
disable_mm_preprocessor_cache
:
bool
=
False
...
...
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