Remove AcceleratorConnector.parallel_devices (#12075)

This commit is contained in:
DuYicong515 2022-03-24 18:45:40 -07:00 committed by GitHub
parent b5b951b05a
commit cfc971700d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 7 deletions

View File

@ -795,6 +795,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Removed `AcceleratorConnector.devices` property ([#12435](https://github.com/PyTorchLightning/pytorch-lightning/pull/12435))
- Removed `AcceleratorConnector.parallel_devices` property ([#12075](https://github.com/PyTorchLightning/pytorch-lightning/pull/12075))
### Fixed
- Fixed an issue where `ModelCheckpoint` could delete older checkpoints when `dirpath` has changed during resumed training ([#12045](https://github.com/PyTorchLightning/pytorch-lightning/pull/12045))

View File

@ -775,10 +775,6 @@ class AcceleratorConnector:
of accessing this information through the strategy/accelerator directly."""
# TODO: deprecate all properties below
@property
def parallel_devices(self) -> List[Union[torch.device, int]]:
return self._parallel_devices
@property
def tpu_cores(self) -> Optional[Union[List[int], int]]:
if isinstance(self.accelerator, TPUAccelerator):

View File

@ -56,7 +56,7 @@ def test_accelerator_registry_with_new_accelerator():
trainer = Trainer(accelerator=accelerator_name, devices="auto")
assert isinstance(trainer.accelerator, CustomAccelerator)
assert trainer._accelerator_connector.parallel_devices == ["foo"] * 3
assert trainer.strategy.parallel_devices == ["foo"] * 3
AcceleratorRegistry.remove(accelerator_name)
assert accelerator_name not in AcceleratorRegistry

View File

@ -51,9 +51,9 @@ def test_pluggable_accelerator():
trainer = Trainer(accelerator=TestAccelerator(), devices=2, strategy="ddp")
assert isinstance(trainer.accelerator, TestAccelerator)
assert isinstance(trainer.strategy, DDPStrategy)
assert trainer._accelerator_connector.parallel_devices == ["foo"] * 2
assert trainer.strategy.parallel_devices == ["foo"] * 2
trainer = Trainer(strategy=DDPStrategy(TestAccelerator()), devices="auto")
assert isinstance(trainer.accelerator, TestAccelerator)
assert isinstance(trainer.strategy, DDPStrategy)
assert trainer._accelerator_connector.parallel_devices == ["foo"] * 3
assert trainer.strategy.parallel_devices == ["foo"] * 3