Skip to content

Commit aa457ed

Browse files
authored
Fix float limit override (#2325)
* Fix float limit override See: #2324 The float limit will be override with the previous int limit of multiple tasks are triggered together. This PR fix this issue * Update evaluator.py * Update evaluator.py
1 parent fe3040f commit aa457ed

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lm_eval/evaluator.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -433,10 +433,14 @@ def evaluate(
433433
)
434434
# end multimodality validation check
435435

436+
# Cache the limit arg.
437+
limit_arg = limit
438+
limits = []
436439
for task_output in eval_tasks:
437440
task: Task = task_output.task
438441

439-
limit = get_sample_size(task, limit)
442+
limit = get_sample_size(task, limit_arg)
443+
limits.append(limit)
440444
task.build_all_requests(
441445
limit=limit,
442446
rank=lm.rank,
@@ -506,7 +510,7 @@ def evaluate(
506510
WORLD_SIZE = lm.world_size
507511
### Postprocess outputs ###
508512
# TODO: del model here, maybe (idea: allow user to specify device of e.g. reward model separately)
509-
for task_output in eval_tasks:
513+
for task_output, limit in zip(eval_tasks, limits):
510514
task = task_output.task
511515
task.apply_filters()
512516

@@ -655,7 +659,7 @@ def evaluate(
655659
len(task_output.task.eval_docs),
656660
),
657661
}
658-
for task_output in eval_tasks
662+
for task_output, limit in zip(eval_tasks, limits)
659663
},
660664
}
661665
if log_samples:

0 commit comments

Comments
 (0)