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

Method __post_init__

lm-eval-harness/lm_eval/api/task.py:90–113  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

88 metadata: dict = None # by default, not used in the code. allows for users to pass arbitrary info to tasks
89
90 def __post_init__(self) -> None:
91 if self.generation_kwargs is not None:
92 if self.output_type != "generate_until":
93 eval_logger.warning(
94 f"[{self.task}] passed `generation_kwargs`, but not using `output_type: generate_until`!"
95 )
96 assert self.output_type != "generate_until"
97
98 if "temperature" in self.generation_kwargs:
99 self.generation_kwargs["temperature"] = float(
100 self.generation_kwargs["temperature"]
101 )
102
103 if "until" not in self.generation_kwargs:
104 self.generation_kwargs["until"] = [self.fewshot_delimiter]
105 else:
106 if self.output_type == "generate_until":
107 # ensure that we greedily generate in absence of explicit arguments otherwise
108 self.generation_kwargs = {
109 "until": None
110 if self.fewshot_delimiter is None
111 else [self.fewshot_delimiter],
112 "do_sample": False,
113 }
114
115 def __getitem__(self, item):
116 return getattr(self, item)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected