Skip to content

Commit

Permalink
raises error when dataset is an empty list in NanoBEIREvaluator (#3122)
Browse files Browse the repository at this point in the history
* raises error when dataset is an empty list in NanoBEIREvaluator

* fix len
  • Loading branch information
JINO-ROHIT authored Dec 10, 2024
1 parent 679ab5d commit 58d68ac
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions sentence_transformers/evaluation/NanoBEIREvaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,8 @@ def _load_dataset(self, dataset_name: DatasetNameType, **ir_evaluator_kwargs) ->
)

def _validate_dataset_names(self):
if len(self.dataset_names) == 0:
raise ValueError("dataset_names cannot be empty. Use None to evaluate on all datasets.")
if missing_datasets := [
dataset_name for dataset_name in self.dataset_names if dataset_name.lower() not in dataset_name_to_id
]:
Expand Down

0 comments on commit 58d68ac

Please sign in to comment.