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-pytorch/common/gradient_accumulation.rst
+4-12Lines changed: 4 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,25 +19,17 @@ effective batch size is increased but there is no memory overhead.
19
19
# Accumulate gradients for 7 batches
20
20
trainer = Trainer(accumulate_grad_batches=7)
21
21
22
-
You can set different values for it at different epochs by passing a dictionary, where the key represents the epoch at which the value for gradient accumulation
23
-
should be updated.
24
-
25
-
.. testcode::
26
-
27
-
# till 5th epoch, it will accumulate every 8 batches. From 5th epoch
28
-
# till 9th epoch it will accumulate every 4 batches and after that no accumulation
29
-
# will happen. Note that you need to use zero-indexed epoch keys here
Or, you can create custom :class:`~pytorch_lightning.callbacks.gradient_accumulation_scheduler.GradientAccumulationScheduler`
22
+
Optionally, you can make the ``accumulate_grad_batches`` value change over time by using the :class:`~pytorch_lightning.callbacks.gradient_accumulation_scheduler.GradientAccumulationScheduler`.
23
+
Pass in a scheduling dictionary, where the key represents the epoch at which the value for gradient accumulation should be updated.
33
24
34
25
.. testcode::
35
26
36
27
from pytorch_lightning.callbacks import GradientAccumulationScheduler
37
28
38
-
39
29
# till 5th epoch, it will accumulate every 8 batches. From 5th epoch
40
30
# till 9th epoch it will accumulate every 4 batches and after that no accumulation
41
31
# will happen. Note that you need to use zero-indexed epoch keys here
Copy file name to clipboardExpand all lines: src/lightning/pytorch/CHANGELOG.md
+8Lines changed: 8 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -241,8 +241,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
241
241
242
242
- Removed the `using_lbfgs` argument from `LightningModule.optimizer_step` hook ([#16538](https://github.com/Lightning-AI/lightning/pull/16538))
243
243
244
+
244
245
- Removed the `Trainer.data_parallel` property. Use `isinstance(trainer.strategy, ParallelStrategy)` instead ([#16703](https://github.com/Lightning-AI/lightning/pull/16703))
245
246
247
+
246
248
- Removed support for multiple optimizers in automatic optimization mode ([#16539](https://github.com/Lightning-AI/lightning/pull/16539))
247
249
* Removed `opt_idx` argument from `BaseFinetuning.finetune_function` callback method
248
250
* Removed `opt_idx` argument from `Callback.on_before_optimizer_step` callback method
@@ -265,10 +267,16 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Removed the unused `lightning.pytorch.utilities.metrics.metrics_to_scalars` function ([#16681](https://github.com/Lightning-AI/lightning/pull/16681))
269
272
273
+
274
+
- Removed support for passing a scheduling dictionary to `Trainer(accumulate_grad_batches=...)` ([#16729](https://github.com/Lightning-AI/lightning/pull/16729))
275
+
276
+
270
277
- Removed the unused `lightning.pytorch.utilities.supporters.{SharedCycleIteratorState,CombinedLoaderIterator}` classes ([#16714](https://github.com/Lightning-AI/lightning/pull/16714))
0 commit comments