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

Method __init__

lm-eval-harness/lm_eval/models/utils.py:89–105  ·  view source on GitHub ↗
(self, arr, fn)

Source from the content-addressed store, hash-verified

87 """
88
89 def __init__(self, arr, fn) -> None:
90 # self.orig_arr = arr
91 self.size = len(arr)
92 arr = list(enumerate(arr))
93
94 def group_return_dict(arr, fn):
95 res = collections.defaultdict(list)
96
97 for ob in arr:
98 res[fn(ob)].append(ob)
99 return res
100
101 arr = group_return_dict(arr, lambda x: fn(x[1]))
102
103 # self.arr has format Dict[Tuple[int, <entry from orig. arr>]]
104 self.arr = arr
105 self._grouped = None
106
107 def get_grouped(self):
108 # return the contents but not indices for our grouped dict.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected