Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move model to cuda before creating optimizer #554

Merged
merged 1 commit into from
Nov 27, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pytorch_lightning/trainer/dp_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ def transfer_batch_to_gpu(self, batch, gpu_id):
return batch

def single_gpu_train(self, model):
model.cuda(self.root_gpu)

# CHOOSE OPTIMIZER
# allow for lr schedulers as well
self.optimizers, self.lr_schedulers = self.init_optimizers(model.configure_optimizers())

model.cuda(self.root_gpu)

if self.use_amp:
# An example
model, optimizers = model.configure_apex(amp, model, self.optimizers, self.amp_level)
Expand Down