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
041e2947
Unverified
Commit
041e2947
authored
Feb 20, 2025
by
燃
Committed by
GitHub
Feb 19, 2025
Browse files
[Misc] add mm_processor_kwargs to extra_body for Qwen2.5-VL (#13533)
parent
96216678
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
2 deletions
+18
-2
vllm/entrypoints/openai/protocol.py
vllm/entrypoints/openai/protocol.py
+4
-0
vllm/entrypoints/openai/serving_engine.py
vllm/entrypoints/openai/serving_engine.py
+2
-0
vllm/model_executor/models/qwen2_5_vl.py
vllm/model_executor/models/qwen2_5_vl.py
+1
-1
vllm/transformers_utils/processor.py
vllm/transformers_utils/processor.py
+11
-1
No files found.
vllm/entrypoints/openai/protocol.py
View file @
041e2947
...
@@ -312,6 +312,10 @@ class ChatCompletionRequest(OpenAIBaseModel):
...
@@ -312,6 +312,10 @@ class ChatCompletionRequest(OpenAIBaseModel):
description
=
(
"Additional kwargs to pass to the template renderer. "
description
=
(
"Additional kwargs to pass to the template renderer. "
"Will be accessible by the chat template."
),
"Will be accessible by the chat template."
),
)
)
mm_processor_kwargs
:
Optional
[
Dict
[
str
,
Any
]]
=
Field
(
default
=
None
,
description
=
(
"Additional kwargs to pass to the HF processor."
),
)
guided_json
:
Optional
[
Union
[
str
,
dict
,
BaseModel
]]
=
Field
(
guided_json
:
Optional
[
Union
[
str
,
dict
,
BaseModel
]]
=
Field
(
default
=
None
,
default
=
None
,
description
=
(
"If specified, the output will follow the JSON schema."
),
description
=
(
"If specified, the output will follow the JSON schema."
),
...
...
vllm/entrypoints/openai/serving_engine.py
View file @
041e2947
...
@@ -451,6 +451,8 @@ class OpenAIServing:
...
@@ -451,6 +451,8 @@ class OpenAIServing:
prompt_token_ids
=
prompt_inputs
[
"prompt_token_ids"
])
prompt_token_ids
=
prompt_inputs
[
"prompt_token_ids"
])
if
mm_data
is
not
None
:
if
mm_data
is
not
None
:
engine_prompt
[
"multi_modal_data"
]
=
mm_data
engine_prompt
[
"multi_modal_data"
]
=
mm_data
if
request
.
mm_processor_kwargs
is
not
None
:
engine_prompt
[
"mm_processor_kwargs"
]
=
request
.
mm_processor_kwargs
return
conversation
,
[
request_prompt
],
[
engine_prompt
]
return
conversation
,
[
request_prompt
],
[
engine_prompt
]
...
...
vllm/model_executor/models/qwen2_5_vl.py
View file @
041e2947
...
@@ -689,7 +689,7 @@ class Qwen2_5_VLProcessingInfo(Qwen2VLProcessingInfo):
...
@@ -689,7 +689,7 @@ class Qwen2_5_VLProcessingInfo(Qwen2VLProcessingInfo):
min_pixels
:
Optional
[
int
]
=
None
,
min_pixels
:
Optional
[
int
]
=
None
,
max_pixels
:
Optional
[
int
]
=
None
,
max_pixels
:
Optional
[
int
]
=
None
,
size
:
Optional
[
dict
[
str
,
int
]]
=
None
,
size
:
Optional
[
dict
[
str
,
int
]]
=
None
,
fps
:
Optional
[
float
]
=
None
,
fps
:
Optional
[
Union
[
float
,
List
[
float
]]
]
=
None
,
**
kwargs
:
object
,
**
kwargs
:
object
,
)
->
Qwen2_5_VLProcessor
:
)
->
Qwen2_5_VLProcessor
:
if
fps
is
not
None
:
if
fps
is
not
None
:
...
...
vllm/transformers_utils/processor.py
View file @
041e2947
...
@@ -23,6 +23,15 @@ class HashableDict(dict):
...
@@ -23,6 +23,15 @@ class HashableDict(dict):
return
hash
(
frozenset
(
self
.
items
()))
return
hash
(
frozenset
(
self
.
items
()))
class
HashableList
(
list
):
"""
A list that can be hashed by lru_cache.
"""
def
__hash__
(
self
)
->
int
:
# type: ignore[override]
return
hash
(
tuple
(
self
))
def
_merge_mm_kwargs
(
model_config
:
"ModelConfig"
,
**
kwargs
):
def
_merge_mm_kwargs
(
model_config
:
"ModelConfig"
,
**
kwargs
):
base_kwargs
=
model_config
.
mm_processor_kwargs
base_kwargs
=
model_config
.
mm_processor_kwargs
if
base_kwargs
is
None
:
if
base_kwargs
is
None
:
...
@@ -36,7 +45,8 @@ def _merge_mm_kwargs(model_config: "ModelConfig", **kwargs):
...
@@ -36,7 +45,8 @@ def _merge_mm_kwargs(model_config: "ModelConfig", **kwargs):
for
key
,
value
in
merged_kwargs
.
items
():
for
key
,
value
in
merged_kwargs
.
items
():
if
isinstance
(
value
,
dict
):
if
isinstance
(
value
,
dict
):
merged_kwargs
[
key
]
=
HashableDict
(
value
)
merged_kwargs
[
key
]
=
HashableDict
(
value
)
if
isinstance
(
value
,
list
):
merged_kwargs
[
key
]
=
HashableList
(
value
)
return
merged_kwargs
return
merged_kwargs
...
...
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