You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"/lm-evaluation-harness/lm_eval/evaluator.py", line 596, in<dictcomp>"original": len(task_output.task.eval_docs),
TypeError: object of type'generator' has no len()
I do some changes in evaluator.py then the evaluator can work smoothly
I want to make sure if these changes are allowed here
from collections.abc import Generator
...
# "n-samples": {# task_output.task_name: {# "original": len(task_output.task.eval_docs),# "effective": min(# limit if limit else len(task_output.task.eval_docs),# len(task_output.task.eval_docs),# ),# }# for task_output in eval_tasks# },"n_samples": {
task_output.task_name: {
"original": len(list(task_output.task.eval_docs)) if isinstance(task_output.task.eval_docs, Generator) else len(task_output.task.eval_docs),
"effective": min(
limit if limit else (len(list(task_output.task.eval_docs)) if isinstance(task_output.task.eval_docs, Generator) else len(task_output.task.eval_docs)),
len(list(task_output.task.eval_docs)) if isinstance(task_output.task.eval_docs, Generator) else len(task_output.task.eval_docs),
),
}
fortask_outputin eval_tasks
},
also some changes in evaluator_utils.py
# def get_sample_size(task, limit: Optional[int]) -> Union[int, None]:# if limit is not None:# limit = (# int(math.ceil(len(task.eval_docs) * limit)) if limit < 1.0 else int(limit)# )# return limit
def get_sample_size(task, limit: Optional[int]) -> Union[int, None]:
if limit is not None:
eval_docs_length = len(list(task.eval_docs)) if isinstance(task.eval_docs, Generator) else len(task.eval_docs)
limit = int(math.ceil(eval_docs_length * limit)) if limit < 1.0 else int(limit)
return limit
The text was updated successfully, but these errors were encountered:
The error occurred when I tried to test with
--tasks scrolls_narrativeqa
. My command was as follows:I do some changes in
evaluator.py
then the evaluator can work smoothlyI want to make sure if these changes are allowed here
also some changes in
evaluator_utils.py
The text was updated successfully, but these errors were encountered: