Skip to content

Commit

Permalink
fix back-compatibility for Accel (#6655)
Browse files Browse the repository at this point in the history
  • Loading branch information
Borda committed Mar 23, 2021
1 parent 0995d30 commit 3cf0c31
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions pytorch_lightning/accelerators/accelerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from pytorch_lightning.plugins.precision import ApexMixedPrecisionPlugin, NativeMixedPrecisionPlugin, PrecisionPlugin
from pytorch_lightning.plugins.training_type import TrainingTypePlugin
from pytorch_lightning.trainer.states import TrainerState
from pytorch_lightning.utilities import rank_zero_warn
from pytorch_lightning.utilities.apply_func import move_data_to_device
from pytorch_lightning.utilities.enums import AMPType, LightningEnum

Expand Down Expand Up @@ -437,3 +438,27 @@ def results(self) -> Any:
In distributed training, we make sure to transfer the results to the appropriate master process.
"""
return self.training_type_plugin.results

# todo: remove in v1.5
def connect_training_type_plugin(self, plugin: TrainingTypePlugin, model: LightningModule) -> None:
"""
Attaches the training type plugin to the accelerator.
Also transfers ownership of the model to this plugin
.. deprecated::v1.3
Will be removed in v1.5.0.
"""
rank_zero_warn('Accelerator method `connect_training_type_plugin` was deprecated in v1.3.'
' It will be removed in v1.5.')
self.setup_training_type_plugin(plugin, model)

# todo: remove in v1.5
def connect_precision_plugin(self, plugin: PrecisionPlugin) -> None:
"""Attaches the precision plugin to the accelerator
.. deprecated::v1.3
Will be removed in v1.5.0.
"""
rank_zero_warn('Accelerator method `connect_precision_plugin` was deprecated in v1.3.'
' It will be removed in v1.5.')
self.setup_precision_plugin(plugin)

0 comments on commit 3cf0c31

Please sign in to comment.