Skip to content

Commit 55c2089

Browse files
authored
Merge branch 'master' into add-checkpoint-to-callback-on_save_checkpoint
2 parents 87b83a8 + 46617d9 commit 55c2089

File tree

93 files changed

+1108
-1096
lines changed

Some content is hidden

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

93 files changed

+1108
-1096
lines changed

.github/CONTRIBUTING.md

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ We welcome any useful contribution! For your convenience here's a recommended wo
237237

238238
#### How can I help/contribute?
239239

240-
All types of contributions are welcome - reporting bugs, fixing documentation, adding test cases, solving issues, and preparing bug fixes.
240+
All types of contributions are welcome - reporting bugs, fixing documentation, adding test cases, solving issues, and preparing bug fixes.
241241
To get started with code contributions, look for issues marked with the label [good first issue](https://github.com/PyTorchLightning/pytorch-lightning/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22) or chose something close to your domain with the label [help wanted](https://github.com/PyTorchLightning/pytorch-lightning/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22). Before coding, make sure that the issue description is clear and comment on the issue so that we can assign it to you (or simply self-assign if you can).
242242

243243
#### Is there a recommendation for branch names?
@@ -323,14 +323,6 @@ run our/your test with
323323
python -m pytest tests/..../...py::test_explain_what_is_being_tested --verbose --capture=no
324324
```
325325

326-
#### How to contribute bugfixes/features?
327-
328-
Currently we have separate streams/branches for bugfixes/features and release from the default branch (`master`).
329-
Bugfixes should land in this `master` branch and features should land in `release/X.y-dev`.
330-
This means that when starting your contribution and creating a branch according to question 2) you should start this new branch from master or future release dev branch.
331-
Later in PR creation also pay attention to properly set the target branch, usually the starting (base) and target branch are the same.
332-
333-
_Note, that this flow may change after the 1.2 release as we will adjust releasing strategy._
334326

335327
#### How to fix PR with mixed base and target branches?
336328

@@ -339,7 +331,7 @@ Do not panic, the solution is very straightforward and quite simple.
339331
All you need to do are these two steps in arbitrary order:
340332
- Ask someone from Core to change the base/target branch to the correct one
341333
- Rebase or cherry-pick your commits onto the correct base branch...
342-
334+
343335
Let's show how to deal with the git...
344336
the sample case is moving a PR from `master` to `release/1.2-dev` assuming my branch name is `my-branch`
345337
and the last true master commit is `ccc111` and your first commit is `mmm222`.
@@ -354,7 +346,7 @@ and the last true master commit is `ccc111` and your first commit is `mmm222`.
354346
# so open one and cherry-pick your last commits from `my-branch-backup`
355347
# resolve all eventual conflict as the new base may contain different code
356348
# when all done, push back to the open PR
357-
git push -f
349+
git push -f
358350
```
359351
* **Rebasing way**, see more about [rebase onto usage](https://womanonrails.com/git-rebase-onto)
360352
```bash

CHANGELOG.md

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
99

1010
### Added
1111

12+
- Added a way to print to terminal without breaking up the progress bar ([#5470](https://github.com/PyTorchLightning/pytorch-lightning/pull/5470))
13+
1214

1315
- Added `checkpoint` parameter to callback's `on_save_checkpoint` hook ([#6072](https://github.com/PyTorchLightning/pytorch-lightning/pull/6072))
1416

@@ -21,15 +23,51 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
2123

2224
### Removed
2325

26+
- Removed support for passing a bool value to `profiler` argument of Trainer ([#6164](https://github.com/PyTorchLightning/pytorch-lightning/pull/6164))
27+
28+
29+
- Removed deprecated Trainer argument `enable_pl_optimizer` and `automatic_optimization` ([#6163](https://github.com/PyTorchLightning/pytorch-lightning/pull/6163))
30+
31+
32+
- Removed deprecated metrics ([#6161](https://github.com/PyTorchLightning/pytorch-lightning/pull/6161))
33+
* from `pytorch_lightning.metrics.functional.classification` removed `to_onehot`, `to_categorical`, `get_num_classes`, `roc`, `multiclass_roc`, `average_precision`, `precision_recall_curve`, `multiclass_precision_recall_curve`
34+
* from `pytorch_lightning.metrics.functional.reduction` removed `reduce`, `class_reduce`
35+
36+
37+
- Removed deprecated `ModelCheckpoint` arguments `prefix`, `mode="auto"` ([#6162](https://github.com/PyTorchLightning/pytorch-lightning/pull/6162))
38+
39+
40+
### Fixed
41+
42+
- Made the `Plugin.reduce` method more consistent across all Plugins to reflect a mean-reduction by default ([#6011](https://github.com/PyTorchLightning/pytorch-lightning/pull/6011))
43+
44+
45+
- Move lightning module to correct device type when using LightningDistributedWrapper ([#6070](https://github.com/PyTorchLightning/pytorch-lightning/pull/6070))
46+
47+
48+
- Do not print top-k verbose log with `ModelCheckpoint(monitor=None)` ([#6109](https://github.com/PyTorchLightning/pytorch-lightning/pull/6109))
49+
50+
51+
- Expose DeepSpeed loss parameters to allow users to fix loss instability ([#6115](https://github.com/PyTorchLightning/pytorch-lightning/pull/6115))
52+
53+
54+
- Fixed epoch level schedulers not being called when `val_check_interval < 1.0` ([#6075](https://github.com/PyTorchLightning/pytorch-lightning/pull/6075))
55+
56+
57+
## [1.2.1] - 2021-02-23
2458

2559
### Fixed
2660

61+
- Fixed incorrect yield logic for the amp autocast context manager ([#6080](https://github.com/PyTorchLightning/pytorch-lightning/pull/6080))
62+
- Fixed priority of plugin/accelerator when setting distributed mode ([#6089](https://github.com/PyTorchLightning/pytorch-lightning/pull/6089))
63+
- Fixed error message for AMP + CPU incompatibility ([#6107](https://github.com/PyTorchLightning/pytorch-lightning/pull/6107))
64+
2765

2866
## [1.2.0] - 2021-02-18
2967

3068
### Added
3169

32-
- Added `DataType`, `AverageMethod` and `MDMCAverageMethod` enum in metrics ([#5657](https://github.com/PyTorchLightning/pytorch-lightning/pull/5689)
70+
- Added `DataType`, `AverageMethod` and `MDMCAverageMethod` enum in metrics ([#5657](https://github.com/PyTorchLightning/pytorch-lightning/pull/5689))
3371
- Added support for summarized model total params size in megabytes ([#5590](https://github.com/PyTorchLightning/pytorch-lightning/pull/5590))
3472
- Added support for multiple train loaders ([#1959](https://github.com/PyTorchLightning/pytorch-lightning/pull/1959))
3573
- Added `Accuracy` metric now generalizes to Top-k accuracy for (multi-dimensional) multi-class inputs using the `top_k` parameter ([#4838](https://github.com/PyTorchLightning/pytorch-lightning/pull/4838))

azure-pipelines.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,9 @@ jobs:
6666
pip list
6767
displayName: 'Install dependencies'
6868
69-
- script: |
69+
- bash: |
7070
python tests/collect_env_details.py
71+
python -c "import torch ; mgpu = torch.cuda.device_count() ; assert mgpu >= 2, f'GPU: {mgpu}'"
7172
displayName: 'Env details'
7273
7374
- bash: |
@@ -76,7 +77,7 @@ jobs:
7677
ls -l legacy/checkpoints/
7778
displayName: 'Get legacy checkpoints'
7879
79-
- script: |
80+
- bash: |
8081
python -m coverage run --source pytorch_lightning -m pytest pytorch_lightning tests -v --durations=50
8182
displayName: 'Testing: standard'
8283
@@ -90,11 +91,11 @@ jobs:
9091
codecov --token=$(CODECOV_TOKEN) --flags=gpu,pytest --name="GPU-coverage" --env=linux,azure
9192
displayName: 'Statistics'
9293
93-
- script: |
94+
- bash: |
9495
python -m pytest benchmarks pl_examples -v --maxfail=2 --durations=0
9596
displayName: 'Testing: extended'
9697
97-
- script: |
98+
- bash: |
9899
python setup.py install --user --quiet
99100
bash pl_examples/run_ddp-example.sh
100101
pip uninstall -y pytorch-lightning

docs/source/advanced/multi_gpu.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -690,9 +690,9 @@ DeepSpeed
690690
.. note::
691691
The DeepSpeed plugin is in beta and the API is subject to change. Please create an `issue <https://github.com/PyTorchLightning/pytorch-lightning/issues>`_ if you run into any issues.
692692

693-
`DeepSpeed <https://github.com/microsoft/DeepSpeed>`_ offers additional CUDA deep learning training optimizations, similar to `FairScale <https://github.com/facebookresearch/fairscale>`_. DeepSpeed offers lower level training optimizations, and useful efficient optimizers such as `1-bit Adam <https://www.deepspeed.ai/tutorials/onebit-adam/>`_.
694-
Using the plugin, we were able to **train model sizes of 10 Billion parameters and above**, with a lot of useful information in this `benchmark <https://github.com/huggingface/transformers/issues/9996>`_ and the DeepSpeed `docs <https://www.deepspeed.ai/tutorials/megatron/>`_.
695-
We recommend using DeepSpeed in environments where speed and memory optimizations are important (such as training large billion parameter models). In addition, we recommend trying :ref:`sharded` first before trying DeepSpeed's further optimizations, primarily due to FairScale Sharded ease of use in scenarios such as multiple optimizers/schedulers.
693+
`DeepSpeed <https://github.com/microsoft/DeepSpeed>`_ is a deep learning training optimization library, providing the means to train massive billion parameter models at scale.
694+
Using the DeepSpeed plugin, we were able to **train model sizes of 10 Billion parameters and above**, with a lot of useful information in this `benchmark <https://github.com/huggingface/transformers/issues/9996>`_ and the DeepSpeed `docs <https://www.deepspeed.ai/tutorials/megatron/>`_.
695+
DeepSpeed also offers lower level training optimizations, and efficient optimizers such as `1-bit Adam <https://www.deepspeed.ai/tutorials/onebit-adam/>`_. We recommend using DeepSpeed in environments where speed and memory optimizations are important (such as training large billion parameter models).
696696

697697
To use DeepSpeed, you first need to install DeepSpeed using the commands below.
698698

@@ -706,7 +706,7 @@ Additionally if you run into any issues installing m4py, ensure you have openmpi
706706
.. note::
707707
Currently ``resume_from_checkpoint`` and manual optimization are not supported.
708708

709-
DeepSpeed only supports single optimizer, single scheduler.
709+
DeepSpeed currently only supports single optimizer, single scheduler within the training loop.
710710

711711
ZeRO-Offload
712712
""""""""""""

docs/source/common/hyperparameters.rst

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,6 @@ improve readability and reproducibility.
167167
def train_dataloader(self):
168168
return DataLoader(mnist_train, batch_size=self.hparams.batch_size)
169169
170-
.. warning:: Deprecated since v1.1.0. This method of assigning hyperparameters to the LightningModule
171-
will no longer be supported from v1.3.0. Use the ``self.save_hyperparameters()`` method from above instead.
172-
173170
174171
4. You can also save full objects such as `dict` or `Namespace` to the checkpoint.
175172

docs/source/common/optimizers.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,8 +300,6 @@ override the :meth:`optimizer_step` function.
300300

301301
For example, here step optimizer A every 2 batches and optimizer B every 4 batches
302302

303-
.. note:: When using Trainer(enable_pl_optimizer=True), there is no need to call `.zero_grad()`.
304-
305303
.. testcode::
306304

307305
def optimizer_zero_grad(self, current_epoch, batch_idx, optimizer, opt_idx):

docs/source/extensions/metrics.rst

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ provided input.
2323
.. warning::
2424
From v1.2 onward ``compute()`` will no longer automatically call ``reset()``,
2525
and it is up to the user to reset metrics between epochs, except in the case where the
26-
metric is directly passed to ``LightningModule``s ``self.log``.
26+
metric is directly passed to ``LightningModule``'s ``self.log``.
2727

2828
These metrics work with DDP in PyTorch and PyTorch Lightning by default. When ``.compute()`` is called in
2929
distributed mode, the internal state of each metric is synced and reduced across each process, so that the
@@ -478,7 +478,7 @@ binary/multi-label inputs as 2-class (multi-dimensional) multi-class inputs.
478478

479479
For these cases, the metrics where this distinction would make a difference, expose the
480480
``is_multiclass`` argument. Let's see how this is used on the example of
481-
:class:`~pytorch_lightning.metrics.classification.StatScores` metric.
481+
:class:`~pytorch_lightning.metrics.StatScores` metric.
482482

483483
First, let's consider the case with label predictions with 2 classes, which we want to
484484
treat as binary.
@@ -530,86 +530,86 @@ Class Metrics (Classification)
530530
Accuracy
531531
~~~~~~~~
532532

533-
.. autoclass:: pytorch_lightning.metrics.classification.Accuracy
533+
.. autoclass:: pytorch_lightning.metrics.Accuracy
534534
:noindex:
535535

536536
AveragePrecision
537537
~~~~~~~~~~~~~~~~
538538

539-
.. autoclass:: pytorch_lightning.metrics.classification.AveragePrecision
539+
.. autoclass:: pytorch_lightning.metrics.AveragePrecision
540540
:noindex:
541541

542542
AUC
543543
~~~
544544

545-
.. autoclass:: pytorch_lightning.metrics.classification.AUC
545+
.. autoclass:: pytorch_lightning.metrics.AUC
546546
:noindex:
547547

548548
AUROC
549549
~~~~~
550550

551-
.. autoclass:: pytorch_lightning.metrics.classification.AUROC
551+
.. autoclass:: pytorch_lightning.metrics.AUROC
552552
:noindex:
553553

554554
ConfusionMatrix
555555
~~~~~~~~~~~~~~~
556556

557-
.. autoclass:: pytorch_lightning.metrics.classification.ConfusionMatrix
557+
.. autoclass:: pytorch_lightning.metrics.ConfusionMatrix
558558
:noindex:
559559

560560
F1
561561
~~
562562

563-
.. autoclass:: pytorch_lightning.metrics.classification.F1
563+
.. autoclass:: pytorch_lightning.metrics.F1
564564
:noindex:
565565

566566
FBeta
567567
~~~~~
568568

569-
.. autoclass:: pytorch_lightning.metrics.classification.FBeta
569+
.. autoclass:: pytorch_lightning.metrics.FBeta
570570
:noindex:
571571

572572
IoU
573573
~~~
574574

575-
.. autoclass:: pytorch_lightning.metrics.classification.IoU
575+
.. autoclass:: pytorch_lightning.metrics.IoU
576576
:noindex:
577577

578578
Hamming Distance
579579
~~~~~~~~~~~~~~~~
580580

581-
.. autoclass:: pytorch_lightning.metrics.classification.HammingDistance
581+
.. autoclass:: pytorch_lightning.metrics.HammingDistance
582582
:noindex:
583583

584584
Precision
585585
~~~~~~~~~
586586

587-
.. autoclass:: pytorch_lightning.metrics.classification.Precision
587+
.. autoclass:: pytorch_lightning.metrics.Precision
588588
:noindex:
589589

590590
PrecisionRecallCurve
591591
~~~~~~~~~~~~~~~~~~~~
592592

593-
.. autoclass:: pytorch_lightning.metrics.classification.PrecisionRecallCurve
593+
.. autoclass:: pytorch_lightning.metrics.PrecisionRecallCurve
594594
:noindex:
595595

596596
Recall
597597
~~~~~~
598598

599-
.. autoclass:: pytorch_lightning.metrics.classification.Recall
599+
.. autoclass:: pytorch_lightning.metrics.Recall
600600
:noindex:
601601

602602
ROC
603603
~~~
604604

605-
.. autoclass:: pytorch_lightning.metrics.classification.ROC
605+
.. autoclass:: pytorch_lightning.metrics.ROC
606606
:noindex:
607607

608608

609609
StatScores
610610
~~~~~~~~~~
611611

612-
.. autoclass:: pytorch_lightning.metrics.classification.StatScores
612+
.. autoclass:: pytorch_lightning.metrics.StatScores
613613
:noindex:
614614

615615

@@ -654,7 +654,7 @@ confusion_matrix [func]
654654
dice_score [func]
655655
~~~~~~~~~~~~~~~~~
656656

657-
.. autofunction:: pytorch_lightning.metrics.functional.classification.dice_score
657+
.. autofunction:: pytorch_lightning.metrics.functional.dice_score
658658
:noindex:
659659

660660

@@ -735,7 +735,7 @@ stat_scores [func]
735735
stat_scores_multiple_classes [func]
736736
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
737737

738-
.. autofunction:: pytorch_lightning.metrics.functional.classification.stat_scores_multiple_classes
738+
.. autofunction:: pytorch_lightning.metrics.functional.stat_scores_multiple_classes
739739
:noindex:
740740

741741

@@ -762,49 +762,49 @@ Class Metrics (Regression)
762762
ExplainedVariance
763763
~~~~~~~~~~~~~~~~~
764764

765-
.. autoclass:: pytorch_lightning.metrics.regression.ExplainedVariance
765+
.. autoclass:: pytorch_lightning.metrics.ExplainedVariance
766766
:noindex:
767767

768768

769769
MeanAbsoluteError
770770
~~~~~~~~~~~~~~~~~
771771

772-
.. autoclass:: pytorch_lightning.metrics.regression.MeanAbsoluteError
772+
.. autoclass:: pytorch_lightning.metrics.MeanAbsoluteError
773773
:noindex:
774774

775775

776776
MeanSquaredError
777777
~~~~~~~~~~~~~~~~
778778

779-
.. autoclass:: pytorch_lightning.metrics.regression.MeanSquaredError
779+
.. autoclass:: pytorch_lightning.metrics.MeanSquaredError
780780
:noindex:
781781

782782

783783
MeanSquaredLogError
784784
~~~~~~~~~~~~~~~~~~~
785785

786-
.. autoclass:: pytorch_lightning.metrics.regression.MeanSquaredLogError
786+
.. autoclass:: pytorch_lightning.metrics.MeanSquaredLogError
787787
:noindex:
788788

789789

790790
PSNR
791791
~~~~
792792

793-
.. autoclass:: pytorch_lightning.metrics.regression.PSNR
793+
.. autoclass:: pytorch_lightning.metrics.PSNR
794794
:noindex:
795795

796796

797797
SSIM
798798
~~~~
799799

800-
.. autoclass:: pytorch_lightning.metrics.regression.SSIM
800+
.. autoclass:: pytorch_lightning.metrics.SSIM
801801
:noindex:
802802

803803

804804
R2Score
805805
~~~~~~~
806806

807-
.. autoclass:: pytorch_lightning.metrics.regression.R2Score
807+
.. autoclass:: pytorch_lightning.metrics.R2Score
808808
:noindex:
809809

810810
Functional Metrics (Regression)
@@ -873,7 +873,7 @@ NLP
873873
bleu_score [func]
874874
-----------------
875875

876-
.. autofunction:: pytorch_lightning.metrics.functional.nlp.bleu_score
876+
.. autofunction:: pytorch_lightning.metrics.functional.bleu_score
877877
:noindex:
878878

879879
********
@@ -883,5 +883,5 @@ Pairwise
883883
embedding_similarity [func]
884884
---------------------------
885885

886-
.. autofunction:: pytorch_lightning.metrics.functional.self_supervised.embedding_similarity
886+
.. autofunction:: pytorch_lightning.metrics.functional.embedding_similarity
887887
:noindex:

docs/source/starter/new-project.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,7 @@ Lightning has many tools for debugging. Here is an example of just a few of them
737737
.. testcode::
738738

739739
# Profile your code to find speed/memory bottlenecks
740-
Trainer(profiler=True)
740+
Trainer(profiler="simple")
741741

742742
---------------
743743

0 commit comments

Comments
 (0)