diff --git a/docs/source-pytorch/common/trainer.rst b/docs/source-pytorch/common/trainer.rst index cc8b57a182..caad2a9f21 100644 --- a/docs/source-pytorch/common/trainer.rst +++ b/docs/source-pytorch/common/trainer.rst @@ -1597,6 +1597,16 @@ The number of epochs run. if trainer.current_epoch >= 10: ... + +datamodule +********** + +The current datamodule, which is used by the trainer. + +.. code-block:: python + + used_datamodule = trainer.datamodule + is_last_batch ************* @@ -1694,6 +1704,17 @@ The metrics sent to the progress bar. assert progress_bar_metrics["a_val"] == 2 +predict_dataloaders +******************* + +The current predict dataloaders of the trainer. +Note that property returns a list of predict dataloaders. + +.. code-block:: python + + used_predict_dataloaders = trainer.predict_dataloaders + + estimated_stepping_batches ************************** @@ -1773,3 +1794,37 @@ both conditions are met. If any of these arguments is not set, it won't be consi trainer = Trainer(min_steps=5, min_epochs=5, max_epochs=100) model = LitModel() trainer.fit(model) + + +train_dataloader +**************** + +The current train dataloader of the trainer. + +.. code-block:: python + + used_train_dataloader = trainer.train_dataloader + + +test_dataloaders +**************** + +The current test dataloaders of the trainer. +Note that property returns a list of test dataloaders. + + +.. code-block:: python + + used_test_dataloaders = trainer.test_dataloaders + +val_dataloaders +*************** + + +The current val dataloaders of the trainer. +Note that property returns a list of val dataloaders. + + +.. code-block:: python + + used_val_dataloaders = trainer.val_dataloaders diff --git a/docs/source-pytorch/data/datamodule.rst b/docs/source-pytorch/data/datamodule.rst index fbee2e80e4..4a6bce7029 100644 --- a/docs/source-pytorch/data/datamodule.rst +++ b/docs/source-pytorch/data/datamodule.rst @@ -412,6 +412,10 @@ the method runs on the correct devices). dm.setup(stage="test") trainer.test(datamodule=dm) +You can access the current used datamodule of a trainer via ``trainer.datamodule`` and the current used +dataloaders via ``trainer.train_dataloader``, ``trainer.val_dataloaders`` and ``trainer.test_dataloaders``. + + ---------------- *****************************