Skip to content

Commit dc81343

Browse files
Fix a tiny bug and apply ruff
1 parent 6146844 commit dc81343

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

src/lighteval/tasks/default_prompts.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ def bbh(line, instruction, choices, task_name: str = None):
203203
return Doc(
204204
task_name=task_name,
205205
query=f"{instruction}Q: {line['input']}\nA:",
206-
choices=[(' ' if line["__few_shots"] else '') + c for c in choices],
206+
choices=[(" " if line["__few_shots"] else "") + c for c in choices],
207207
gold_index=choices.index(line["target"]),
208208
instruction=instruction,
209209
)
@@ -790,7 +790,7 @@ def hellaswag_helm(line, task_name: str = None):
790790
return Doc(
791791
task_name=task_name,
792792
query=query,
793-
choices=[" " + i for i in LETTER_INDICES[: len(line["endings"])]] + ([""] if line["__fewshot"] else []),
793+
choices=[" " + i for i in LETTER_INDICES[: len(line["endings"])]] + ([""] if line["__few_shot"] else []),
794794
gold_index=gold_ix, # -1 for test,
795795
instruction="The following are multiple choice questions (with answers) about common sense.\n\n",
796796
specific={
@@ -1629,7 +1629,7 @@ def mmlu_helm(line, task_name: str = None):
16291629
return Doc(
16301630
task_name=task_name,
16311631
query=query,
1632-
choices=[" A", " B", " C", " D"] if not is_few_shots else ["A", "B", "C", "D"], # specific to HELM evals
1632+
choices=[" A", " B", " C", " D"] if not is_few_shots else ["A", "B", "C", "D"], # specific to HELM evals
16331633
gold_index=gold_ix,
16341634
instruction=f"The following are multiple choice questions (with answers) about {subject.replace('_', ' ')}.\n\n",
16351635
)

src/lighteval/tasks/prompt_manager.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,9 +253,7 @@ def get_examples(
253253
class FewShotSelectionMethod:
254254
sorting: str # sorting method for the overall few shot pool (balanced, random, sequential)
255255
with_sampling: bool # samples item randomly from the few shot pool
256-
fewshotpool_unique: (
257-
bool
258-
) # set to true if you are CERTAIN there is no intersection between the few shot pool and your evaluation set
256+
fewshotpool_unique: bool # set to true if you are CERTAIN there is no intersection between the few shot pool and your evaluation set
259257

260258

261259
class FewShotSelection(Enum):

src/lighteval/tasks/requests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ def get_golds(self):
200200
for gold_ix in gold_indices:
201201
golds.extend(as_list(self.choices[gold_ix]))
202202
return golds
203-
203+
204204
def get_target_for_fewshot_sorting(self) -> str:
205205
return self.target_for_fewshot_sorting or as_list(self.get_golds())[0]
206206

0 commit comments

Comments
 (0)