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

Class FirstNSampler

lm-eval-harness/lm_eval/api/samplers.py:74–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72
73
74class FirstNSampler(ContextSampler):
75 def sample(self, n) -> None:
76 """
77 Draw the first `n` samples in order from the specified split.
78 Used for tasks with "canonical" ordered fewshot examples, such as MMLU and CMMLU.
79 """
80 assert (
81 n <= len(self.docs)
82 ), f"Error: number of fewshot samples requested exceeds the {len(self.docs)} that are available."
83 return self.docs[:n]
84
85
86class BalancedSampler(ContextSampler):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected