Skip to content

Commit a1a439d

Browse files
committed
Merge branch 'master' of https://github.com/PyTorchLightning/pytorch-lightning into ddp_spawn
2 parents 446fafd + 58de08d commit a1a439d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+882
-641
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
# Packages
2222
/pytorch_lightning/accelerators @williamfalcon @tchaton @SeanNaren @awaelchli @justusschock @kaushikb11
2323
/pytorch_lightning/callbacks @williamfalcon @tchaton @carmocca @borda @kaushikb11
24-
/pytorch_lightning/cluster_environments @borda @tchaton @SeanNaren @carmocca @kaushikb11
2524
/pytorch_lightning/core @tchaton @SeanNaren @borda @carmocca @justusschock @kaushikb11
2625
/pytorch_lightning/distributed @williamfalcon @tchaton @awaelchli @kaushikb11
2726
/pytorch_lightning/loggers @tchaton @awaelchli @borda
27+
/pytorch_lightning/loggers/wandb.py @borisdayma
2828
/pytorch_lightning/loops @tchaton @awaelchli @justusschock @carmocca
2929
/pytorch_lightning/overrides @tchaton @SeanNaren @borda
3030
/pytorch_lightning/plugins @tchaton @SeanNaren @awaelchli @justusschock
@@ -38,11 +38,6 @@
3838
/pytorch_lightning/trainer/connectors/logger_connector @tchaton @carmocca
3939
/pytorch_lightning/trainer/progress.py @tchaton @awaelchli @carmocca
4040

41-
# Metrics
42-
/pytorch_lightning/metrics/ @SkafteNicki @ananyahjha93 @justusschock
43-
/tests/metrics/ @SkafteNicki @ananyahjha93 @justusschock
44-
/docs/source/metrics.rst @SkafteNicki @ananyahjha93 @justusschock
45-
4641
# API
4742
/pytorch_lightning/callbacks/base.py @williamfalcon @awaelchli @ananthsub @carmocca
4843
/pytorch_lightning/core/datamodule.py @williamFalcon @awaelchli @ananthsub @carmocca

CHANGELOG.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
5959
* Added Fault Tolerant Training to `DataFetcher` ([#8891](https://github.com/PyTorchLightning/pytorch-lightning/pull/8891))
6060
* Replaced old prefetch iterator with new `DataFetcher` in training loop ([#8953](https://github.com/PyTorchLightning/pytorch-lightning/pull/8953))
6161
* Added partial support for global random state fault-tolerance in map-style datasets ([#8950](https://github.com/PyTorchLightning/pytorch-lightning/pull/8950))
62+
* Converted state to tuple explicitly when setting Python random state ([#9401](https://github.com/PyTorchLightning/pytorch-lightning/pull/9401))
63+
6264

6365
- Checkpoint saving & loading extensibility:
6466
* Added `CheckpointIO` to expose checkpoint IO from training type plugin ([#8743](https://github.com/PyTorchLightning/pytorch-lightning/pull/8743))
@@ -69,6 +71,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
6971
* Added `Closure` and `AbstractClosure` classes ([#8642](https://github.com/PyTorchLightning/pytorch-lightning/pull/8642))
7072
* Refactored `TrainingBatchLoop` and extracted `OptimizerLoop`, splitting off automatic optimization into its own loop ([#9191](https://github.com/PyTorchLightning/pytorch-lightning/pull/9191))
7173
* Removed `TrainingBatchLoop.backward()`; manual optimization now calls directly into `Accelerator.backward()` and automatic optimization handles backward in new `OptimizerLoop` ([#9265](https://github.com/PyTorchLightning/pytorch-lightning/pull/9265))
74+
* Extracted `ManualOptimization` logic from `TrainingBatchLoop` into its own separate loop class ([#9266](https://github.com/PyTorchLightning/pytorch-lightning/pull/9266))
7275

7376
- Added support for saving and loading state of multiple callbacks of the same type ([#7187](https://github.com/PyTorchLightning/pytorch-lightning/pull/7187))
7477

@@ -106,6 +109,13 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
106109

107110
- Added `on_exception` callback hook ([#9183](https://github.com/PyTorchLightning/pytorch-lightning/pull/9183))
108111

112+
113+
- Add a warning to deepspeed when inferring batch size ([#9221](https://github.com/PyTorchLightning/pytorch-lightning/pull/9221))
114+
115+
116+
- Added `inference_mode` for evaluation and prediction ([8813](https://github.com/PyTorchLightning/pytorch-lightning/pull/8813))
117+
118+
109119
### Changed
110120

111121
- Parsing of the `gpus` Trainer argument has changed: `gpus="n"` (str) no longer selects the GPU index n and instead selects the first n devices. ([#8770](https://github.com/PyTorchLightning/pytorch-lightning/pull/8770))
@@ -155,6 +165,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
155165
- Moved `block_ddp_sync_behaviour` out of `TrainingBatchLoop` to loop utilities ([#9192](https://github.com/PyTorchLightning/pytorch-lightning/pull/9192))
156166

157167

168+
- Executing the `optimizer_closure` is now required when overriding the `optimizer_step` hook ([#9360](https://github.com/PyTorchLightning/pytorch-lightning/pull/9360))
169+
170+
158171
### Deprecated
159172

160173
- Deprecated `LightningModule.summarize()` in favor of `pytorch_lightning.utilities.model_summary.summarize()`
@@ -169,6 +182,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
169182
- Deprecated `add_to_queue`, `get_from_queue` from `LightningModule` in favor of corresponding methods in the `DDPSpawnPlugin` ([9118](https://github.com/PyTorchLightning/pytorch-lightning/pull/9118))
170183

171184

185+
- Deprecated `LightningModule.get_progress_bar_dict` and `Trainer.progress_bar_dict` in favor of `pytorch_lightning.callbacks.progress.base.get_standard_metrics` and `ProgressBarBase.get_metrics` ([#8985](https://github.com/PyTorchLightning/pytorch-lightning/pull/8985))
186+
187+
172188
- Deprecated `prepare_data_per_node` flag on Trainer and set it as a property of `DataHooks`, accessible in the `LightningModule` and `LightningDataModule` ([#8958](https://github.com/PyTorchLightning/pytorch-lightning/pull/8958))
173189

174190

@@ -285,7 +301,13 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
285301
- Fixed `EarlyStopping` running on train epoch end when `check_val_every_n_epoch>1` is set ([#9156](https://github.com/PyTorchLightning/pytorch-lightning/pull/9156))
286302

287303

288-
- Fixed an issue with logger outputs not being finalized correctly after prediction runs ([#8333](https://github.com/PyTorchLightning/pytorch-lightning/issues/8333))
304+
- Fixed an issue with logger outputs not being finalized correctly after prediction runs ([#8685](https://github.com/PyTorchLightning/pytorch-lightning/pull/8685))
305+
306+
307+
- Fixed the Apex and DeepSpeed plugin closure running after the `on_before_optimizer_step` hook ([#9288](https://github.com/PyTorchLightning/pytorch-lightning/issues/9288))
308+
309+
310+
- Fixed the Native AMP plugin closure not running with manual optimization ([#9288](https://github.com/PyTorchLightning/pytorch-lightning/issues/9288))
289311

290312

291313
- Fixed bug where data-loading functions where not getting the correct running stage passed ([#8858](https://github.com/PyTorchLightning/pytorch-lightning/pull/8858))
@@ -309,6 +331,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
309331
- Fixed incorrect main progress bar indicator when resuming training mid-epoch ([#9310](https://github.com/PyTorchLightning/pytorch-lightning/pull/9310))
310332

311333

334+
- Fixed logging of nan parameters ([#9364](https://github.com/PyTorchLightning/pytorch-lightning/pull/9364))
335+
336+
337+
- Fixed `replace_sampler` missing the batch size under specific conditions ([#9367](https://github.com/PyTorchLightning/pytorch-lightning/pull/9367))
338+
339+
312340
## [1.4.5] - 2021-08-31
313341

314342
- Fixed reduction using `self.log(sync_dict=True, reduce_fx={mean,max})` ([#9142](https://github.com/PyTorchLightning/pytorch-lightning/pull/9142))

CITATION.cff

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
cff-version: 1.2.0
2+
message: "If you want to cite the framework, feel free to use this (but only if you loved it 😊)"
3+
title: "PyTorch Lightning"
4+
abstract: "The lightweight PyTorch wrapper for high-performance AI research. Scale your models, not the boilerplate."
5+
date-released: 2019-03-30
6+
authors:
7+
- family-names: "Falcon"
8+
given-names: "William"
9+
- name: "The PyTorch Lightning team"
10+
version: 1.4
11+
doi: 10.5281/zenodo.3828935
12+
license: "Apache-2.0"
13+
url: "https://www.pytorchlightning.ai"
14+
repository-code: "https://github.com/PyTorchLightning/pytorch-lightning"
15+
keywords:
16+
- machine learning
17+
- deep learning
18+
- artificial intelligence

MANIFEST.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ include *.md
2323
# Include the license file
2424
include LICENSE
2525

26+
# Include the citation info
27+
include *.cff
28+
2629
exclude *.sh
2730
exclude *.svg
2831
recursive-include pytorch_lightning *.py

README.md

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -429,24 +429,3 @@ grid train --grid_gpus 4 my_model.py --learning_rate 'uniform(1e-6, 1e-1, 20)' -
429429

430430
The above command will launch (20 * 4) experiments each running on 4 GPUs (320 GPUs!) - by making ZERO changes to
431431
your code.
432-
433-
______________________________________________________________________
434-
435-
## Licence
436-
437-
Please observe the Apache 2.0 license that is listed in this repository.
438-
In addition, the Lightning framework is Patent Pending.
439-
440-
## BibTeX
441-
442-
If you want to cite the framework feel free to use this (but only if you loved it 😊) or [zenodo](https://zenodo.org/record/3828935#.YC45Lc9Khqs):
443-
444-
```bibtex
445-
@article{falcon2019pytorch,
446-
title={PyTorch Lightning},
447-
author={Falcon, WA, et al.},
448-
journal={GitHub. Note: https://github.com/PyTorchLightning/pytorch-lightning},
449-
volume={3},
450-
year={2019}
451-
}
452-
```

docs/source/common/lightning_module.rst

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1242,12 +1242,6 @@ backward
12421242
.. automethod:: pytorch_lightning.core.lightning.LightningModule.backward
12431243
:noindex:
12441244

1245-
get_progress_bar_dict
1246-
~~~~~~~~~~~~~~~~~~~~~
1247-
1248-
.. automethod:: pytorch_lightning.core.lightning.LightningModule.get_progress_bar_dict
1249-
:noindex:
1250-
12511245
on_before_backward
12521246
~~~~~~~~~~~~~~~~~~
12531247

docs/source/common/optimizers.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ For example, here step optimizer A every batch and optimizer B every 2 batches.
443443
# the closure (which includes the `training_step`) will be executed by `optimizer.step`
444444
optimizer.step(closure=optimizer_closure)
445445
else:
446-
# optional: call the closure by itself to run `training_step` + `backward` without an optimizer step
446+
# call the closure by itself to run `training_step` + `backward` without an optimizer step
447447
optimizer_closure()
448448

449449
# ...

docs/source/extensions/logging.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,13 +245,13 @@ Modifying the progress bar
245245

246246
The progress bar by default already includes the training loss and version number of the experiment
247247
if you are using a logger. These defaults can be customized by overriding the
248-
:func:`~pytorch_lightning.core.lightning.LightningModule.get_progress_bar_dict` hook in your module.
248+
:func:`~pytorch_lightning.callbacks.base.ProgressBarBase.get_metrics` hook in your module.
249249

250250
.. code-block:: python
251251
252-
def get_progress_bar_dict(self):
252+
def get_metrics(self):
253253
# don't show the version number
254-
items = super().get_progress_bar_dict()
254+
items = super().get_metrics()
255255
items.pop("v_num", None)
256256
return items
257257

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ ignore_errors = "True"
6363
module = [
6464
"pytorch_lightning.callbacks.pruning",
6565
"pytorch_lightning.loops.closure",
66+
"pytorch_lightning.loops.batch.manual",
6667
"pytorch_lightning.loops.optimizer",
6768
"pytorch_lightning.trainer.evaluation_loop",
6869
"pytorch_lightning.trainer.connectors.logger_connector.*",

pytorch_lightning/accelerators/accelerator.py

Lines changed: 4 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -172,15 +172,7 @@ def batch_to_device(self, batch: Any, device: Optional[torch.device] = None, dat
172172
def training_step(self, step_kwargs: Dict[str, Union[Any, int]]) -> STEP_OUTPUT:
173173
"""The actual training step.
174174
175-
Args:
176-
step_kwargs: the arguments for the models training step. Can consist of the following:
177-
178-
- batch (:class:`~torch.Tensor` | (:class:`~torch.Tensor`, ...) | [:class:`~torch.Tensor`, ...]):
179-
The output of your :class:`~torch.utils.data.DataLoader`. A tensor, tuple or list.
180-
- batch_idx (int): Integer displaying index of this batch
181-
- optimizer_idx (int): When using multiple optimizers, this argument will also be present.
182-
- hiddens(:class:`~torch.Tensor`): Passed in if
183-
:paramref:`~pytorch_lightning.core.lightning.LightningModule.truncated_bptt_steps` > 0.
175+
See :meth:`~pytorch_lightning.core.lightning.LightningModule.training_step` for more details
184176
"""
185177
with self.precision_plugin.train_step_context():
186178
return self.training_type_plugin.training_step(*step_kwargs.values())
@@ -191,44 +183,23 @@ def post_training_step(self) -> None:
191183
def validation_step(self, step_kwargs: Dict[str, Union[Any, int]]) -> Optional[STEP_OUTPUT]:
192184
"""The actual validation step.
193185
194-
Args:
195-
step_kwargs: the arguments for the models validation step. Can consist of the following:
196-
197-
- batch (:class:`~torch.Tensor` | (:class:`~torch.Tensor`, ...) | [:class:`~torch.Tensor`, ...]):
198-
The output of your :class:`~torch.utils.data.DataLoader`. A tensor, tuple or list.
199-
- batch_idx (int): The index of this batch
200-
- dataloader_idx (int): The index of the dataloader that produced this batch
201-
(only if multiple val dataloaders used)
186+
See :meth:`~pytorch_lightning.core.lightning.LightningModule.validation_step` for more details
202187
"""
203188
with self.precision_plugin.val_step_context():
204189
return self.training_type_plugin.validation_step(*step_kwargs.values())
205190

206191
def test_step(self, step_kwargs: Dict[str, Union[Any, int]]) -> Optional[STEP_OUTPUT]:
207192
"""The actual test step.
208193
209-
Args:
210-
step_kwargs: the arguments for the models test step. Can consist of the following:
211-
212-
- batch (:class:`~torch.Tensor` | (:class:`~torch.Tensor`, ...) | [:class:`~torch.Tensor`, ...]):
213-
The output of your :class:`~torch.utils.data.DataLoader`. A tensor, tuple or list.
214-
- batch_idx (int): The index of this batch.
215-
- dataloader_idx (int): The index of the dataloader that produced this batch
216-
(only if multiple test dataloaders used).
194+
See :meth:`~pytorch_lightning.core.lightning.LightningModule.test_step` for more details
217195
"""
218196
with self.precision_plugin.test_step_context():
219197
return self.training_type_plugin.test_step(*step_kwargs.values())
220198

221199
def predict_step(self, step_kwargs: Dict[str, Union[Any, int]]) -> STEP_OUTPUT:
222200
"""The actual predict step.
223201
224-
Args:
225-
step_kwargs: the arguments for the models predict step. Can consist of the following:
226-
227-
- batch (:class:`~torch.Tensor` | (:class:`~torch.Tensor`, ...) | [:class:`~torch.Tensor`, ...]):
228-
The output of your :class:`~torch.utils.data.DataLoader`. A tensor, tuple or list.
229-
- batch_idx (int): The index of this batch.
230-
- dataloader_idx (int): The index of the dataloader that produced this batch
231-
(only if multiple predict dataloaders used).
202+
See :meth:`~pytorch_lightning.core.lightning.LightningModule.predict_step` for more details
232203
"""
233204
with self.precision_plugin.predict_step_context():
234205
return self.training_type_plugin.predict_step(*step_kwargs.values())

0 commit comments

Comments
 (0)