Skip to content

Commit 30545d6

Browse files
WangYue0000pre-commit-ci[bot]lantiga
authored
Update checkpointing documentation to mark resume_from_checkpoint as deprecated (#20361) (#20477)
* Update checkpointing documentation to mark resume_from_checkpoint as deprecated * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update docs/source-pytorch/common/checkpointing_basic.rst Co-authored-by: Luca Antiga <luca@lightning.ai> * Update docs/source-pytorch/common/checkpointing_basic.rst Co-authored-by: Luca Antiga <luca@lightning.ai> * Address review comments * Address review comments * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Luca Antiga <luca@lightning.ai> Co-authored-by: Luca Antiga <luca.antiga@gmail.com>
1 parent 030f36b commit 30545d6

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

docs/source-pytorch/common/checkpointing_basic.rst

+23-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ PyTorch Lightning checkpoints are fully usable in plain PyTorch.
2020

2121
----
2222

23+
.. important::
24+
25+
**Important Update: Deprecated Method**
26+
27+
Starting from PyTorch Lightning v1.0.0, the `resume_from_checkpoint` argument has been deprecated. To resume training from a checkpoint, use the `ckpt_path` argument in the `fit()` method.
28+
Please update your code accordingly to avoid potential compatibility issues.
29+
2330
************************
2431
Contents of a checkpoint
2532
************************
@@ -197,16 +204,31 @@ You can disable checkpointing by passing:
197204

198205
----
199206

207+
200208
*********************
201209
Resume training state
202210
*********************
203211

204212
If you don't just want to load weights, but instead restore the full training, do the following:
205213

214+
Correct usage:
215+
206216
.. code-block:: python
207217
208218
model = LitModel()
209219
trainer = Trainer()
210220
211221
# automatically restores model, epoch, step, LR schedulers, etc...
212-
trainer.fit(model, ckpt_path="some/path/to/my_checkpoint.ckpt")
222+
trainer.fit(model, ckpt_path="path/to/your/checkpoint.ckpt")
223+
224+
.. warning::
225+
226+
The argument `resume_from_checkpoint` has been deprecated in versions of PyTorch Lightning >= 1.0.0.
227+
To resume training from a checkpoint, use the `ckpt_path` argument in the `fit()` method instead.
228+
229+
Incorrect (deprecated) usage:
230+
231+
.. code-block:: python
232+
233+
trainer = Trainer(resume_from_checkpoint="path/to/your/checkpoint.ckpt")
234+
trainer.fit(model)

0 commit comments

Comments
 (0)