-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: rohitgr7 <[email protected]>
- Loading branch information
1 parent
71e25f3
commit a775804
Showing
14 changed files
with
70 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,54 +6,32 @@ Plugins | |
|
||
.. include:: ../links.rst | ||
|
||
Plugins allow custom integrations to the internals of the Trainer such as a custom precision or | ||
distributed implementation. | ||
Plugins allow custom integrations to the internals of the Trainer such as custom precision, checkpointing or | ||
cluster environment implementation. | ||
|
||
Under the hood, the Lightning Trainer is using plugins in the training routine, added automatically | ||
depending on the provided Trainer arguments. For example: | ||
depending on the provided Trainer arguments. | ||
|
||
.. code-block:: python | ||
# accelerator: GPUAccelerator | ||
# training strategy: DDPStrategy | ||
# precision: NativeMixedPrecisionPlugin | ||
trainer = Trainer(accelerator="gpu", devices=4, precision=16) | ||
We expose Accelerators and Plugins mainly for expert users that want to extend Lightning for: | ||
|
||
- New hardware (like TPU plugin) | ||
- Distributed backends (e.g. a backend not yet supported by | ||
`PyTorch <https://pytorch.org/docs/stable/distributed.html#backends>`_ itself) | ||
- Clusters (e.g. customized access to the cluster's environment interface) | ||
|
||
There are two types of Plugins in Lightning with different responsibilities: | ||
|
||
Strategy | ||
-------- | ||
|
||
- Launching and teardown of training processes (if applicable) | ||
- Setup communication between processes (NCCL, GLOO, MPI, ...) | ||
- Provide a unified communication interface for reduction, broadcast, etc. | ||
- Provide access to the wrapped LightningModule | ||
There are three types of Plugins in Lightning with different responsibilities: | ||
|
||
- Precision Plugins | ||
- CheckpointIO Plugins | ||
- Cluster Environments | ||
|
||
Furthermore, for multi-node training Lightning provides cluster environment plugins that allow the advanced user | ||
to configure Lightning to integrate with a :ref:`custom-cluster`. | ||
|
||
***************** | ||
Precision Plugins | ||
***************** | ||
|
||
.. image:: ../_static/images/accelerator/overview.svg | ||
|
||
|
||
The full list of built-in plugins is listed below. | ||
|
||
We provide precision plugins for you to benefit from numerical representations with lower precision than | ||
32-bit floating-point or higher precision, such as 64-bit floating-point. | ||
|
||
.. warning:: The Plugin API is in beta and subject to change. | ||
For help setting up custom plugins/accelerators, please reach out to us at **[email protected]** | ||
.. code-block:: python | ||
# Training with 16-bit precision | ||
trainer = Trainer(precision=16) | ||
Precision Plugins | ||
----------------- | ||
The full list of built-in precision plugins is listed below. | ||
|
||
.. currentmodule:: pytorch_lightning.plugins.precision | ||
|
||
|
@@ -74,9 +52,39 @@ Precision Plugins | |
TPUBf16PrecisionPlugin | ||
TPUPrecisionPlugin | ||
|
||
More information regarding precision with Lightning can be found :doc:`here <../advanced/precision>` | ||
|
||
----------- | ||
|
||
******************** | ||
CheckpointIO Plugins | ||
******************** | ||
|
||
As part of our commitment to extensibility, we have abstracted Lightning's checkpointing logic into the :class:`~pytorch_lightning.plugins.io.CheckpointIO` plugin. | ||
With this, you have the ability to customize the checkpointing logic to match the needs of your infrastructure. | ||
|
||
Below is a list of built-in plugins for checkpointing. | ||
|
||
.. currentmodule:: pytorch_lightning.plugins.io | ||
|
||
.. autosummary:: | ||
:nosignatures: | ||
:template: classtemplate.rst | ||
|
||
CheckpointIO | ||
HPUCheckpointIO | ||
TorchCheckpointIO | ||
XLACheckpointIO | ||
|
||
You could learn more about custom checkpointing with Lightning :ref:`here <customize_checkpointing>`. | ||
|
||
----------- | ||
|
||
******************** | ||
Cluster Environments | ||
-------------------- | ||
******************** | ||
|
||
You can define the interface of your own cluster environment based on the requirements of your infrastructure. | ||
|
||
.. currentmodule:: pytorch_lightning.plugins.environments | ||
|
||
|
@@ -85,8 +93,8 @@ Cluster Environments | |
:template: classtemplate.rst | ||
|
||
ClusterEnvironment | ||
KubeflowEnvironment | ||
LightningEnvironment | ||
LSFEnvironment | ||
TorchElasticEnvironment | ||
KubeflowEnvironment | ||
SLURMEnvironment | ||
TorchElasticEnvironment |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters