Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/evaluate/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,13 @@ def add_batch(self, *, predictions=None, references=None, **kwargs):
)
batch = {"predictions": predictions, "references": references, **kwargs}
batch = {input_name: batch[input_name] for input_name in self._feature_names()}
none_inputs = [name for name, val in batch.items() if val is None]
if none_inputs:
raise ValueError(
f"Batch inputs contain None for the following fields: {none_inputs}. "
"All inputs must be non-None sequences (lists, arrays, or tensors). "
"Check that your compute_metrics function passes non-None predictions and references."
)
if self.writer is None:
self.selected_feature_format = self._infer_feature_from_batch(batch)
self._init_writer()
Expand Down