Squashed migration rebased onto current main. Collapses the 46-commit dev/migrate-MR-v2 history (10 merge commits + superseded pre-rebase work) into a single commit, so the diff reflects only the genuine MR-V2 feature (worker_v2/ runners + model_states, omni schedulers, stage engine pipeline, pooling_output serialization bridge). Content already merged to main separately (step_audio2, tts_adapters, npu/_310p, etc.) drops out. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
22 lines
804 B
Python
22 lines
804 B
Python
# SPDX-License-Identifier: Apache-2.0
|
|
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
|
|
|
from __future__ import annotations
|
|
|
|
import inspect
|
|
from typing import Any
|
|
|
|
|
|
def make_filtered_namedtuple(cls, known_extra_fields: set[str] | None = None, **kwargs: Any):
|
|
fields = set(cls._fields)
|
|
unknown = set(kwargs) - fields - (known_extra_fields or set())
|
|
values = {key: value for key, value in kwargs.items() if key in fields}
|
|
return cls(**values), unknown
|
|
|
|
|
|
def make_filtered_call(cls, known_extra_fields: set[str] | None = None, **kwargs: Any):
|
|
params = set(inspect.signature(cls).parameters)
|
|
unknown = set(kwargs) - params - (known_extra_fields or set())
|
|
values = {key: value for key, value in kwargs.items() if key in params}
|
|
return cls(**values), unknown
|