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): def __len__(self):
start = self.start start = self.start
if self.stop is not None: num_ex = self.num_examples()
num_ex = self.num_examples() if self.stop is not None and self.stop > num_ex:
if self.stop > num_ex: # Warn once, then cap stop
# Warn once, then cap stop logger.warning(
logger.warning( f"Stop parameter ({self.stop}) exceeds dataset size ({num_ex}). "
f"Stop parameter ({self.stop}) exceeds dataset size ({num_ex}). " f"Using {num_ex} examples instead."
f"Using {num_ex} examples instead." )
) self.stop = num_ex
self.stop = num_ex stop = num_ex if self.stop is None else self.stop
stop = self.stop
else:
stop = self.num_examples()
step = self.step step = self.step
span = stop - start span = stop - start
num = (span + step - 1) // step # ceil_div(span, step) num = (span + step - 1) // step # ceil_div(span, step)