mirror of
https://git.datalinker.icu/vllm-project/vllm.git
synced 2026-05-20 15:17:02 +08:00
[Misc] add mm_processor_kwargs to extra_body for Qwen2.5-VL (#13533)
This commit is contained in:
parent
9621667874
commit
041e294716
@ -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."),
|
||||||
|
|||||||
@ -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]
|
||||||
|
|
||||||
|
|||||||
@ -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:
|
||||||
|
|||||||
@ -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):
|
|||||||
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
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user