Skip to content

Commit

Permalink
Allowing a single prompt to use several formats for one eval (#398)
Browse files Browse the repository at this point in the history
  • Loading branch information
clefourrier authored Nov 22, 2024
1 parent 3744fe2 commit 24d5feb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/lighteval/tasks/lighteval_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,11 +289,13 @@ def _get_docs_from_split(self, splits: list[str], few_shots=False) -> list[Doc]:

docs = []
for split in splits:
for item in self.dataset[split]:
for ix, item in enumerate(self.dataset[split]):
# Some tasks formatting is applied differently when the document is used for fewshot examples
# vs when it's used for the actual prompt. That's why we store whether we are currently using the
# doc for a fewshot sample (few_shots=True) or not, which then leads to the creation of a different Doc.
item["__few_shots"] = few_shots
# Some tasks require to know which is the current item index in order to apply a different prompt template
item["__index"] = ix
cur_docs = self.formatter(item, self.name)
if cur_docs is None:
continue
Expand Down

0 comments on commit 24d5feb

Please sign in to comment.