File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change 2020from torch .utils .data import DataLoader , Dataset , IterableDataset
2121
2222from pytorch_lightning .core .hooks import CheckpointHooks , DataHooks
23- from pytorch_lightning .utilities import rank_zero_only
2423from pytorch_lightning .utilities .argparse import add_argparse_args , from_argparse_args , get_init_arguments_and_types
25- from pytorch_lightning .utilities .distributed import rank_zero_deprecation
24+ from pytorch_lightning .utilities .distributed import rank_zero_deprecation , rank_zero_only , rank_zero_warn
2625
2726
2827class LightningDataModule (CheckpointHooks , DataHooks ):
@@ -434,8 +433,13 @@ def wrapped_fn(*args: str, **kwargs: Optional[str]) -> Any:
434433 has_run = obj ._has_prepared_data
435434 obj ._has_prepared_data = True
436435
437- if not has_run :
438- return fn (* args , ** kwargs )
436+ if has_run :
437+ rank_zero_warn (
438+ f"DataModule.{ name } has already been called, so it will not be called again. "
439+ f"In v1.6 this behavior will change to always call DataModule.{ name } ."
440+ )
441+ else :
442+ fn (* args , ** kwargs )
439443
440444 return wrapped_fn
441445
You can’t perform that action at this time.
0 commit comments