Skip to content

Commit

Permalink
Add additional model to device hook if any additional parameters have…
Browse files Browse the repository at this point in the history
… been set
  • Loading branch information
SeanNaren committed Mar 17, 2021
1 parent 72097ba commit bd2a53a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pytorch_lightning/plugins/training_type/single_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,12 @@ def model_to_device(self) -> None:
self._model.to(self.root_device)

def pre_dispatch(self) -> None:
# Ensures any additional parameters defined in setup are moved to the correct device.
self.model_to_device()

def connect(self, model: torch.nn.Module) -> torch.nn.Module:
self._model = model
self.model_to_device()
return self.model

@property
Expand Down

0 comments on commit bd2a53a

Please sign in to comment.