Skip to content

Commit

Permalink
update predict_step in ddp and ddp_spawn
Browse files Browse the repository at this point in the history
  • Loading branch information
ninginthecloud committed Aug 3, 2021
1 parent 5af7ac4 commit 6fe7e55
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
5 changes: 1 addition & 4 deletions pytorch_lightning/plugins/training_type/ddp.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,10 +399,7 @@ def test_step(self, *args, **kwargs):
return self.lightning_module.test_step(*args, **kwargs)

def predict_step(self, *args, **kwargs):
if isinstance(self.model, DistributedDataParallel):
return self.model(*args, **kwargs)
else:
return self.lightning_module.predict_step(*args, **kwargs)
return self.lightning_module.predict_step(*args, **kwargs)

def post_training_step(self):
if not self.lightning_module.automatic_optimization:
Expand Down
5 changes: 1 addition & 4 deletions pytorch_lightning/plugins/training_type/ddp_spawn.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,10 +374,7 @@ def test_step(self, *args, **kwargs):
return self.lightning_module.test_step(*args, **kwargs)

def predict_step(self, *args, **kwargs):
if isinstance(self.model, DistributedDataParallel):
return self.model(*args, **kwargs)
else:
return self.lightning_module.predict_step(*args, **kwargs)
return self.lightning_module.predict_step(*args, **kwargs)

def post_training_step(self):
if not self.lightning_module.automatic_optimization:
Expand Down

0 comments on commit 6fe7e55

Please sign in to comment.