vllm.utils.collection_utils
¶
Contains helpers that are applied to collections.
This is similar in concept to the collections module.
Classes:
-
LazyDict–Evaluates dictionary items only when they are accessed.
Functions:
-
as_list–Convert iterable to list, unless it's already a list.
-
chunk_list–Yield successive chunk_size chunks from lst.
-
common_prefix–Find the longest prefix common to all items.
-
flatten_2d_lists–Flatten a list of lists to a single list.
-
full_groupby–Unlike
itertools.groupby, groups are not broken by -
is_list_of_numbers–Check every item is an int or finite float, excluding booleans.
LazyDict
¶
as_list(maybe_list)
¶
Convert iterable to list, unless it's already a list.
chunk_list(lst, chunk_size)
¶
Yield successive chunk_size chunks from lst.
flatten_2d_lists(lists)
¶
Flatten a list of lists to a single list.
full_groupby(values, *, key)
¶
Unlike itertools.groupby, groups are not broken by
non-contiguous data.
is_list_of_numbers(value)
¶
Check every item is an int or finite float, excluding booleans.