Skip to content

Commit 4de1bb4

Browse files
committed
run precommit
1 parent 1346e44 commit 4de1bb4

File tree

2 files changed

+57
-166
lines changed

2 files changed

+57
-166
lines changed

torchdata/stateful_dataloader/sampler.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,18 +109,15 @@ def load_state_dict(self, state_dict: Dict[str, Any]) -> None:
109109
assert isinstance(self.sampler_iter, Stateful)
110110
self.sampler_iter.load_state_dict(state_dict[self._SAMPLER_ITER_STATE])
111111

112-
if not (
113-
isinstance(self.sampler, Stateful)
114-
or isinstance(self.sampler_iter, Stateful)
115-
) and not isinstance(self.sampler, _InfiniteConstantSampler):
112+
if not (isinstance(self.sampler, Stateful) or isinstance(self.sampler_iter, Stateful)) and not isinstance(
113+
self.sampler, _InfiniteConstantSampler
114+
):
116115
# We skip x samples if underlying sampler is not stateful
117116
for _ in range(self.samples_yielded):
118117
next(self.sampler_iter)
119118

120119
def update_state_dict(self) -> None:
121-
if isinstance(self.sampler_iter, Stateful) and hasattr(
122-
self.sampler_iter, "update_state_dict"
123-
):
120+
if isinstance(self.sampler_iter, Stateful) and hasattr(self.sampler_iter, "update_state_dict"):
124121
self.sampler_iter.update_state_dict()
125122

126123

0 commit comments

Comments
 (0)