MCPcopy Create free account
hub / github.com/OpenBitSys/BitDistiller / evaluate

Function evaluate

test/general/lm_eval/evaluator.py:146–399  ·  view source on GitHub ↗
(
    lm,
    task_dict,
    provide_description=None,
    num_fewshot=0,
    limit=None,
    bootstrap_iters=100000,
    description_dict=None,
    decontamination_ngrams_path=None,
    write_out=False,
    output_base_path=None,
    test_set=True
)

Source from the content-addressed store, hash-verified

144
145@positional_deprecated
146def evaluate(
147 lm,
148 task_dict,
149 provide_description=None,
150 num_fewshot=0,
151 limit=None,
152 bootstrap_iters=100000,
153 description_dict=None,
154 decontamination_ngrams_path=None,
155 write_out=False,
156 output_base_path=None,
157 test_set=True
158):
159 print("test_set", test_set)
160 """Instantiate and evaluate a model on a list of tasks.
161
162 :param lm: obj
163 Language Model
164 :param task_dict: dict[str, Task]
165 Dictionary of tasks. Tasks will be taken to have name task.EVAL_HARNESS_NAME if defined and type(task).__name__ otherwise.
166 :param provide_description: bool
167 Not implemented, and this option is deprecated and will be removed in a future version in favor of a different description providing method
168 :param num_fewshot: int
169 Number of examples in few-shot context
170 :param limit: int, optional
171 Limit the number of examples per task (only use this for testing)
172 :param bootstrap_iters:
173 Number of iterations for bootstrap statistics
174 :param description_dict: dict[str, str]
175 Dictionary of custom task descriptions of the form: `task_name: description`
176 :param write_out: bool
177 If True, write all prompts, logits and metrics to json for offline analysis
178 :param output_base_path: str, optional
179 Directory to which detailed eval info will be written. Defaults to present working dir
180 :return
181 Dictionary of results
182 """
183 # TODO: completely refactor this entire function to not be a huge mess, ideally breaking it down into smaller pieces
184
185 # TODO: todo: implement proper description-providing system
186 assert not provide_description # not implemented.
187 if provide_description is not None:
188 # nudge people to not specify it at all
189 print(
190 "WARNING: provide_description is deprecated and will be removed in a future version in favor of description_dict"
191 )
192
193 decontaminate = decontamination_ngrams_path is not None
194
195 task_dict_items = [
196 (name, task)
197 for name, task in task_dict.items()
198 if (task.has_validation_docs() or task.has_test_docs())
199 ]
200
201 results = collections.defaultdict(dict)
202 versions = collections.defaultdict(dict)
203

Callers 1

simple_evaluateFunction · 0.85

Calls 10

get_train_overlapFunction · 0.90
has_validation_docsMethod · 0.45
has_test_docsMethod · 0.45
should_decontaminateMethod · 0.45
fewshot_contextMethod · 0.45
construct_requestsMethod · 0.45
doc_to_targetMethod · 0.45
process_resultsMethod · 0.45
aggregationMethod · 0.45

Tested by

no test coverage detected