MCPcopy Create free account
hub / github.com/OpenSparseLLMs/MoM / __init__

Method __init__

lm-eval-harness/lm_eval/models/utils.py:362–376  ·  view source on GitHub ↗
(
        self,
        arr: List,
        sort_fn: Callable,
        group_fn: Callable = lambda x: x[1],
        grouping: bool = False,
    )

Source from the content-addressed store, hash-verified

360 """
361
362 def __init__(
363 self,
364 arr: List,
365 sort_fn: Callable,
366 group_fn: Callable = lambda x: x[1],
367 grouping: bool = False,
368 ) -> None:
369 self.grouping = grouping
370 self.fn = sort_fn
371 self.group_fn = lambda x: group_fn(x[1]) # first index are enumerated indices
372 self.reorder_indices: List = []
373 self.size = len(arr)
374 self.arr_with_indices: Iterable[Any] = tuple(enumerate(arr)) # [indices, (arr)]
375 if self.grouping is True:
376 self.group_by_index()
377
378 def group_by_index(self) -> None:
379 self.arr_with_indices = self.group(

Callers

nothing calls this directly

Calls 1

group_by_indexMethod · 0.95

Tested by

no test coverage detected