Skip to content

Commit

Permalink
run precommit
Browse files Browse the repository at this point in the history
  • Loading branch information
ramanishsingh committed Feb 5, 2025
1 parent 6f3abf6 commit 36c5b51
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 163 deletions.
7 changes: 3 additions & 4 deletions torchdata/stateful_dataloader/sampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,9 @@ def load_state_dict(self, state_dict: Dict[str, Any]) -> None:
assert isinstance(self.sampler_iter, Stateful)
self.sampler_iter.load_state_dict(state_dict[self._SAMPLER_ITER_STATE])

if not (
isinstance(self.sampler, Stateful)
or isinstance(self.sampler_iter, Stateful)
) and not isinstance(self.sampler, _InfiniteConstantSampler):
if not (isinstance(self.sampler, Stateful) or isinstance(self.sampler_iter, Stateful)) and not isinstance(
self.sampler, _InfiniteConstantSampler
):
# We skip x samples if underlying sampler is not stateful
for _ in range(self.samples_yielded):
next(self.sampler_iter)
Expand Down
Loading

0 comments on commit 36c5b51

Please sign in to comment.