[Renderer] Move InputPreprocessor into Renderer (2/2) (#34560)

Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
This commit is contained in:
Cyrus Leung
2026-02-17 05:29:01 -08:00
committed by GitHub
parent c61a98f529
commit 574fe75245
32 changed files with 984 additions and 1054 deletions
+39
View File
@@ -0,0 +1,39 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
from collections.abc import Callable, Iterable, Sequence
from typing import Any, TypeVar, overload
from tqdm.auto import tqdm
_T = TypeVar("_T", bound=Iterable)
@overload
def maybe_tqdm(
it: Sequence[_T],
*,
use_tqdm: bool | Callable[..., tqdm],
**tqdm_kwargs: Any,
) -> Sequence[_T]: ...
@overload
def maybe_tqdm(
it: Iterable[_T],
*,
use_tqdm: bool | Callable[..., tqdm],
**tqdm_kwargs: Any,
) -> Iterable[_T]: ...
def maybe_tqdm(
it: Iterable[_T],
*,
use_tqdm: bool | Callable[..., tqdm],
**tqdm_kwargs: Any,
) -> Iterable[_T]:
if not use_tqdm:
return it
tqdm_func = use_tqdm if callable(use_tqdm) else tqdm
return tqdm_func(it, **tqdm_kwargs)