Skip to content

Commit 379ed8c

Browse files
authored
Update migration guide for 2.1 (#18729)
1 parent fdae213 commit 379ed8c

File tree

5 files changed

+140
-3
lines changed

5 files changed

+140
-3
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
:orphan:
2+
3+
Regular User
4+
************
5+
6+
.. include:: sections/2_0_regular.rst
7+
8+
Advanced User
9+
*************
10+
11+
.. include:: sections/2_0_advanced.rst
12+
13+
Developer
14+
*********
15+
16+
.. include:: sections/2_0_devel.rst

docs/source-pytorch/upgrade/migration_guide.rst

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,26 @@
1-
2.0 upgrade guide
1+
2.0 Upgrade Guide
22
#################
33

4-
The following section will guide you through updating to the 2.0 release.
4+
The following section will guide you through updating your code to the 2.x series of releases.
55

66
Particular versions
77
*******************
88

99

10-
1110
.. raw:: html
1211

1312
<div class="display-card-container">
1413
<div class="row">
1514

1615
.. Add callout items below this line
1716
17+
.. displayitem::
18+
:header: 2.0.x
19+
:description: Upgrade from 2.0.x series to the 2.1.
20+
:col_css: col-md-12
21+
:button_link: from_2_0.html
22+
:height: 100
23+
1824
.. displayitem::
1925
:header: 1.9.x
2026
:description: Upgrade from 1.9.x series to the 2.0.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
.. list-table:: adv. user 2.0
2+
:widths: 40 40 20
3+
:header-rows: 1
4+
5+
* - If
6+
- Then
7+
- Ref
8+
9+
* - used the ``torchdistx`` package and integration in Trainer
10+
- materialize the model weights manually, or follow our :doc:`guide for initializing large models <../../advanced/model_init>`
11+
- `PR17995`_
12+
13+
* - defined ``def training_step(self, dataloader_iter, batch_idx)`` in LightningModule
14+
- remove ``batch_idx`` from the signature and expect ``dataloader_iter`` to return a triplet ``(batch, batch_idx, dataloader_idx)``
15+
- `PR18390`_
16+
17+
* - defined ``def validation_step(self, dataloader_iter, batch_idx)`` in LightningModule
18+
- remove ``batch_idx`` from the signature and expect ``dataloader_iter`` to return a triplet ``(batch, batch_idx, dataloader_idx)``
19+
- `PR18390`_
20+
21+
* - defined ``def test_step(self, dataloader_iter, batch_idx)`` in LightningModule
22+
- remove ``batch_idx`` from the signature and expect ``dataloader_iter`` to return a triplet ``(batch, batch_idx, dataloader_idx)``
23+
- `PR18390`_
24+
25+
* - defined ``def predict_step(self, dataloader_iter, batch_idx)`` in LightningModule
26+
- remove ``batch_idx`` from the signature and expect ``dataloader_iter`` to return a triplet ``(batch, batch_idx, dataloader_idx)``
27+
- `PR18390`_
28+
29+
* - used ``batch = next(dataloader_iter)`` in LightningModule ``*_step`` hooks
30+
- use ``batch, batch_idx, dataloader_idx = next(dataloader_iter)``
31+
- `PR18390`_
32+
33+
* - relied on automatic detection of Kubeflow environment
34+
- use ``Trainer(plugins=KubeflowEnvironment())`` to explicitly set it on a Kubeflow cluster
35+
- `PR18137`_
36+
37+
38+
.. _pr17995: https://github.com/Lightning-AI/lightning/pull/17995
39+
.. _pr18390: https://github.com/Lightning-AI/lightning/pull/18390
40+
.. _pr18137: https://github.com/Lightning-AI/lightning/pull/18390
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
.. list-table:: devel 2.0
2+
:widths: 40 40 20
3+
:header-rows: 1
4+
5+
* - If
6+
- Then
7+
- Ref
8+
9+
* - used the ``XLAStrategy.is_distributed`` property
10+
- it was removed because it was always True
11+
- `PR17381`_
12+
13+
* - used the ``SingleTPUStrategy.is_distributed`` property
14+
- it was removed because it was always False
15+
- `PR17381`_
16+
17+
18+
.. _pr17381: https://github.com/Lightning-AI/lightning/pull/17381
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
.. list-table:: reg. user 2.0
2+
:widths: 40 40 20
3+
:header-rows: 1
4+
5+
* - If
6+
- Then
7+
- Ref
8+
9+
* - used PyTorch 3.11
10+
- upgrade to PyTorch 2.1 or higher
11+
- `PR18691`_
12+
13+
* - called ``self.trainer.model.parameters()`` in ``LightningModule.configure_optimizers()`` when using FSDP
14+
- On PyTorch 2.0+, call ``self.parameters()`` from now on
15+
- `PR17309`_
16+
17+
* - used ``Trainer(accelerator="tpu", devices=[i])"`` to select the 1-based TPU core index
18+
- the index is now 0-based
19+
- `PR17227`_
20+
21+
* - used ``torch_xla < 1.13``
22+
- upgrade to ``torch_xla >= 1.13``
23+
- `PR17368`_
24+
25+
* - used ``trainer.num_val_batches`` to get the total size of all validation dataloaders
26+
- use ``sum(trainer.num_val_batches)``
27+
- `PR18441`_
28+
29+
* - used ``trainer.num_test_batches`` to get the total size of all test dataloaders
30+
- use ``sum(trainer.num_test_batches)``
31+
- `PR18441`_
32+
33+
* - used ``trainer.num_sanity_val_batches`` to get the total size of all validation dataloaders for sanity checking
34+
- use ``sum(trainer.num_sanity_val_batches)``
35+
- `PR18441`_
36+
37+
* - used ``Trainer(devices="auto")`` to auto-select all available GPUs in a Jupyter notebook
38+
- use ``Trainer(devices=-1)``
39+
- `PR18291`_
40+
41+
* - used ``Trainer(devices="auto")`` to auto-select all available GPUs in a Jupyter notebook
42+
- use ``Trainer(devices=-1)``
43+
- `PR18291`_
44+
45+
* - ``pip install lightning`` to install ``lightning.app`` dependencies
46+
- use ``pip install lightning[app]`` if you need ``lightning.app``
47+
- `PR18386`_
48+
49+
50+
.. _pr18691: https://github.com/Lightning-AI/lightning/pull/18691
51+
.. _pr16579: https://github.com/Lightning-AI/lightning/pull/16579
52+
.. _pr17309: https://github.com/Lightning-AI/lightning/pull/17309
53+
.. _pr17227: https://github.com/Lightning-AI/lightning/pull/17227
54+
.. _pr17368: https://github.com/Lightning-AI/lightning/pull/17368
55+
.. _pr18441: https://github.com/Lightning-AI/lightning/pull/18441
56+
.. _pr18291: https://github.com/Lightning-AI/lightning/pull/18291
57+
.. _pr18386: https://github.com/Lightning-AI/lightning/pull/18386

0 commit comments

Comments
 (0)