Skip to content

Commit 3a401d7

Browse files
committed
chlog
1 parent 4cf1bec commit 3a401d7

File tree

3 files changed

+16
-12
lines changed

3 files changed

+16
-12
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
240240
- Deprecated `.get_model()` with explicit `.lightning_module` property ([#6035](https://github.com/PyTorchLightning/pytorch-lightning/pull/6035))
241241

242242

243+
- Deprecated Trainer attribute `accelerator_backend` in favor of `accelerator` ([#6034](https://github.com/PyTorchLightning/pytorch-lightning/pull/6034))
244+
245+
246+
243247
### Removed
244248

245249
- Removed deprecated checkpoint argument `filepath` ([#5321](https://github.com/PyTorchLightning/pytorch-lightning/pull/5321))

pytorch_lightning/trainer/deprecated_api.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,8 @@ class DeprecatedDistDeviceAttributes:
2424
_device_type: DeviceType
2525
_running_stage: RunningStage
2626
num_gpus: int
27-
accelerator: Accelerator
2827
accelerator_connector: AcceleratorConnector
2928

30-
@property
31-
def accelerator_backend(self) -> Accelerator:
32-
rank_zero_warn(
33-
"The `Trainer.accelerator_backend` attribute is deprecated in favor of `Trainer.accelerator`"
34-
" since 1.2 and will be removed in v1.4.", DeprecationWarning
35-
)
36-
return self.accelerator
37-
3829
@property
3930
def on_cpu(self) -> bool:
4031
rank_zero_warn("Internal: `on_cpu` is deprecated in v1.2 and will be removed in v1.4.", DeprecationWarning)
@@ -143,10 +134,19 @@ def use_single_gpu(self, val: bool) -> None:
143134
self.accelerator_connector._device_type = DeviceType.GPU
144135

145136

146-
class DeprecatedModelAttributes:
137+
class DeprecatedTrainerAttributes:
147138

139+
accelerator: Accelerator
148140
lightning_module = LightningModule
149141

142+
@property
143+
def accelerator_backend(self) -> Accelerator:
144+
rank_zero_warn(
145+
"The `Trainer.accelerator_backend` attribute is deprecated in favor of `Trainer.accelerator`"
146+
" since 1.2 and will be removed in v1.4.", DeprecationWarning
147+
)
148+
return self.accelerator
149+
150150
def get_model(self) -> LightningModule:
151151
rank_zero_warn(
152152
"The use of `Trainer.get_model()` is deprecated in favor of `Trainer.lightning_module`"

pytorch_lightning/trainer/trainer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
from pytorch_lightning.trainer.connectors.slurm_connector import SLURMConnector
4646
from pytorch_lightning.trainer.connectors.training_trick_connector import TrainingTricksConnector
4747
from pytorch_lightning.trainer.data_loading import TrainerDataLoadingMixin
48-
from pytorch_lightning.trainer.deprecated_api import DeprecatedDistDeviceAttributes, DeprecatedModelAttributes
48+
from pytorch_lightning.trainer.deprecated_api import DeprecatedDistDeviceAttributes, DeprecatedTrainerAttributes
4949
from pytorch_lightning.trainer.evaluation_loop import EvaluationLoop
5050
from pytorch_lightning.trainer.logging import TrainerLoggingMixin
5151
from pytorch_lightning.trainer.model_hooks import TrainerModelHooksMixin
@@ -80,7 +80,7 @@ class Trainer(
8080
TrainerTrainingTricksMixin,
8181
TrainerDataLoadingMixin,
8282
DeprecatedDistDeviceAttributes,
83-
DeprecatedModelAttributes,
83+
DeprecatedTrainerAttributes,
8484
):
8585

8686
@overwrite_by_env_vars

0 commit comments

Comments
 (0)