You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/source/extensions/loops.rst
+11-11Lines changed: 11 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -81,7 +81,7 @@ The core research logic is simply shifted to the :class:`~pytorch_lightning.core
81
81
loss.backward()
82
82
optimizer.step()
83
83
84
-
Under the hood, the above loop is implemented using the :class:`~pytorch_lightning.loops.base.Loop` API like so:
84
+
Under the hood, the above loop is implemented using the :class:`~pytorch_lightning.loops.loop.Loop` API like so:
85
85
86
86
.. code-block:: python
87
87
@@ -183,7 +183,7 @@ Now your code is FULLY flexible and you can still leverage ALL the best parts of
183
183
Creating a New Loop From Scratch
184
184
--------------------------------
185
185
186
-
You can also go wild and implement a full loop from scratch by sub-classing the :class:`~pytorch_lightning.loops.base.Loop` base class.
186
+
You can also go wild and implement a full loop from scratch by sub-classing the :class:`~pytorch_lightning.loops.loop.Loop` base class.
187
187
You will need to override a minimum of two things:
188
188
189
189
.. code-block:: python
@@ -222,7 +222,7 @@ Loop API
222
222
--------
223
223
Here is the full API of methods available in the Loop base class.
224
224
225
-
The :class:`~pytorch_lightning.loops.base.Loop` class is the base of all loops in the same way as the :class:`~pytorch_lightning.core.module.LightningModule` is the base of all models.
225
+
The :class:`~pytorch_lightning.loops.loop.Loop` class is the base of all loops in the same way as the :class:`~pytorch_lightning.core.module.LightningModule` is the base of all models.
226
226
It defines a public interface that each loop implementation must follow, the key ones are:
Copy file name to clipboardExpand all lines: docs/source/extensions/loops_advanced.rst
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,7 @@ A powerful property of the class-based loop interface is that it can own an inte
18
18
Loop instances can save their state to the checkpoint through corresponding hooks and if implemented accordingly, resume the state of execution at the appropriate place.
19
19
This design is particularly interesting for fault-tolerant training which is an experimental feature released in Lightning v1.5.
20
20
21
-
The two hooks :meth:`~pytorch_lightning.loops.base.Loop.on_save_checkpoint` and :meth:`~pytorch_lightning.loops.base.Loop.on_load_checkpoint` function very similarly to how LightningModules and Callbacks save and load state.
21
+
The two hooks :meth:`~pytorch_lightning.loops.loop.Loop.on_save_checkpoint` and :meth:`~pytorch_lightning.loops.loop.Loop.on_load_checkpoint` function very similarly to how LightningModules and Callbacks save and load state.
22
22
23
23
.. code-block:: python
24
24
@@ -30,9 +30,9 @@ The two hooks :meth:`~pytorch_lightning.loops.base.Loop.on_save_checkpoint` and
30
30
defon_load_checkpoint(self, state_dict):
31
31
self.iteration = state_dict["iteration"]
32
32
33
-
When the Trainer is restarting from a checkpoint (e.g., through :code:`trainer.fit(ckpt_path=...)`), the loop exposes a boolean attribute :attr:`~pytorch_lightning.loops.base.Loop.restarting`.
33
+
When the Trainer is restarting from a checkpoint (e.g., through :code:`trainer.fit(ckpt_path=...)`), the loop exposes a boolean attribute :attr:`~pytorch_lightning.loops.loop.Loop.restarting`.
34
34
Based around the value of this variable, the user can write the loop in such a way that it can restart from an arbitrary point given the state loaded from the checkpoint.
35
-
For example, the implementation of the :meth:`~pytorch_lightning.loops.base.Loop.reset` method could look like this given our previous example:
35
+
For example, the implementation of the :meth:`~pytorch_lightning.loops.loop.Loop.reset` method could look like this given our previous example:
0 commit comments