From c09b8976013f0a346c92f5d4185e9b59b5e4b4a9 Mon Sep 17 00:00:00 2001 From: Sofie Van Landeghem Date: Sat, 22 Nov 2025 22:50:34 +0100 Subject: [PATCH] further cleanup --- tasks/common.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tasks/common.py b/tasks/common.py index e202508..1fd2c23 100644 --- a/tasks/common.py +++ b/tasks/common.py @@ -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)