further cleanup

This commit is contained in:
Sofie Van Landeghem 2025-11-22 22:50:34 +01:00 committed by GitHub
parent df9a644e24
commit c09b897601
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -37,16 +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:
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 = self.num_examples() if self.stop is None else self.stop
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)