vllm.utils.collection_utils ¶
Contains helpers that are applied to collections.
This is similar in concept to the collections module.
LazyDict ¶
Bases: Mapping[str, _V], Generic[_V]
Evaluates dictionary items only when they are accessed.
Adapted from: https://stackoverflow.com/a/47212782/5082708
Source code in vllm/utils/collection_utils.py
as_list ¶
chunk_list ¶
common_prefix ¶
Find the longest prefix common to all items.
Source code in vllm/utils/collection_utils.py
flatten_2d_lists ¶
full_groupby ¶
full_groupby(
values: Iterable[_V" backlink-type="used-by" backlink-anchor="vllm.utils.collection_utils.full_groupby" optional hover>_V], *, key: Callable[[_V], _K]
)
Unlike itertools.groupby, groups are not broken by non-contiguous data.