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

Method get_original

lm-eval-harness/lm_eval/models/utils.py:421–440  ·  view source on GitHub ↗

Restores the original order of elements from the reordered list. Parameters: - newarr (List): The reordered array. Returns: List: The array with elements restored to their original order.

(self, newarr: List)

Source from the content-addressed store, hash-verified

419 yield from [x[1] for x in arr]
420
421 def get_original(self, newarr: List) -> List:
422 """
423 Restores the original order of elements from the reordered list.
424
425 Parameters:
426 - newarr (List): The reordered array.
427
428 Returns:
429 List: The array with elements restored to their original order.
430 """
431 res = [None] * self.size
432 cov = [False] * self.size
433
434 for ind, v in zip(self.reorder_indices, newarr):
435 res[ind] = v
436 cov[ind] = True
437
438 assert all(cov)
439
440 return res
441
442 def __len__(self):
443 return self.size

Callers 4

generate_untilMethod · 0.95
_loglikelihood_tokensMethod · 0.95
_loglikelihood_tokensMethod · 0.95
generate_untilMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected