Skip to content

Commit

Permalink
fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
four4fish committed Feb 3, 2022
1 parent c2c3ab0 commit 2134c3b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions pytorch_lightning/trainer/connectors/accelerator_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,7 @@ def _set_parallel_devices_and_init_accelerator(self):
)

self._gpus = self._device_flag if not self._gpus else self._gpus
self._tpu_cores = self._device_flag if not self._tpu_cores else self._tpu_cores

def _choose_and_init_cluster_environment(self):
self.cluster_environment = LightningEnvironment()
Expand All @@ -484,7 +485,7 @@ def _is_slurm_managing_tasks(self):
return num_slurm_tasks == total_requested_devices

def _choose_strategy(self):
if self._accelerator_flag == "ipu_strategy":
if self._accelerator_flag == "ipu":
self._strategy_flag = "ipu_strategy"
elif self._accelerator_flag == "tpu":
if self._parallel_devices and len(self._parallel_devices) > 1:
Expand Down Expand Up @@ -757,15 +758,15 @@ def devices(self):
return 0

@property
def tpu_cores(self) -> int:
def tpu_cores(self):
if isinstance(self.accelerator, TPUAccelerator):
return self.devices
return self._tpu_cores
return 0

@property
def tpu_id(self) -> Optional[int]:
if isinstance(self.accelerator, TPUAccelerator):
return self.parallel_devices[0]
return self.tpu_cores[0]
return None

@property
Expand Down
2 changes: 1 addition & 1 deletion tests/accelerators/test_ipu.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def test_accelerator_selected(tmpdir):
@RunIf(ipu=True)
def test_warning_if_ipus_not_used(tmpdir):
with pytest.warns(UserWarning, match="IPU available but not used. Set the `ipus` flag in your trainer"):
Trainer(default_root_dir=tmpdir)
Trainer(default_root_dir=tmpdir, accelerator="cpu")


@RunIf(ipu=True)
Expand Down

0 comments on commit 2134c3b

Please sign in to comment.