Skip to content

Commit 7a456fd

Browse files
authored
Fix None Doc (#1008)
1 parent b1d45e3 commit 7a456fd

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/lighteval/tasks/lighteval_task.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,11 @@ def _get_docs_from_split(self, splits: list[str], few_shots=False) -> list[Doc]:
295295
# Some tasks require to know which is the current item index in order to apply a different prompt template
296296
item["__index"] = ix
297297
doc = self.formatter(item, self.name)
298+
299+
# Skip if formatter returns None (e.g., to filter out certain samples)
300+
if doc is None:
301+
continue
302+
298303
doc.id = str(ix)
299304

300305
# Transfer task-level generation parameters to the document

0 commit comments

Comments
 (0)