[Refactor]Base class for dit pipelines with unified parameter declaration[1/N] (#4225)
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>
This commit is contained in:
26 files changed
+1026
-1586
No files matched your search
@@ -0,0 +1,27 @@
|
||||
# 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}
|
||||
Reference in new issue
Block a user