From 21057d0064451053daa962763159730f37e2a30c Mon Sep 17 00:00:00 2001 From: William Falcon Date: Fri, 6 Mar 2020 18:14:03 -0500 Subject: [PATCH] Fixes print issues and data_loader (#1080) * print issue * print issue * print issue * print issue * print issue --- pytorch_lightning/__init__.py | 2 ++ pytorch_lightning/core/__init__.py | 3 ++- pytorch_lightning/core/lightning.py | 8 +------- pytorch_lightning/trainer/trainer.py | 3 ++- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/pytorch_lightning/__init__.py b/pytorch_lightning/__init__.py index 68c843b79a..bf83f022b0 100644 --- a/pytorch_lightning/__init__.py +++ b/pytorch_lightning/__init__.py @@ -27,10 +27,12 @@ else: from .core import LightningModule from .trainer import Trainer from .callbacks import Callback + from .core import data_loader __all__ = [ 'Trainer', 'LightningModule', 'Callback', + 'data_loader' ] # __call__ = __all__ diff --git a/pytorch_lightning/core/__init__.py b/pytorch_lightning/core/__init__.py index a15ec90bf3..fac76ffd61 100644 --- a/pytorch_lightning/core/__init__.py +++ b/pytorch_lightning/core/__init__.py @@ -312,7 +312,8 @@ LightningModule Class """ +from .decorators import data_loader from .lightning import LightningModule -__all__ = ['LightningModule'] +__all__ = ['LightningModule', 'data_loader'] # __call__ = __all__ diff --git a/pytorch_lightning/core/lightning.py b/pytorch_lightning/core/lightning.py index 2fc83e5d40..11a64acb59 100644 --- a/pytorch_lightning/core/lightning.py +++ b/pytorch_lightning/core/lightning.py @@ -85,7 +85,7 @@ class LightningModule(ABC, GradInformation, ModelIO, ModelHooks): """ if self.trainer.proc_rank == 0: - log.info(*args, **kwargs) + print(*args, **kwargs) @abstractmethod def forward(self, *args, **kwargs): @@ -1189,9 +1189,6 @@ class LightningModule(ABC, GradInformation, ModelIO, ModelHooks): .. note:: If you don't need a test dataset and a test_step, you don't need to implement this method. - .. note:: If you want to change the data during every epoch DON'T use the data_loader - decorator. - """ return None @@ -1257,9 +1254,6 @@ class LightningModule(ABC, GradInformation, ModelIO, ModelHooks): .. note:: If you don't need a validation dataset and a validation_step, you don't need to implement this method. - .. note:: If you want to change the data during every epoch DON'T use the data_loader - decorator. - .. note:: In the case where you return multiple `val_dataloaders`, the `validation_step` will have an argument `dataset_idx` which matches the order here. """ diff --git a/pytorch_lightning/trainer/trainer.py b/pytorch_lightning/trainer/trainer.py index 12eeeb5b2b..8c5a906fc3 100644 --- a/pytorch_lightning/trainer/trainer.py +++ b/pytorch_lightning/trainer/trainer.py @@ -558,8 +558,9 @@ class Trainer( # feed to .fit() """ - # bind logger + # bind logger and other properties model.logger = self.logger + self.copy_trainer_model_properties(model) # set up the passed in dataloaders (if needed) self.__attach_dataloaders(model, train_dataloader, val_dataloaders, test_dataloaders)