avoid suppressing exception in `FitLoop` (#9206)
This commit is contained in:
parent
65b3dc4495
commit
eacece1c3f
|
@ -13,7 +13,6 @@
|
|||
# limitations under the License.
|
||||
|
||||
import logging
|
||||
from contextlib import suppress
|
||||
from typing import Any, Dict, Optional
|
||||
|
||||
from pytorch_lightning.loops import Loop
|
||||
|
@ -181,8 +180,7 @@ class FitLoop(Loop):
|
|||
self.trainer.train_dataloader.load_state_dict(self._dataloader_state_dict)
|
||||
self._dataloader_state_dict = {}
|
||||
|
||||
# TODO: specify the possible exception
|
||||
with suppress(Exception):
|
||||
if callable(getattr(self.trainer.train_dataloader.sampler, "set_epoch", None)):
|
||||
# set seed for distributed sampler (enables shuffling for each epoch)
|
||||
self.trainer.train_dataloader.sampler.set_epoch(self.current_epoch)
|
||||
|
||||
|
|
Loading…
Reference in New Issue