Signed-off-by: princepride <wangzhipeng628@gmail.com> Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: Hongsheng Liu <liuhongsheng4@huawei.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
28 lines
1.0 KiB
Python
28 lines
1.0 KiB
Python
# SPDX-License-Identifier: Apache-2.0
|
|
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
|
|
|
from __future__ import annotations
|
|
|
|
from vllm_omni.inputs.data import OmniDiffusionSamplingParams
|
|
|
|
|
|
def apply_declared_extra_args(
|
|
sampling_params: OmniDiffusionSamplingParams,
|
|
declared_params: frozenset[str],
|
|
user_kwargs: dict[str, object],
|
|
) -> None:
|
|
"""Route pipeline-declared request params into ``sampling_params.extra_args``.
|
|
|
|
Both online serving and offline examples call this so that model-specific
|
|
keys (e.g. ``cfg_text_scale`` for BAGEL) end up in ``extra_args`` instead
|
|
of being silently dropped.
|
|
|
|
This is a no-op when no declared params are present in ``user_kwargs``, so
|
|
it is safe to call on non-diffusion (e.g. AR) sampling params whose
|
|
``extra_args`` defaults to ``None``.
|
|
"""
|
|
declared = {key: user_kwargs[key] for key in declared_params if user_kwargs.get(key) is not None}
|
|
if not declared:
|
|
return
|
|
sampling_params.extra_args = {**(sampling_params.extra_args or {}), **declared}
|