Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix back-compatibility for Accel #6655

Merged
merged 1 commit into from
Mar 23, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)