Skip to content

Commit

Permalink
Fix fewshot seed only set when overriding num_fewshot (#1914)
Browse files Browse the repository at this point in the history
Fix #1906
  • Loading branch information
LSinev committed Jun 3, 2024
1 parent 1060b68 commit 42d5c4b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lm_eval/evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,14 +241,15 @@ def simple_evaluate(
f"Overwriting default num_fewshot of {task_name} from {default_num_fewshot} to {num_fewshot}"
)
task_obj.set_config(key="num_fewshot", value=num_fewshot)
task_obj.set_fewshot_seed(seed=fewshot_random_seed)
eval_logger.info(
f"Setting fewshot random generator seed to {fewshot_random_seed}"
)
else:
# if num_fewshot not provided, and the task does not define a default one, default to 0
if (default_num_fewshot := task_obj.get_config("num_fewshot")) is None:
task_obj.set_config(key="num_fewshot", value=0)
# fewshot_random_seed set for tasks, even with a default num_fewshot (e.g. in the YAML file)
task_obj.set_fewshot_seed(seed=fewshot_random_seed)
eval_logger.info(
f"Setting fewshot random generator seed to {fewshot_random_seed}"
)

if check_integrity:
run_task_tests(task_list=tasks)
Expand Down

0 comments on commit 42d5c4b

Please sign in to comment.