Skip to content

Commit eacece1

Browse files
authored
avoid suppressing exception in FitLoop (#9206)
1 parent 65b3dc4 commit eacece1

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

pytorch_lightning/loops/fit_loop.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
# limitations under the License.
1414

1515
import logging
16-
from contextlib import suppress
1716
from typing import Any, Dict, Optional
1817

1918
from pytorch_lightning.loops import Loop
@@ -181,8 +180,7 @@ def on_advance_start(self) -> None:
181180
self.trainer.train_dataloader.load_state_dict(self._dataloader_state_dict)
182181
self._dataloader_state_dict = {}
183182

184-
# TODO: specify the possible exception
185-
with suppress(Exception):
183+
if callable(getattr(self.trainer.train_dataloader.sampler, "set_epoch", None)):
186184
# set seed for distributed sampler (enables shuffling for each epoch)
187185
self.trainer.train_dataloader.sampler.set_epoch(self.current_epoch)
188186

0 commit comments

Comments
 (0)