From e02857fccea181668cd9264401d92da80ddd6aa9 Mon Sep 17 00:00:00 2001 From: William Falcon Date: Thu, 18 Jul 2019 11:33:51 -0400 Subject: [PATCH] set dp as default backend --- pytorch_lightning/models/trainer.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pytorch_lightning/models/trainer.py b/pytorch_lightning/models/trainer.py index 8ee004adb3..655316ed3a 100644 --- a/pytorch_lightning/models/trainer.py +++ b/pytorch_lightning/models/trainer.py @@ -363,9 +363,6 @@ class Trainer(TrainerIO): # filter out the weights that were done on gpu so we can load on good old cpus self.optimizers = model.configure_optimizers() - # attach model to DP - model = LightningDataParallel(model, device_ids=self.data_parallel_device_ids) - # run through amp wrapper if self.use_amp: # An example @@ -374,6 +371,9 @@ class Trainer(TrainerIO): ) self.optimizers = optimizers + if self.on_gpu: + model = LightningDataParallel(model, device_ids=self.data_parallel_device_ids) + self.__run_pretrain_routine(model) def ddp_train(self, gpu_nb, model):