Skip to content
Closed
Show file tree
Hide file tree
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
26 changes: 17 additions & 9 deletions docs/source-pytorch/common/checkpointing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,33 +12,41 @@ Checkpointing
.. Add callout items below this line

.. displayitem::
:header: Basic
:header: Saving and loading checkpoints
:description: Learn to save and load checkpoints
:col_css: col-md-3
:col_css: col-md-4
:button_link: checkpointing_basic.html
:height: 150
:tag: basic

.. displayitem::
:header: Intermediate
:description: Customize checkpointing behavior
:col_css: col-md-3
:header: Customize checkpointing behavior
:description: Learn how to change the behavior of checkpointing
:col_css: col-md-4
:button_link: checkpointing_intermediate.html
:height: 150
:tag: intermediate

.. displayitem::
:header: Advanced
:header: Upgrading checkpoints
:description: Learn how to upgrade old checkpoints to the newest Lightning version
:col_css: col-md-4
:button_link: checkpointing_migration.html
:height: 150
:tag: intermediate

.. displayitem::
:header: Cloud-based checkpoints
:description: Enable cloud-based checkpointing and composable checkpoints.
:col_css: col-md-3
:col_css: col-md-4
:button_link: checkpointing_advanced.html
:height: 150
:tag: advanced

.. displayitem::
:header: Expert
:header: Distributed checkpoints
:description: Customize checkpointing for custom distributed strategies and accelerators.
:col_css: col-md-3
:col_css: col-md-4
:button_link: checkpointing_expert.html
:height: 150
:tag: expert
Expand Down
6 changes: 3 additions & 3 deletions docs/source-pytorch/common/checkpointing_advanced.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.. _checkpointing_advanced:

########################
Checkpointing (advanced)
########################
##################################
Cloud-based checkpoints (advanced)
##################################


*****************
Expand Down
6 changes: 3 additions & 3 deletions docs/source-pytorch/common/checkpointing_basic.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

.. _checkpointing_basic:

#####################
Checkpointing (basic)
#####################
######################################
Saving and loading checkpoints (basic)
######################################
**Audience:** All users

----
Expand Down
6 changes: 3 additions & 3 deletions docs/source-pytorch/common/checkpointing_expert.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

.. _checkpointing_expert:

######################
Checkpointing (expert)
######################
################################
Distributed checkpoints (expert)
################################

*********************************
Writing your own Checkpoint class
Expand Down
6 changes: 3 additions & 3 deletions docs/source-pytorch/common/checkpointing_intermediate.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

.. _checkpointing_intermediate:

############################
Checkpointing (intermediate)
############################
###############################################
Customize checkpointing behavior (intermediate)
###############################################
**Audience:** Users looking to customize the checkpointing behavior

----
Expand Down
44 changes: 44 additions & 0 deletions docs/source-pytorch/common/checkpointing_migration.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
:orphan:

.. _checkpointing_basic:

####################################
Upgrading checkpoints (intermediate)
####################################
**Audience:** Users who are upgrading Lightning and their code and want to reuse their old checkpoints.

----

**************************************
Resume training from an old checkpoint
**************************************

Next to the model weights and trainer state, a Lightning checkpoint contains the version number of Lightning with which the checkpoint was saved.
When you load a checkpoint file, either by resuming training

.. code-block:: python

trainer = Trainer(...)
trainer.fit(model, ckpt_path="path/to/checkpoint.ckpt")

or by loading the state directly into your model,

.. code-block:: python

model = LitModel.load_from_checkpoint("path/to/checkpoint.ckpt")

Lightning will automatically recognize that it is from an older version and migrates the internal structure so it can be loaded properly.
This is done without any action required by the user.

----

************************************
Upgrade checkpoint files permanently
************************************

When Lightning loads a checkpoint, it applies the version migration on-the-fly as explained above, but it does not modify your checkpoint files.
You can upgrade checkpoint files permanently with the following command:

.. code-block:: python

python -m lightning.pytorch.utilities.upgrade_checkpoint --file model.ckpt