Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@
/run/

__pycache__/

CLAUDE.md
8 changes: 7 additions & 1 deletion src/mgds/pipelineModules/InlineAspectBatchSorting.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ def approximate_length(self) -> int:
return len(self.in_index_list)

def has_next(self) -> bool:
if self.current_resolution is None and self.next_in_cache_index < len(self.in_index_list):
self.__fill_cache()
return self.__has_next

def get_inputs(self) -> list[str]:
Expand Down Expand Up @@ -82,7 +84,11 @@ def start(self, variation: int, start_index: int):
self.in_index_list = self.__shuffle(variation)
self.next_in_cache_index = start_index
self.current_resolution = None
self.__fill_cache()
self.__has_next = False
# __fill_cache is deferred to has_next() so the first bucket is
# materialized on first batch request rather than during
# start_next_epoch, where upstream caching modules (DiskCache)
# may have moved encoder weights off the train device.

def get_next_item(self) -> dict:
bucket = self.bucket_dict[self.current_resolution]
Expand Down