Compare commits

..

3 Commits

Author SHA1 Message Date
Sofie Van Landeghem
26b0941f75
fix 2025-11-22 22:51:42 +01:00
Sofie Van Landeghem
c09b897601
further cleanup 2025-11-22 22:50:34 +01:00
Sofie Van Landeghem
df9a644e24
make code bit more succinct 2025-11-22 22:48:55 +01:00

View File

@ -37,18 +37,15 @@ class Task:
def __len__(self):
start = self.start
if self.stop is not None:
num_ex = self.num_examples()
if self.stop > num_ex:
# Warn once, then cap stop
logger.warning(
f"Stop parameter ({self.stop}) exceeds dataset size ({num_ex}). "
f"Using {num_ex} examples instead."
)
self.stop = num_ex
stop = self.stop
else:
stop = self.num_examples()
num_ex = self.num_examples()
if self.stop is not None and self.stop > num_ex:
# Warn once, then cap stop
logger.warning(
f"Stop parameter ({self.stop}) exceeds dataset size ({num_ex}). "
f"Using {num_ex} examples instead."
)
self.stop = num_ex
stop = num_ex if self.stop is None else self.stop
step = self.step
span = stop - start
num = (span + step - 1) // step # ceil_div(span, step)