Skip to content

Commit

Permalink
Custom Plugin is_distributed (#6537)
Browse files Browse the repository at this point in the history
* return from plugin

* dont return for tpu

(cherry picked from commit 6a14146)
  • Loading branch information
amogkam authored and lexierule committed Mar 16, 2021
1 parent c8fb646 commit 0e8f4a8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pytorch_lightning/trainer/connectors/accelerator_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,10 @@ def use_deepspeed(self) -> bool:

@property
def is_distributed(self) -> bool:
# Used for custom plugins.
# Custom plugins should implement is_distributed property.
if hasattr(self.training_type_plugin, 'is_distributed') and not self.on_tpu:
return self.training_type_plugin.is_distributed
is_distributed = self.use_ddp or self.use_ddp2 or self.use_horovod
if self.on_tpu:
is_distributed |= self.training_type_plugin.is_distributed
Expand Down

0 comments on commit 0e8f4a8

Please sign in to comment.