Skip to content

Commit

Permalink
Forcing the model to device in the setup client for safety, as we do …
Browse files Browse the repository at this point in the history
…this, for example, to the batches in training as well.
  • Loading branch information
emersodb committed Oct 11, 2023
1 parent 08d179a commit ceb2da5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fl4health/clients/basic_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,8 @@ def setup_client(self, config: Config) -> None:
"""
Set dataloaders, optimizers, parameter exchangers and other attributes derived from these.
"""
self.model = self.get_model(config)
# Explicitly send the model to the desired device. This is idempotent.
self.model = self.get_model(config).to(self.device)
train_loader, val_loader = self.get_data_loaders(config)
self.train_loader = train_loader
self.val_loader = val_loader
Expand Down

0 comments on commit ceb2da5

Please sign in to comment.