Skip to content

Commit afaef0d

Browse files
committed
Ensure having enough data to inference
1 parent 7e59fcb commit afaef0d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tools/who_what_benchmark/whowhatbench/embeddings_evaluator.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,8 @@ def default_gen_answer(model, tokenizer, passages, **kwargs):
182182
'normalize': self.normalize}
183183

184184
batch_size = self.batch_size or len(data[0])
185-
batch_size = min(batch_size, len(data[0]))
185+
assert batch_size <= len(data[0]), \
186+
f"batch_size ({batch_size}) cannot be greater than data length ({len(data[0])})"
186187
data_input = data[0][:batch_size]
187188
result = gen_answer_fn(model, self.tokenizer, data_input, **kwargs)
188189

0 commit comments

Comments
 (0)