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 ¶
Unlike itertools.groupby, groups are not broken by non-contiguous data.