Compare commits

...

2 Commits

Author SHA1 Message Date
Pyry Takala
a33d04dca1 Cap stop parameter and warn once when it exceeds dataset size 2025-11-21 20:51:46 +00:00
Pyry Takala
85e49943ed Gracefully handle stop > dataset_size with warning 2025-11-21 20:04:33 +00:00

View File

@ -6,6 +6,9 @@ Example tasks: MMLU, ARC-Easy, ARC-Challenge, GSM8K, HumanEval, SmolTalk.
"""
import random
import logging
logger = logging.getLogger(__name__)
class Task:
"""
@ -37,10 +40,12 @@ class Task:
if self.stop is not None:
num_ex = self.num_examples()
if self.stop > num_ex:
raise ValueError(
# Warn once, then cap stop
logger.warning(
f"Stop parameter ({self.stop}) exceeds dataset size ({num_ex}). "
f"Please use stop <= {num_ex} or remove the stop parameter to use the full dataset."
f"Using {num_ex} examples instead."
)
self.stop = num_ex
stop = self.stop
else:
stop = self.num_examples()