Commit Graph

1210 Commits

Author SHA1 Message Date
Jirka Borovec 6386f45de7
clarify Trainer running state atribs. (#5589)
* update Trainer is_ attributes

* tests

* more

* isort

* split

* rename

* check

* fix
2021-01-24 10:45:42 +00:00
Adrian Wälchli 24462dc5fd
Set progressbar refresh rate in Google Colab (#5516)
* refresh

* add tests

* docs

* chlog

* chlog

* Update pytorch_lightning/trainer/trainer.py

Co-authored-by: Nicki Skafte <skaftenicki@gmail.com>

* update docstring

Co-authored-by: Nicki Skafte <skaftenicki@gmail.com>
Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
Co-authored-by: chaton <thomas@grid.ai>
2021-01-19 12:47:14 -05:00
Tadej Svetina c8f605e47d
Classification metrics overhaul: precision & recall (4/n) (#4842)
* Add stuff

* Change metrics documentation layout

* Add stuff

* Add stat scores

* Change testing utils

* Replace len(*.shape) with *.ndim

* More descriptive error message for input formatting

* Replace movedim with permute

* PEP 8 compliance

* WIP

* Add reduce_scores function

* Temporarily add back legacy class_reduce

* Division with float

* PEP 8 compliance

* Remove precision recall

* Replace movedim with permute

* Add back tests

* Add empty newlines

* Add precision recall back

* Add empty line

* Fix permute

* Fix some issues with old versions of PyTorch

* Style changes in error messages

* More error message style improvements

* Fix typo in docs

* Add more descriptive variable names in utils

* Change internal var names

* Revert unwanted changes

* Revert unwanted changes pt 2

* Update metrics interface

* Add top_k parameter

* Add back reduce function

* Add stuff

* PEP3

* Add depreciation

* PEP8

* Deprecate param

* PEP8

* Fix and simplify testing for older PT versions

* Update Changelog

* Remove redundant import

* Add tests to increase coverage

* Remove zero_division

* fix zero_division

* Add zero_div + edge case tests

* Reorder cls metric args

* Add back quotes for is_multiclass

* Add precision_recall and tests

* PEP8

* Fix docs

* Fix docs

* Update

* Change precision_recall output

* PEP8/isort

* Add method _get_final_stats

* Fix depr test

* Add comment to deprecation tests

* isort

* Apply suggestions from code review

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>

* Add typing to test

* Add matc str to pytest.raises

Co-authored-by: chaton <thomas@grid.ai>
Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
2021-01-18 03:24:13 -05:00
Jirka Borovec 2fe36c7049
simple tests restructure (#5452)
* simple tests restructure

* logging_process

* typo
2021-01-15 20:58:20 -05:00
Arnaud Gelas 23c241d083
Fix pre-commit isort failure on tests/base/*.py (#5429)
* Remove tests.base from skipped module in pyproject.toml

* Fix pre-commit isort failure on tests/base/*.py
2021-01-15 03:01:57 -05:00
Arnaud Gelas 7523e6940f
Fix pre-commit isort failure on tests/backends/*.py (#5430)
* Fix pre-commit isort failure on tests/backends/*.py

* Remove tests.backends from skipped module in pyproject.toml
2021-01-14 19:32:41 -05:00
Arnaud Gelas 9515750548
Fix pre-commit isort failure on tests/loggers/*.py (#5425)
* Remove tests.loggers from skipped module in pyproject.toml

* Fix pre-commit isort failure on tests/loggers/*.py
2021-01-14 14:36:28 -05:00
Arnaud Gelas 6d83d4457d
Fix pre-commit isort failure on tests/callbacks/*.py (#5428)
* Remove tests.callbacks from skipped module in pyproject.toml

* Fix pre-commit isort failure on tests/callbacks/*.py
2021-01-14 13:15:34 -05:00
Arnaud Gelas ac531ec945
Fix pre-commit isort failure on tests/models/*.py (#5423)
* Remove tests.models from skipped module in pyproject.toml

* Fix pre-commit isort failure on tests/models/*.py
2021-01-14 09:42:01 -05:00
Arnaud Gelas 7fb0221934
Fix pre-commit isort failure on tests/trainer/*.py (#5421)
* Remove tests.trainer from skipped module in pyproject.toml

* Fix pre-commit isort failure on tests/trainer/*.py
2021-01-14 07:51:20 -05:00
Arnaud Gelas d8a0c7d82a
Fix pre-commit isort failure on tests/metrics/*.py (#5424)
* Remove tests.metrics from skipped module in pyproject.toml

* Fix pre-commit isort failure on tests/metrics/*.py

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
2021-01-14 06:05:28 -05:00
Arnaud Gelas 84d1040b32
Fix pre-commit isort failure on tests/plugins/*.py (#5422)
* Fix pre-commit isort failure on tests/plugins/*.py

* Remove tests.plugins from skipped module in pyproject.toml

* Update pyproject.toml

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
2021-01-14 03:57:16 -05:00
Adrian Wälchli e806bb77fa
Refactor LightningDistributedDataParallel (#5185)
* add wrapper

* add squeeze

* replace LightningDistributedDP

* update import

* module access

* inputs

* refactor warning

* update

* resolve flake8

* remove old class

* set find unused params to False

* update docstrings

* update docs

* update docs

* add changelog

* deprecation

* rename wrapper -> module

* rename pl_module

* add unit tests

* Revert "add changelog"

This reverts commit 02ec0a6864f4ba2ace3bb6fc6ebc364e1a80ffd7.

* Revert "set find unused params to False"

This reverts commit 8e451515e6ba3227d00f4a5cb63f332cfedb7b30.

Co-authored-by: Ubuntu <thomas@grid.ai>
2021-01-13 14:35:42 -05:00
Adrian Wälchli 61308138c3
set find_unused_parameters=False in DDP as in pytorch (#5435)
* set find unused params to False

* add changelog

* fix changelog

* fix test

* update docs

* update changelog

Co-authored-by: chaton <thomas@grid.ai>
2021-01-13 10:13:40 -05:00
Wansoo Kim 61f415f2ac
Add LambdaCallback (#5347)
* Add LambdaCallback

* docs

* add pr link

# Conflicts:
#	CHANGELOG.md

* convention

* Fix Callback Typo

* Update pytorch_lightning/callbacks/lambda_cb.py

Co-authored-by: Nicki Skafte <skaftenicki@gmail.com>

* Update pytorch_lightning/callbacks/lambda_cb.py

Co-authored-by: Nicki Skafte <skaftenicki@gmail.com>

* Update pytorch_lightning/callbacks/lambda_cb.py

Co-authored-by: Nicki Skafte <skaftenicki@gmail.com>

* use Misconfigureation

* update docs

* sort export

* use inspect

* string fill

* use fast dev run

* isort

* remove unused import

* sort

* hilightning

* highlighting

* highlighting

* remove debug log

* eq

* res

* results

* add misconfig exception test

* use pytest raises

* fix

* Apply suggestions from code review

Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>

* Update pytorch_lightning/callbacks/lambda_cb.py

Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>

* hc

* rm pt

* fix

* try fix

* whitespace

* new hook

* add raise

* fix

* remove unused

* rename

Co-authored-by: Jirka Borovec <jirka.borovec@seznam.cz>
Co-authored-by: Nicki Skafte <skaftenicki@gmail.com>
Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>
Co-authored-by: chaton <thomas@grid.ai>
2021-01-13 04:42:49 -05:00
Nicki Skafte 02acb21e55
[Metrics] Disable default reset after compute (#5409)
* reset

* self._cache -> cache (make cache local variable so it is not overwritten)

* pep8

* fix metric result integration

* rm print statements

* better comment

* changelog

* Update docs/source/metrics.rst

Co-authored-by: Roger Shieh <sh.rog@protonmail.ch>

Co-authored-by: Teddy Koker <teddy.koker@gmail.com>
Co-authored-by: Roger Shieh <sh.rog@protonmail.ch>
2021-01-13 04:01:08 -05:00
Rohit Gupta 29bcf30984
[tests/core] Updated with BoringModel and added BoringDataModule (#5432)
* update with BoringModel and introduce BoringDataModule

* isort

* fix

* rm random_split

* fix test

* fix test

* update

* update test_results

* val_step

* update tests

* rebase

* rebase
2021-01-13 01:48:37 -05:00
Rohit Gupta 1323cb2ed5
Add missing val/test hooks in LightningModule (#5467)
* add missing val/test hooks

* chlog

* None

Co-authored-by: Roger Shieh <sh.rog@protonmail.ch>
2021-01-13 01:09:47 -05:00
Jirka Borovec 7449ce216d
simplify training phase as Enum (#5419)
* simplify training phase as Enum

* tests

* .

* .

* rename

* Apply suggestions from code review

Co-authored-by: Carlos Mocholí <carlossmocholi@gmail.com>

* Apply suggestions from code review

Co-authored-by: Carlos Mocholí <carlossmocholi@gmail.com>

* rename

* flake8

Co-authored-by: Carlos Mocholí <carlossmocholi@gmail.com>
2021-01-12 20:33:39 -05:00
Jirka Borovec 54d20dc596
Refactor: clean trainer device & distrib getters (#5300)
* warnings

* .

* .

* flake8

* .

* .

* .

* use_tpu

* use_dp

* .

* use_ddp

* .

* use_horovod

* .

* .

* .
2021-01-12 05:22:37 -05:00
Arnaud Gelas 2373858b33
Fix pre-commit isort failure on tests/checkpointing/*.py (#5427)
* Remove tests.checkpointing from skipped module in pyproject.toml

* Fix pre-commit isort failure on tests/checkpointing/*.py
2021-01-12 03:31:51 -05:00
Alan Du f6dc354349
Throw MisconfigurationError on unknown mode (#5255)
* Throw MisconfigurationError on unknown mode

* Add tests

* Add match condition for deprecation message
2021-01-12 02:31:26 -05:00
Jirka Borovec 059f4630c8
prune check on Trainer fit result (#5453)
* prune check on Trainer fit result

* flake8

* Apply suggestions from code review

Co-authored-by: Carlos Mocholí <carlossmocholi@gmail.com>

* .

Co-authored-by: Carlos Mocholí <carlossmocholi@gmail.com>
2021-01-11 19:36:48 -05:00
Arnaud Gelas b9530d291e
Fix pre-commit isort failure on tests/utilities/*.py (#5420)
* Remove tests.utilities from skipped module in pyproject.toml

* Fix pre-commit isort failure on tests/utilities/*.py
2021-01-11 14:00:39 -05:00
Wansoo Kim 93de5c8a40
Allow Callback instance as an argument of `callbacks` in `Trainer` (#5446)
* fix

* Update CHANGELOG

* add test

* fix

* pep

* docs

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>
2021-01-11 11:36:32 +00:00
Rohit Gupta d583d56169
[tests/loggers] refactor with BoringModel (#5440)
* use BoringModel

* use BoringModel

* use BoringModel

* trigger

* limit_batches

* Apply suggestions from code review

Co-authored-by: Carlos Mocholí <carlossmocholi@gmail.com>

Co-authored-by: Carlos Mocholí <carlossmocholi@gmail.com>
2021-01-10 07:30:06 -05:00
chaton be255de306
Bugfix/all gather (#5221)
* resolve bug

* add tests

* add tests

* resolve flake8

* update

* update

* remove globals

* typo

* Update pytorch_lightning/utilities/distributed.py

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>

* update

* update

* add suport int, float

* update

* resolve pep8

* Update pytorch_lightning/core/lightning.py

Co-authored-by: Adrian Wälchli <aedu.waelchli@gmail.com>

* Update tests/utilities/test_all_gather_grad.py

Co-authored-by: Adrian Wälchli <aedu.waelchli@gmail.com>

* update doc

* add bool and np.ndarray

* resolve conflicts

* resolve conflicts

* resolve pep8

* add changelog

* Update pytorch_lightning/core/lightning.py

Co-authored-by: Adrian Wälchli <aedu.waelchli@gmail.com>

Co-authored-by: Ubuntu <ubuntu@ip-172-31-62-109.ec2.internal>
Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
Co-authored-by: Adrian Wälchli <aedu.waelchli@gmail.com>
2021-01-09 07:37:44 -05:00
chaton 48718d7ce7
Feat: Add BackboneLambdaFinetunningCallback (#5377)
* Feat: Add BackboneLambdaFinetunningCallback

* update changelog

* resolve pep8 and update changelog

* add finetunning example

* resolve example

* iremove milestones from model

* iupdate

* update

* Update pytorch_lightning/callbacks/__init__.py

Co-authored-by: Justus Schock <12886177+justusschock@users.noreply.github.com>

* Update pytorch_lightning/callbacks/__init__.py

Co-authored-by: Justus Schock <12886177+justusschock@users.noreply.github.com>

* update

* add comments

* resolve test

* Update pytorch_lightning/callbacks/finetuning.py

Co-authored-by: Carlos Mocholí <carlossmocholi@gmail.com>

* Update tests/trainer/logging/test_logger_connector.py

Co-authored-by: Carlos Mocholí <carlossmocholi@gmail.com>

* update on comments

* resolve merge

Co-authored-by: Justus Schock <12886177+justusschock@users.noreply.github.com>
Co-authored-by: Carlos Mocholí <carlossmocholi@gmail.com>
2021-01-08 16:33:05 -05:00
deng-cy 3ee1b55bf1
Reformat iou [func] and add IoU class (#4704)
* added Iou

* Create iou.py

* Update iou.py

* Update iou.py

* Update CHANGELOG.md

* Update metrics.rst

* Update iou.py

* Update iou.py

* Update __init__.py

* Update iou.py

* Update iou.py

* Update classification.py

* Update classification.py

* Update classification.py

* Update __init__.py

* Update __init__.py

* Update iou.py

* Update classification.py

* Update metrics.rst

* Update CHANGELOG.md

* Update CHANGELOG.md

* add iou

* add test

* add test

* removed iou

* add iou

* add iou test

* add float

* reformat test_iou

* removed test_iou

* updated format

* updated format

* Update CHANGELOG.md

* updated format

* Update metrics.rst

* Apply suggestions from code review

merge suggestions

Co-authored-by: Nicki Skafte <skaftenicki@gmail.com>

* added equations

* reformat init

* change format

* change format

* deprecate iou and test for this

* fix changelog

* delete iou test in test_classification

* format change

* format change

* format

* format

* format

* delete white space

* delete white space

* fix tests

* Apply suggestions from code review

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>

* better deprecation

* fix docs

* Apply suggestions from code review

* fix todo

Co-authored-by: Nicki Skafte <skaftenicki@gmail.com>
Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
2021-01-08 13:36:08 +00:00
Nicki Skafte 06668c0ddf
[Metrics] MetricCollection (#4318)
* docs + precision + recall + f_beta + refactor

Co-authored-by: Teddy Koker <teddy.koker@gmail.com>

* rebase

Co-authored-by: Teddy Koker <teddy.koker@gmail.com>

* fixes

Co-authored-by: Teddy Koker <teddy.koker@gmail.com>

* added missing file

* docs

* docs

* extra import

* add metric collection

* add docs + integration with log_dict

* add test

* update

* update

* more test

* more test

* pep8

* fix doctest

* pep8

* add clone method

* add clone method

* merge-2

* changelog

* kwargs filtering and tests

* pep8

* fix test

* update docs

* Update docs/source/metrics.rst

Co-authored-by: Roger Shieh <sh.rog@protonmail.ch>

* fix docs

* fix tests

* Apply suggestions from code review

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>

* fix docs

* fix doctest

* fix doctest

* fix doctest

* fix doctest

Co-authored-by: ananyahjha93 <ananya@pytorchlightning.ai>
Co-authored-by: Teddy Koker <teddy.koker@gmail.com>
Co-authored-by: Nicki Skafte <nugginea@gmail.com>
Co-authored-by: Roger Shieh <sh.rog@protonmail.ch>
Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
2021-01-08 11:09:07 +01:00
Pranjal Datta 06f36092a4
added image-gradients (#4763) [1/2] (#5056)
* added iamge-gradients (#4763)

* fixed tests code format

* made recommended fixes

* removed explicit device flags

* tried to fix doctest failure

* pep8 and doctest fixes

* added to docs/metrics

* updated CHANGELOG

* added the noqa flag

* added suggested modification to changelog

Co-authored-by: Nicki Skafte <skaftenicki@gmail.com>

* recommended update to docstring

Co-authored-by: Nicki Skafte <skaftenicki@gmail.com>

* removed device from docstring

Co-authored-by: Nicki Skafte <skaftenicki@gmail.com>

* made recommended fixes

* Update CHANGELOG.md

* Apply suggestions from code review

* added 1-line docstrings

Co-authored-by: Nicki Skafte <skaftenicki@gmail.com>
Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
Co-authored-by: Roger Shieh <sh.rog@protonmail.ch>
2021-01-07 20:34:38 +01:00
chaton 5f94900361
[Feat] Cleanup ModelCheckpoint / EarlyStopping by moving logic to LoggerConnector (#5218)
* [bug-fix] Metric reduction with Logging (#5150)

* add test

* resolve bug

* udpate test

* wrongly copy / paste

* update test

* resolve a second bug

Co-authored-by: Ubuntu <ubuntu@ip-172-31-62-109.ec2.internal>

* iupdate

* resolve bugs

* add test back

* correct flake8

* resolve flake8

* update on comments

* update tests

* add a test

* add test

* update to Callable

Co-authored-by: Ubuntu <ubuntu@ip-172-31-62-109.ec2.internal>
2021-01-07 10:57:26 -05:00
Gianluca Scarpellini 7464aca44e
test_cpu and test_gpu EvalModelTemplate deprecation (#4820)
* test_cpu refactoring - BoringModel and checkpoints; test_gpu refactoring - BoringModelboring_model refactoring - validation, testing; Fix - run_prediction as dispatcher for testing BoringModel

* Removed EvalModelTemplate import from test_cpu and test_gpu

* Reverting unintended changes

* Issues with checkpointing

* Fixed tests for logging and checkpointing

* Fix for dispatcher

* test_cpu refactoring - BoringModel and checkpoints; test_gpu refactoring - BoringModelboring_model refactoring - validation, testing; Fix - run_prediction as dispatcher for testing BoringModel

* Removed EvalModelTemplate import from test_cpu and test_gpu

* Reverting unintended changes

* Issues with checkpointing

* Fixed tests for logging and checkpointing

* Fix for dispatcher

* Fixed acc check for stocasticity of seeds

* Fixed according to @borda suggestions

* Hparams for boring_model

* Deprecated RuntimeParamChagneModelAssing (functionality is tested in RuntimeParamChangeModelSaving)

* Reduced boring_model parameters to just in and out features, test_cpu modelsinherit BoringModel to specify additional parameters (e.g., optimizer)

* Fix PEP8

* Update tests/base/develop_pipelines.py

Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>

* Update tests/base/boring_model.py

Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>

* Update tests/base/develop_pipelines.py

Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>

* Update tests/models/test_cpu.py

Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>

* Update tests/models/test_cpu.py

Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>

* Merged test_early_stopping with all_features; added TODO for self.log

* Fixed test_all_features trainer options

* Ready for review!

* Update tests/models/test_cpu.py

Thank you! :)

Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>

* Update tests/models/test_cpu.py

Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>

* Update tests/models/test_cpu.py

Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>

* Update tests/models/test_cpu.py

Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>

* Update tests/models/test_cpu.py

Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>

* added optimizer_name, lr, and batch_size as hparams for save_hparameters()

* Fixes for reducing PR size

* Reverse test_hparams (removed DEPRECATED test for hparams direct assignment)

* Changes for in_features

* Fixed hparams

* Fixed parameters for boring_model

* Update tests/models/test_cpu.py

Co-authored-by: Carlos Mocholí <carlossmocholi@gmail.com>

* Update tests/models/test_cpu.py

Co-authored-by: Carlos Mocholí <carlossmocholi@gmail.com>

* Update tests/models/test_cpu.py

Co-authored-by: Carlos Mocholí <carlossmocholi@gmail.com>

* fix for pep8

* Fixed run_predction and TODO

* fix min acc for darwin/windows without pl_opt

* eval as DEFAULT run_prediction strategy

* Updated val_dataloader for running_test_no_val

Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>
Co-authored-by: chaton <thomas@grid.ai>
Co-authored-by: Carlos Mocholí <carlossmocholi@gmail.com>
2021-01-07 05:50:08 -05:00
Jirka Borovec beb8cacf1c fix formatting - flake8 + isort 2021-01-06 21:31:48 +01:00
Carlos Mocholí 3ee3c42035 Prepare 1.1.3 release (#5365)
* Prepare 1.1.3 release

* Fix flake8 error

* suppress

* Remove 1.1.4 section

* Add missing commits to CHANGELOG

* Update PR template

* Add missing commit

* fix

* Update CHANGELOG.md

* Apply suggestions from code review

* Apply suggestions from code review

Co-authored-by: Jirka Borovec <jirka.borovec@seznam.cz>
Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>

(cherry picked from commit 4d9db866a1)
2021-01-06 15:17:27 +01:00
Wansoo Kim 21fd56e280 FIX-5311: Cast to string `_flatten_dict` (#5354)
* fix

* params

* add test

* add another types

* chlog

Co-authored-by: Jirka Borovec <jirka.borovec@seznam.cz>
Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>

(cherry picked from commit 6536ea42fa)
2021-01-06 15:16:46 +01:00
Jirka Borovec 9610ea817b refactor imports of logger dependencies (#4860)
* refactor imports of logger dependencies

* fix

* fix

* fix

* name

* fix

* mocks

* fix tests

* fix mlflow

* fix test tube

* fix wandb import check

* whitespace

* name

* name

* hack

* hack

* rev

* fix

* update mlflow import check

* try without installing conda dep

* .

* .

* .

* .

* .

* .

* .

* .

* .

Co-authored-by: Adrian Wälchli <adrian.waelchli@inf.unibe.ch>
Co-authored-by: Adrian Wälchli <aedu.waelchli@gmail.com>

(cherry picked from commit ec0fb7a3ec)
2021-01-06 15:16:06 +01:00
chaton 56437e98a6 [bug-fix] Trainer.test points to latest best_model_path (#5161)
* resolve bug

* update code

* add set -e

* Update pytorch_lightning/callbacks/model_checkpoint.py

Co-authored-by: Adrian Wälchli <aedu.waelchli@gmail.com>

* update test

* Update tests/checkpointing/test_trainer_checkpoint.py

Co-authored-by: Sean Naren <sean.narenthiran@gmail.com>

* Update tests/checkpointing/test_trainer_checkpoint.py

Co-authored-by: Carlos Mocholí <carlossmocholi@gmail.com>

* update on comments

* resolve test

* convert to set

* update

* add error triggering

* update

* update on comments

* update

* resolve import

* update

* update

* Update pytorch_lightning/plugins/rpc_plugin.py

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>

* update

Co-authored-by: Adrian Wälchli <aedu.waelchli@gmail.com>
Co-authored-by: Sean Naren <sean.narenthiran@gmail.com>
Co-authored-by: Carlos Mocholí <carlossmocholi@gmail.com>
Co-authored-by: Ubuntu <ubuntu@ip-172-31-62-109.ec2.internal>
Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>

(cherry picked from commit d5b367871f)
2021-01-06 15:14:10 +01:00
Rohit Gupta 704e00ee7f Fix invalid value for weights_summary (#5296)
* Fix weights_summary

* use mode

* fix

* optional

* what was I thinking

(cherry picked from commit 062800aa99)
2021-01-06 12:59:32 +01:00
Rohit Gupta f08c025c10 Allow log_momentum for adaptive optimizers (#5333)
* fix

* fix

* chlog

* no momentum warning

* Apply suggestions from code review

Co-authored-by: Adrian Wälchli <aedu.waelchli@gmail.com>

* ref

Co-authored-by: Adrian Wälchli <aedu.waelchli@gmail.com>

(cherry picked from commit 371daea594)
2021-01-06 12:58:34 +01:00
Rohit Gupta 918fa2b3f1 Add a check for optimizer attatched to lr_scheduler (#5338)
* add a check for scheduler and optimizer

* pep

* Apply suggestions from code review

Co-authored-by: Adrian Wälchli <aedu.waelchli@gmail.com>

Co-authored-by: Adrian Wälchli <aedu.waelchli@gmail.com>

(cherry picked from commit c7d0f4c3a2)
2021-01-06 12:58:06 +01:00
Rohit Gupta 9cfbf8d609 Disable checkpointing, earlystopping and logging with fast_dev_run (#5277)
* Disable checkpointing, earlystopping and logger with fast_dev_run

* docs

* chlog

* disable callbacks and enable DummyLogger

* add log

* use dummy logger method

* Apply suggestions from code review

Co-authored-by: Adrian Wälchli <aedu.waelchli@gmail.com>
Co-authored-by: chaton <thomas@grid.ai>
Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>

(cherry picked from commit f740245521)
2021-01-06 12:57:24 +01:00
tarepan bb366232e7 Add non-existing resume_from_checkpoint acceptance for auto-resubmit (#4402)
* Add empty resume_from_checkpoint acceptance #4366

* Fix general error catch with focused file check

* Add fsspec HTTP extras

Add fsspec's HTTPFileSystem  support through http extras.
pl has supported remote http file (e.g. #2925),
so this commit do not add new functionality.

* Fix potential too much logging in DDP

* Add PR changelog

* Add well-written argument explanation

Co-authored-by: Adrian Wälchli <aedu.waelchli@gmail.com>

* Fix DDP-compatible restore logging

Notify from where the states are restored.
This feature temporally deleted as a result of PR review.
With succeeding review, added with DDP compatibility.

* Fix utility import pathes

* Refactor load step commentaries

* Refactor hpc ckpt suffix acquisition

* Refactor restore/hpc_load match

* Refactor hpc load trial

* Refactor checkpoint dir check

* Refactor unneeded function nest

* Refactor nested If

* Refactor duplicated cache clear

* Refactor attempt flow with if/elif

* Fix pip8

* Refactor hook commentary

Co-authored-by: chaton <thomas@grid.ai>

* Fix pep8

* Refactor hpc load checkpoint path acquisition

* Fix pip8

* Fix typo

Co-authored-by: Adrian Wälchli <aedu.waelchli@gmail.com>

* Fix typo

Co-authored-by: Adrian Wälchli <aedu.waelchli@gmail.com>

* Fix doc

Co-authored-by: Adrian Wälchli <aedu.waelchli@gmail.com>

* Refactor None Union type with Optional

* Fix build-doc CI failure debuged in #5329

* Fix fsspec import during build-doc #5329

* Fix test epoch

Co-authored-by: Adrian Wälchli <aedu.waelchli@gmail.com>

* Fix test with latest test models

* .

Co-authored-by: Adrian Wälchli <aedu.waelchli@gmail.com>
Co-authored-by: chaton <thomas@grid.ai>
Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
Co-authored-by: Sean Naren <sean.narenthiran@gmail.com>
Co-authored-by: Roger Shieh <sh.rog@protonmail.ch>

(cherry picked from commit b0051e8c03)
2021-01-06 12:55:38 +01:00
Jirka Borovec 53b0cb910b update isort config (#5335)
* update isort config

* apply

(cherry picked from commit 724f1051f0)
2021-01-06 12:49:23 +01:00
Tadej Svetina 4292fe0532 Fix metric state reset (#5273)
* Fix metric state reset

* Fix test

* Improve formatting

Co-authored-by: Ananya Harsh Jha <ananya@pytorchlightning.ai>
(cherry picked from commit 4913cbb987)
2021-01-06 12:48:01 +01:00
chaton 5ad13dc964 Trainer.test should return only test metrics (#5214)
* resolve bug

* merge tests

(cherry picked from commit 9ebbfece5e)
2021-01-06 11:55:21 +01:00
Jirka Borovec 52c3081b4c add memory parity for PL vs Vanilla (#5170)
* refactor

* memory

* show

* clean

* clean

* try

* device

* reset

* fix

* fix

* mean

* hook

* format

* add todo

Co-authored-by: chaton <thomas@grid.ai>

Co-authored-by: chaton <thomas@grid.ai>

(cherry picked from commit 6adc1b32bd)
2021-01-06 11:40:01 +01:00
Jirka Borovec dfbb592566 fix test - reduce metric 2021-01-05 09:58:37 +01:00
Jirka Borovec 74d0652164 flake8 ++ 2021-01-05 09:58:37 +01:00
Adrian Wälchli cc14fc16bf skip multi-gpu test when running on single-gpu machine (#5186)
* skip test

* Apply suggestions from code review

Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>
Co-authored-by: Nicki Skafte <skaftenicki@gmail.com>
2021-01-05 09:58:37 +01:00
Boris Dayma dcd29aef06 feat(wandb): offset logging step when resuming (#5050)
* feat(wandb): offset logging step when resuming

* feat(wandb): output warnings

* fix(wandb): allow step to be None

* test(wandb): update tests

* feat(wandb): display warning only once

* style: fix PEP issues

* tests(wandb): fix tests

* tests(wandb): improve test

* style: fix whitespace

* feat: improve warning

Co-authored-by: Adrian Wälchli <aedu.waelchli@gmail.com>

* feat(wandb): use variable from class instance

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>

* tests(wandb): check warnings

* feat(wandb): use WarningCache

* tests(wandb): fix tests

* style: fix formatting

Co-authored-by: Adrian Wälchli <aedu.waelchli@gmail.com>
Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
2021-01-05 09:58:37 +01:00
Jirka Borovec 3c5dad7100 Document speed comparison (#2072)
* docs

* script

* dump

* desc

* import

* import

* if

* norm

* t

* finished

* isort

* typing

Co-authored-by: Nicki Skafte <skaftenicki@gmail.com>

* xlabel

* pandas

* time

Co-authored-by: Nicki Skafte <skaftenicki@gmail.com>
2021-01-05 09:58:37 +01:00
Sean Naren 0211f7f9b2 Disable pl optimizer temporarily to fix AMP issues (#5163)
* Disable pl optimizer temporarily to fix AMP issues

* Add todo and enable pl optimizer in the test
2021-01-05 09:58:37 +01:00
chaton 6b19198aae [bug-fix] Metric reduction with Logging (#5150)
* add test

* resolve bug

* udpate test

* wrongly copy / paste

* update test

* resolve a second bug

Co-authored-by: Ubuntu <ubuntu@ip-172-31-62-109.ec2.internal>
2021-01-05 09:58:37 +01:00
chaton 13bbf4b3f2 Un-balanced logging properly supported (#5119)
* resolve bug

* clean code

* resolve comments

* Update tests/trainer/optimization/test_multiple_optimizers.py

Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>

* resolve another bug

* add comments

* use abs to find diff

* update

* resolve flake8

Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>
2021-01-05 09:58:37 +01:00
chaton 58a2993766 support number for logging with sync_dist=True (#5080)
* support number

* add two tests

* wip

* add ddp in special test

* remove a test

* move device to bottom

* simplify test

* update test

* Update pytorch_lightning/core/step_result.py

Co-authored-by: Carlos Mocholí <carlossmocholi@gmail.com>

* resolve sync_ddp

Co-authored-by: Carlos Mocholí <carlossmocholi@gmail.com>
2021-01-05 09:58:37 +01:00
Loi Ly 1d13943605 Fix reset TensorRunningAccum (#5106)
* Fix reset TensorRunningAccum

* add test for TensorRunningAccum's reset method

* fix CI failed due to PEP8

Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>
2021-01-05 09:58:36 +01:00
Akihiro Nitta 151d86e40b Update isort config (#5142)
* Update isort config

* Apply isort with new config

* Fix typo in isort config

* fix rebase

Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>
2021-01-05 09:57:37 +01:00
Rohit Gupta 81e9d4260e Fix saved filename in ModelCheckpoint if it already exists (#4861)
* disable version if not required

* disable version if not required

* pep

* chlog

* improve test

* improve test

* parametrize test and update del_list

* Update pytorch_lightning/callbacks/model_checkpoint.py

Co-authored-by: Carlos Mocholí <carlossmocholi@gmail.com>

* try appending version to already saved ckpt_file

* Revert "try appending version to already saved ckpt_file"

This reverts commit 710e05e01f738d982aabf1f36c09fa59293e5c0c.

* add more assertions

* use BoringModel

Co-authored-by: Carlos Mocholí <carlossmocholi@gmail.com>
Co-authored-by: chaton <thomas@grid.ai>
Co-authored-by: Roger Shieh <sh.rog@protonmail.ch>
2021-01-05 09:57:37 +01:00
Jirka Borovec 35401706bf add copyright to tests (#5143) 2021-01-05 09:57:37 +01:00
Jirka Borovec c72880f109
hotfix: dataloaders - add unimplemented methods (#5352)
* add unimplemented methods

* test

* test

* flake8
2021-01-05 03:41:20 -05:00
Justus Schock d88cf4a652
Add Support for multiple train loaders (#1959)
* add support for wrong dtype in apply_func

* apply loader resetting to possible collection of loaders

* add combined loader iter class

* integrate combined loader iter to training loop

* fix imports

* fix imports

* finish supporters

* add tests for supporters

* add test for model with multiple loaders

* fix trainer integration

* fix instance check

* Train loaders (#4032)

* patch for issues discussed in #1959, encapsulating underlying datastructures returned from train_dataloader

* update data_loading.py to it uses patch discussed in #1959

* rename class

* Separate CombinedLoaderIterator into two classes, and update related tests. (#4606)

* Fix the bugs after rebasing.

* Add custom get_len for apply_to_collection

* Refactor MultiIterator to be as CombinedLoaderIterator

* To get the right num_training_batches. Call the wrapper for multi trainloader in data_loading.py, instead of training_loop.py

* Reload _loader_iters when calling __iter__

* Don't transform DataLoader to CombinedLoaderIterator when it's along

* Updates test_fit_multiple_train_loaders for testing num_training_batches

* Seperate CombinedLoaderIterator into CombinedLoaderIterator and CombinedDataLoader. Add CombinedDataset for unified DataLoader format.

* Initialize CombinedDataLoader before calculating num_training_batches. Also updating self._worker_check for multiple loaders

* Update tests for supporters

* Update tests for multiple trainloaders. Add tests about few_workers for multiple loaders.

* Fix pep8 issues

* Add tests for train_loader_patch.py

* Add descriptions to multiple_trainloader_mode

* Remove unused variables

* Add docstrings and typing

* Add more tests for better converage

* Remove unused commented codes

* Add sampler property

* Remove extract_dataset

* Update typing

* pep8

* Update train_loader_patch.py

* Apply suggestions from code review

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>

* Update pytorch_lightning/trainer/supporters.py

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>

* reviewer comments

* fix stupid import

* add docs

* add back line separator

* fix line sep

* pep8

* Apply suggestions from code review

* fix

* fix

* Apply suggestions from code review

Co-authored-by: Adrian Wälchli <aedu.waelchli@gmail.com>

* Apply suggestions from code review

Co-authored-by: Nicki Skafte <skaftenicki@gmail.com>

* flake8

Co-authored-by: Justus Schock <justusschock@justuss-mbp.fritz.box>
Co-authored-by: Christofer Fransson <christofer_fransson@yahoo.com>
Co-authored-by: YI-LIN SUNG <r06942076@ntu.edu.tw>
Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>
Co-authored-by: Adrian Wälchli <aedu.waelchli@gmail.com>
Co-authored-by: Nicki Skafte <skaftenicki@gmail.com>
Co-authored-by: Jirka Borovec <jirka.borovec@seznam.cz>
2021-01-04 19:57:53 +00:00
Jirka Borovec b72ed71d4e
Refactor: clean trainer device & distrib setters (#5297)
* naive replace

* simplify

* clean

* .

* fix

* .

* fix

* fix
2021-01-04 17:10:13 +00:00
Jirka Borovec 957583544a
mark todo exceptions (#5320)
* mark todo exceptions

* .

* .

* .

* .

* .

* .

* .

* .

* try

* .
2021-01-04 09:07:56 +01:00
Jirka Borovec af833f673c
drop deprecated TrainResult (#5323)
* drop TrainResult

* .

* .

* .

* .

* .

* .
2021-01-04 09:54:21 +08:00
Jirka Borovec 2264fe64e3
Refactor/prune unused EvalModel methods (#5331)
* model valid

* model train

* model test

* model opt
2021-01-03 15:09:54 +01:00
Jirka Borovec f2c2a692e1
drop deprecated fbeta metrics (#5322)
* drop deprecated fbeta metrics

* flake8

* imports

* chlog
2021-01-02 00:49:23 +00:00
Jirka Borovec fb90eec515
drop deprecated checkpoint filepath (#5321)
* drop deprecated checkpoint filepath

* tests
2021-01-02 00:08:29 +01:00
Nicki Skafte 9dbdffca1e
[Metrics] R2Score (#5241)
* add r2metric

* change init

* add test

* add docs

* add math

* Apply suggestions from code review

Co-authored-by: Teddy Koker <teddy.koker@gmail.com>
Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>

* changelog

* adjusted parameter

* add more test

* pep8

* Apply suggestions from code review

Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>

* add warnings for adjusted score

Co-authored-by: Teddy Koker <teddy.koker@gmail.com>
Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>
2021-01-01 12:23:19 +01:00
Tadej Svetina 7f71ee9265
Classification metrics overhaul: stat scores (3/n) (#4839)
* Add stuff

* Change metrics documentation layout

* Add stuff

* Add stat scores

* Change testing utils

* Replace len(*.shape) with *.ndim

* More descriptive error message for input formatting

* Replace movedim with permute

* PEP 8 compliance

* WIP

* Add reduce_scores function

* Temporarily add back legacy class_reduce

* Division with float

* PEP 8 compliance

* Remove precision recall

* Replace movedim with permute

* Add back tests

* Add empty newlines

* Add empty line

* Fix permute

* Fix some issues with old versions of PyTorch

* Style changes in error messages

* More error message style improvements

* Fix typo in docs

* Add more descriptive variable names in utils

* Change internal var names

* Break down error checking for inputs into separate functions

* Remove the (N, ..., C) option in MD-MC

* Simplify select_topk

* Remove detach for inputs

* Fix typos

* Update pytorch_lightning/metrics/classification/utils.py

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>

* Update docs/source/metrics.rst

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>

* Minor error message changes

* Update pytorch_lightning/metrics/utils.py

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>

* Reuse case from validation in formatting

* Refactor code in _input_format_classification

* Small improvements

* PEP 8

* Update pytorch_lightning/metrics/classification/utils.py

Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>

* Update pytorch_lightning/metrics/classification/utils.py

Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>

* Update docs/source/metrics.rst

Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>

* Update pytorch_lightning/metrics/classification/utils.py

Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>

* Apply suggestions from code review

Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>

* Alphabetical reordering of regression metrics

* Change default value of top_k and add error checking

* Extract basic validation into separate function

* Update to new top_k default

* Update desciption of parameters in input formatting

* Apply suggestions from code review

Co-authored-by: Nicki Skafte <skaftenicki@gmail.com>

* Check that probabilities in preds sum to 1 (for MC)

* Fix coverage

* Split accuracy and hamming loss

* Remove old redundant accuracy

* Minor changes

* Fix imports

* Improve docstring descriptions

* Fix imports

* Fix edge case and simplify testing

* Fix docs

* PEP8

* Reorder imports

* Add top_k parameter

* Update changelog

* Update docstring

* Update docstring

* Reverse formatting changes for tests

* Change parameter order

* Remove formatting changes 2/2

* Remove formatting 3/3

* .

* Improve description of top_k parameter

* Apply suggestions from code review

* Apply suggestions from code review

Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>

* Remove unneeded assert

* Update pytorch_lightning/metrics/functional/accuracy.py

Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>

* Remove unneeded assert

* Explicit checking of parameter values

* Apply suggestions from code review

Co-authored-by: Nicki Skafte <skaftenicki@gmail.com>

* Apply suggestions from code review

* Fix top_k checking

* PEP8

* Don't check dist_sync in test

* add back check_dist_sync_on_step

* Make sure half-precision inputs are transformed (#5013)

* Fix typo

* Rename hamming loss to hamming distance

* Fix tests for half precision

* Fix docs underline length

* Fix doc undeline length

* Replace mdmc_accuracy parameter with subset_accuracy

* Update changelog

* Fix unwanted accuracy change

* Enable top_k for ML prob inputs

* Test that default threshold is 0.5

* Fix typo

* Update top_k description in helpers

* updates

* Update styling and add back tests

* Remove excess spaces

* fix torch.where for old versions

* fix linting

* Update docstring

* Fix docstring

* Apply suggestions from code review (mostly docs)

* Default threshold to None, accept only (0,1)

* Change wrong threshold message

* Improve documentation and add tests

* Add back ddp tests

* Change stat reduce method and default

* Remove DDP tests and fix doctests

* Fix doctest

* Update changelog

* Refactoring

* Fix typo

* Refactor

* Increase coverage

* Fix linting

* Consistent use of backticks

* Fix too long line in docs

* Apply suggestions from code review

* Fix deprecation test

* Fix deprecation test

* Default threshold back to 0.5

* Minor documentation fixes

* Add types to tests

Co-authored-by: Teddy Koker <teddy.koker@gmail.com>
Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
Co-authored-by: chaton <thomas@grid.ai>
Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>
Co-authored-by: Nicki Skafte <skaftenicki@gmail.com>
Co-authored-by: Justus Schock <12886177+justusschock@users.noreply.github.com>
2020-12-30 20:49:50 +01:00
Prudhvi Rampey 2094633181
Implement partial auroc metric (#3790)
* Implement partial auroc metric

* Add pycodestyle changes

* Added tests for max_fpr

* changelog

* version for tests

* fix imports

* fix tests

* fix tests

* Added more thresholds in (0,1] to test max_fpr

* Removed deprecated 'reorder' param from auroc

* changelog

* Apply suggestions from code review

Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>

* remove old structure

* Apply suggestions from code review

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>

* fix test error

Co-authored-by: Nicki Skafte <nugginea@gmail.com>
Co-authored-by: Nicki Skafte <skaftenicki@gmail.com>
Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>
2020-12-29 19:10:19 +01:00
Jirka Borovec 7a615b5651
add tests for Trainer attributes (#5261)
* add tests for Trainer attributes

* drop empty
2020-12-29 18:56:13 +01:00
Jirka Borovec 2718d7d214
CI: fix nightly release version (#5260)
* CI fix nigtly releases

* format

* fix unrelated flake8
2020-12-24 17:18:15 +01:00
Jirka Borovec a884866ff0
Unify names in Utils (#5199)
* warnings

* argparse

* mutils

* xla device

* deprecated

* tests

* simple

* flake8

* fix

* flake8

* 1.4
2020-12-22 00:23:33 +01:00
Tadej Svetina ccffc344ca
Classification metrics overhaul: accuracy metrics (2/n) (#4838)
* Add stuff

* Change metrics documentation layout

* Add stuff

* Change testing utils

* Replace len(*.shape) with *.ndim

* More descriptive error message for input formatting

* Replace movedim with permute

* PEP 8 compliance

* Division with float

* Style changes in error messages

* More error message style improvements

* Fix typo in docs

* Add more descriptive variable names in utils

* Change internal var names

* Break down error checking for inputs into separate functions

* Remove the (N, ..., C) option in MD-MC

* Simplify select_topk

* Remove detach for inputs

* Fix typos

* Update pytorch_lightning/metrics/classification/utils.py

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>

* Update docs/source/metrics.rst

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>

* Minor error message changes

* Update pytorch_lightning/metrics/utils.py

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>

* Reuse case from validation in formatting

* Refactor code in _input_format_classification

* Small improvements

* PEP 8

* Update pytorch_lightning/metrics/classification/utils.py

Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>

* Update pytorch_lightning/metrics/classification/utils.py

Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>

* Update docs/source/metrics.rst

Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>

* Update pytorch_lightning/metrics/classification/utils.py

Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>

* Apply suggestions from code review

Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>

* Alphabetical reordering of regression metrics

* Change default value of top_k and add error checking

* Extract basic validation into separate function

* Update to new top_k default

* Update desciption of parameters in input formatting

* Apply suggestions from code review

Co-authored-by: Nicki Skafte <skaftenicki@gmail.com>

* Check that probabilities in preds sum to 1 (for MC)

* Fix coverage

* Split accuracy and hamming loss

* Remove old redundant accuracy

* Minor changes

* Fix imports

* Improve docstring descriptions

* Fix edge case and simplify testing

* Fix docs

* PEP8

* Reorder imports

* Update changelog

* Update docstring

* Update docstring

* Reverse formatting changes for tests

* Change parameter order

* Remove formatting changes 2/2

* Remove formatting 3/3

* .

* Improve description of top_k parameter

* Apply suggestions from code review

* Apply suggestions from code review

Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>

* Remove unneeded assert

* Update pytorch_lightning/metrics/functional/accuracy.py

Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>

* Remove unneeded assert

* Explicit checking of parameter values

* Apply suggestions from code review

Co-authored-by: Nicki Skafte <skaftenicki@gmail.com>

* Apply suggestions from code review

* Fix top_k checking

* PEP8

* Don't check dist_sync in test

* add back check_dist_sync_on_step

* Make sure half-precision inputs are transformed (#5013)

* Fix typo

* Rename hamming loss to hamming distance

* Fix tests for half precision

* Fix docs underline length

* Fix doc undeline length

* Replace mdmc_accuracy parameter with subset_accuracy

* Update changelog

* Apply suggestions from code review

Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>

* Suggestions from code review

* Fix number in docs

* Update pytorch_lightning/metrics/classification/accuracy.py

* Replace topk by argsort in select_topk

* Fix changelog

* Add test for wrong params

* Add Google Colab badges (#5111)

* Add colab badges to notebook

Add colab badges to notebook to notebooks 4 & 5

* Add colab badges

Co-authored-by: chaton <thomas@grid.ai>

* Fix hanging metrics tests (#5134)

* Use torch.topk again as ddp hanging tests fixed in #5134

* Fix unwanted notebooks change

* Fix too long line in hamming_distance

* Apply suggestions from code review

* Apply suggestions from code review

* protect

* Update CHANGELOG.md

Co-authored-by: Teddy Koker <teddy.koker@gmail.com>
Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
Co-authored-by: chaton <thomas@grid.ai>
Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>
Co-authored-by: Nicki Skafte <skaftenicki@gmail.com>
Co-authored-by: Justus Schock <12886177+justusschock@users.noreply.github.com>
Co-authored-by: Roger Shieh <sh.rog@protonmail.ch>
Co-authored-by: Shachar Mirkin <shacharmirkin@gmail.com>
2020-12-21 16:42:51 +01:00
Jirka Borovec 0f36525e8f
fix/enable - check F401 (#5201)
* refactor - check F401

* missed

* fix
2020-12-21 10:15:04 +01:00
Jirka Borovec 35fd6e93c7
refactor - check E501 (#5200) 2020-12-21 14:23:09 +05:30
Jirka Borovec 6d2c564bc6
refactor - check F841 (#5202) 2020-12-21 11:10:55 +05:30
chaton f3748ba808
[feat] Enable self.log in callbacks (#5094)
* enable to use self.log in callbacks

* update

* revert back to assert
2020-12-16 16:08:39 -05:00
Jirka Borovec 059eaecbb4
set xxx_AVAILABLE as protected (#5082)
* sett xxx_AVAILABLE as protected

* docs
2020-12-14 20:19:05 +05:30
Carlos Mocholí 0327f6b4c2
Do not warn when the name key is used in the lr_scheduler dict (#5057)
* Do not warn when the name key is used

* Missing line

* Consistency

* Update pytorch_lightning/callbacks/lr_monitor.py

* Update docs

* Update pytorch_lightning/core/lightning.py

Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>

* Update CHANGELOG

Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>
2020-12-14 08:38:10 +01:00
tarepan 16feb5137b
Refactor load in checkpoint connector (#4593)
* Refactor load step commentaries

* Refactor hpc ckpt suffix acquisition

* Refactor restore/hpc_load match

* Refactor hpc load trial

* Refactor checkpoint dir check

* Refactor unneeded function nest

* Refactor nested If

* Refactor duplicated cache clear

* Refactor attempt flow with if/elif

* Fix pip8

* Refactor hook commentary

Co-authored-by: chaton <thomas@grid.ai>

* Fix pep8

* Refactor hpc load checkpoint path acquisition

* Fix pip8

* Fix doc

Co-authored-by: Adrian Wälchli <aedu.waelchli@gmail.com>

* Refactor None Union type with Optional

Co-authored-by: chaton <thomas@grid.ai>
Co-authored-by: Adrian Wälchli <aedu.waelchli@gmail.com>
Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
Co-authored-by: Roger Shieh <sh.rog@protonmail.ch>
2020-12-14 00:13:50 +08:00
Carlos Mocholí 398f122a42
Improve some tests (#5049)
* Improve some tests

* Add TrainerState asserts

Co-authored-by: Roger Shieh <sh.rog@protonmail.ch>
2020-12-13 23:04:16 +08:00
Jirka Borovec a49291d98d
drop unused test with result api (#5058)
Co-authored-by: chaton <thomas@grid.ai>
Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>
2020-12-12 21:51:19 +05:30
Jirka Borovec b50ad9ee95
split tests for deprecated api (#5071)
* imports

* imports

* flake8

Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>
2020-12-12 20:25:11 +05:30
Rohit Gupta 3100b7839a
Allow any input in to_onnx and to_torchscript (#4378)
* branch merge

* sample

* update with valid input tensors

* pep

* pathlib

* Updated with BoringModel and added more input types

* try fix

* pep

* skip test with torch < 1.4

* fix test

* Apply suggestions from code review

* update tests

* Allow any input in to_onnx and to_torchscript

* Update tests/models/test_torchscript.py

Co-authored-by: Adrian Wälchli <aedu.waelchli@gmail.com>

* no_grad

* try fix random failing test

* rm example_input_array

* rm example_input_array

Co-authored-by: chaton <thomas@grid.ai>
Co-authored-by: Jeff Yang <ydcjeff@outlook.com>
Co-authored-by: Roger Shieh <sh.rog@protonmail.ch>
Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
Co-authored-by: Adrian Wälchli <aedu.waelchli@gmail.com>
Co-authored-by: edenlightning <66261195+edenlightning@users.noreply.github.com>
2020-12-12 18:17:03 +08:00
Jirka Borovec 1e501f0f40
add back compatibility for deprecated metrics 2/n (#5068)
* add back compatibility for deprecated metrics

* fix

* imports

* imports
2020-12-11 22:56:19 +01:00
Jirka Borovec 4a3f9069cb
add back compatibility for deprecated metrics 1/n (#5067)
* add back compatibility for metrics

* tests

* Add deprecated metric utility functions back to functional (#5062)

* add back *deprecated* metric utility functions to functional

* pep

* pep

* suggestions

* move

Co-authored-by: Jirka Borovec <jirka.borovec@seznam.cz>

* more

* fix

* import

* docs

* tests

* fix

Co-authored-by: Teddy Koker <teddy.koker@gmail.com>
2020-12-11 22:11:21 +01:00
chaton 1a970b2d8d
[hotfix] Extend Optimizer + update doc (#5095)
* resolve urgent bug

* update pr

* update doc

* update

* remove typo

* add defaults

* Update pytorch_lightning/__init__.py

* Update setup.py

* update doc

* Update docs/source/optimizers.rst

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>

* update

* resolve doc

* debug test

* update test

* Update docs/source/optimizers.rst

Co-authored-by: Adrian Wälchli <aedu.waelchli@gmail.com>

* Update docs/source/optimizers.rst

Co-authored-by: Adrian Wälchli <aedu.waelchli@gmail.com>

* Update docs/source/optimizers.rst

Co-authored-by: Adrian Wälchli <aedu.waelchli@gmail.com>

* remove useless import

* Update docs/source/optimizers.rst

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
Co-authored-by: Adrian Wälchli <aedu.waelchli@gmail.com>
2020-12-11 14:24:59 -05:00
Jirka Borovec 74171efadf
drop duplicate metrics (#5014)
* drop duplicate metrics

* keep

* fix
2020-12-11 18:42:53 +01:00
chaton 7755572b4f
Check if optimizer supports closure (#4981)
* check if optimizer support closure

* cleanup test

* resolve tests

* resolve flake

* update test due to patch limit

* update

* update dep

* Update tests/core/test_lightning_optimizer.py

Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>

* Update tests/core/test_lightning_optimizer.py

Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>

* resolve bug

* update test

* resolve tests

* Update requirements/extra.txt

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>

* remove bolts dep

* remove bolts

* add missing bolts dep for tests

* remove need for bolts

Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>
Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
2020-12-11 14:51:45 +01:00
Jirka Borovec 4ebce38478
update usage of deprecated automatic_optimization (#5011)
* drop deprecated usage automatic_optimization

* Apply suggestions from code review

Co-authored-by: Adrian Wälchli <aedu.waelchli@gmail.com>

* Apply suggestions from code review

Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>

Co-authored-by: Adrian Wälchli <aedu.waelchli@gmail.com>
Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>
2020-12-10 15:31:33 +05:30
Jirka Borovec 77fb425dd4
update usage of deprecated profiler (#5010)
* drop deprecated profiler

* lut

Co-authored-by: Roger Shieh <sh.rog@protonmail.ch>
2020-12-10 08:38:14 +01:00
Jirka Borovec 05f25f3a54
update usage of deprecated checkpoint_callback (#5006)
* drop usage of deprecated checkpoint_callback

* fix

* fix
2020-12-09 14:14:34 -05:00
Jirka Borovec ce9179591d
ref: clean config [1/n] add intermediate setters (#4990)
* add intermediate setters

* show inputs

* fix options

* move

* fix

* less talk

* fix

* talk less

* str

* cases

* rename

Co-authored-by: chaton <thomas@grid.ai>
2020-12-09 14:13:57 -05:00
Jirka Borovec 90d1d9fa73
drop deprecated reorder from AUC (#5004)
* drop deprecated reorder from AUC

* chlog

* fix

* fix

* simple

* fix

* fix

* fix

Co-authored-by: Roger Shieh <sh.rog@protonmail.ch>
2020-12-09 18:05:12 +00:00
chaton ef8ef12fd0
[feat] pp 2/n (#5026)
* Added changes for RPC plugin

* Add missing kwargs

* Fix code format

* Loading refactors by introducing is_distributed var, fix optimizer step flow

* Add rpc guard

* Added docstrings and typing

* resolve comments

* Add additional rpc hook, refactor name of exit process hook for clarity

* remove annotation

* Modify behaviour to allow optional return, add test for rpc plugin

* resolve tests

* rename is_ddp_based

* update

* update for windows

* update

* resolve test

* code smell

* Added sequential plugin

* resolve bug

* update

* cleanup

* add Exception

* resolve docs

* Remove ddp support

* Revert distributed -> ddp

* Update pl_examples/basic_examples/conv_sequential_example.py

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>

* Update pl_examples/basic_examples/conv_sequential_example.py

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>

* Update pytorch_lightning/plugins/ddp_sequential_plugin.py

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>

* Address code review points

* Update pytorch_lightning/plugins/ddp_sequential_plugin.py

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>

* Update pytorch_lightning/plugins/ddp_sequential_plugin.py

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>

* Add missing return

* Fix formatting, add datamodule args

* add small comment

* resolve comments

* resolve comments

* update source for fairscale

* update extras

* remove staticmethod

* resolve flake8

* Skip tests that are failing due to bug upstream with multiple optimizers and shard

* update

* update on comments

* clean test

* latest comments

* remove old comments

* add todo

* Update version

* update

* resolve bugs

* resolve bugs

* update test

* remove hanging test

* Update pytorch_lightning/plugins/ddp_sequential_plugin.py

Co-authored-by: Carlos Mocholí <carlossmocholi@gmail.com>

* resolve on comments

* Update pytorch_lightning/plugins/ddp_sequential_plugin.py

Co-authored-by: Carlos Mocholí <carlossmocholi@gmail.com>

* resolve on comments

* Update pytorch_lightning/plugins/ddp_sequential_plugin.py

Co-authored-by: Carlos Mocholí <carlossmocholi@gmail.com>

* Update pytorch_lightning/plugins/ddp_sequential_plugin.py

Co-authored-by: Carlos Mocholí <carlossmocholi@gmail.com>

* Update pytorch_lightning/plugins/ddp_sequential_plugin.py

Co-authored-by: Carlos Mocholí <carlossmocholi@gmail.com>

* Update pytorch_lightning/plugins/ddp_sequential_plugin.py

Co-authored-by: Carlos Mocholí <carlossmocholi@gmail.com>

* remove ImportError

Co-authored-by: SeanNaren <sean@grid.ai>
Co-authored-by: Sean Naren <sean.narenthiran@gmail.com>
Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
Co-authored-by: Carlos Mocholí <carlossmocholi@gmail.com>
2020-12-09 12:56:51 +00:00
Jirka Borovec 53d7c9555c
drop usage of deprecated distributed_backend (#5009)
Co-authored-by: chaton <thomas@grid.ai>
Co-authored-by: Roger Shieh <sh.rog@protonmail.ch>
2020-12-09 09:18:23 +01:00
Ananya Harsh Jha 127454ade2
All gatherwith grads (#5012)
* all_gather

* ddp

* horovod

* grad tests

* fixed ddp

* ddp fixed, removed tpu, horovod for now

* changelog

* windows fix

* windows fix

* removed batch from ctx

* all_gather

* ddp

* horovod

* grad tests

* fixed ddp

* ddp fixed, removed tpu, horovod for now

* changelog

* windows fix

* windows fix

* removed batch from ctx

* removed code duplication

* merge

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
2020-12-08 23:20:01 +00:00
Sean Naren ee9b3fe574
[feat] pp 1/n (#5016)
* Added changes for RPC plugin

* Add missing kwargs

* Fix code format

* Loading refactors by introducing is_distributed var, fix optimizer step flow

* Add rpc guard

* Added docstrings and typing

* resolve comments

* Add additional rpc hook, refactor name of exit process hook for clarity

* remove annotation

* Modify behaviour to allow optional return, add test for rpc plugin

* resolve tests

* rename is_ddp_based

* update

* update for windows

* update

* resolve test

* code smell

* Revert back to init_ddp_connection for backwards compat

* Swap to explicit name for property

* Add missing speed parity increase for CI variability, fix call counts for child process

Co-authored-by: tchaton <thomas@grid.ai>
2020-12-08 22:02:10 +00:00
Rohit Gupta 6d2aeff26a
fast_dev_run can be int (#4629)
* fast_dev_run can be int

* pep

* chlog

* add check and update docs

* logging with fdr

* update docs

* suggestions

Co-authored-by: Carlos Mocholí <carlossmocholi@gmail.com>

* fdr flush logs

* update trainer.fast_dev_run

* codefactor and pre-commit isort

* tmp

Co-authored-by: Carlos Mocholí <carlossmocholi@gmail.com>
Co-authored-by: Roger Shieh <sh.rog@protonmail.ch>
Co-authored-by: edenlightning <66261195+edenlightning@users.noreply.github.com>
2020-12-09 01:37:53 +05:30
chaton 2393474350
[hotfix] ddp + manual_optimisation (#4976)
* Rely on ddp plugin for blocking sync behaviour, and skip if we're using manual optimization

* debug

* Revert "debug"

This reverts commit ccca6b6b

* Expose manual reduce for automatic optimization

* Add input arguments

* Enable parity test

* clean imports

* Expose hook after to ensure we reset

* Fix naming

* add

* fix test

* resolve on comments

* typo

* Update tests/trainer/optimization/test_manual_optimization.py

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>

* Update tests/trainer/optimization/test_manual_optimization.py

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>

* update on comments

* resolve comments

Co-authored-by: SeanNaren <sean@grid.ai>
Co-authored-by: Sean Naren <sean.narenthiran@gmail.com>
Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
2020-12-07 19:31:54 +00:00
Tadej Svetina fedc0d1360
Classification metrics overhaul: input formatting standardization (1/n) (#4837)
* Add stuff

* Change metrics documentation layout

* Change testing utils

* Replace len(*.shape) with *.ndim

* More descriptive error message for input formatting

* Replace movedim with permute

* Style changes in error messages

* More error message style improvements

* Fix typo in docs

* Add more descriptive variable names in utils

* Change internal var names

* Break down error checking for inputs into separate functions

* Remove the (N, ..., C) option in MD-MC

* Simplify select_topk

* Remove detach for inputs

* Fix typos

* Update pytorch_lightning/metrics/classification/utils.py

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>

* Update docs/source/metrics.rst

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>

* Minor error message changes

* Update pytorch_lightning/metrics/utils.py

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>

* Reuse case from validation in formatting

* Refactor code in _input_format_classification

* Small improvements

* PEP 8

* Update pytorch_lightning/metrics/classification/utils.py

Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>

* Update pytorch_lightning/metrics/classification/utils.py

Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>

* Update docs/source/metrics.rst

Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>

* Update pytorch_lightning/metrics/classification/utils.py

Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>

* Apply suggestions from code review

Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>

* Alphabetical reordering of regression metrics

* Change default value of top_k and add error checking

* Extract basic validation into separate function

* Update desciption of parameters in input formatting

* Apply suggestions from code review

Co-authored-by: Nicki Skafte <skaftenicki@gmail.com>

* Check that probabilities in preds sum to 1 (for MC)

* Fix coverage

* Minor changes

* Fix edge case and simplify testing

Co-authored-by: Teddy Koker <teddy.koker@gmail.com>
Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
Co-authored-by: chaton <thomas@grid.ai>
Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>
Co-authored-by: Nicki Skafte <skaftenicki@gmail.com>
2020-12-07 17:49:35 +01:00
chaton 02152c1729
Simplify optimization Logic (#4984)
* Rely on ddp plugin for blocking sync behaviour, and skip if we're using manual optimization

* debug

* Revert "debug"

This reverts commit ccca6b6b

* Expose manual reduce for automatic optimization

* Add input arguments

* Enable parity test

* clean imports

* Expose hook after to ensure we reset

* Fix naming

* add

* fix test

* uniformize optimizer logic

* resolve test

* resovle flake8

* resolve amp bug

* update tests

* remove bug

* remove optimizer_step in accelerators

* typo

* update lightning optimizer

* set doesn't work with ddp_spawn

* resolve flake8

* update threshold

* ignore pyright

* correct codeFactor

* remove useless if

* remove zer_grad function

* simplify step

* remove typo

* resolve bug

* Apply suggestions from code review

* update on comments

* resolve bugs

* remove tests

* Update pytorch_lightning/trainer/configuration_validator.py

Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>

* simplify testing

* add more tests

Co-authored-by: SeanNaren <sean@grid.ai>
Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>
2020-12-07 12:55:49 +00:00
Jirka Borovec ab7c947961
simplify CI horovod (#4951)
* simplify CI horovod

* reorder
2020-12-07 10:31:33 +01:00
Jan-Henrik Lambrechts b00991efd8
Added changeable extension variable for model checkpoints (#4977)
* Added changeable extension variable for model checkpoints

* Removed whitespace

* Removed the last bit of whitespace

* Wrote tests for FILE_EXTENSION

* Fixed formatting issues

* More formatting issues

* Simplify test by just using defaults

* Formatting to PEP8

* Added dummy class that inherits ModelCheckpoint; run only one batch instead of epoch for integration test

* Fixed too much whitespace formatting

* some changes

Co-authored-by: rohitgr7 <rohitgr1998@gmail.com>
2020-12-06 22:58:50 +05:30
chaton 2e838e6dd8
Enable`self.log` in most functions. (#4969)
* refactor

* solve pyright

* remove logging in batch_start functions

* update docs

* update doc

* resolve bug

* update

* correct script

* resolve on comments
2020-12-06 13:01:43 +00:00
Marc Ferradou 849737e7ca
[Bug Fix] Allow logger to support indexing (#4595)
* [Bug Fix] Allow logger to support indexing

This should fix #4540

* Adding test for indexes for DummyLogger

* Apply suggestions from code review

Co-authored-by: chaton <thomas@grid.ai>

* pep8

* added test for dummyexperiment

Co-authored-by: chaton <thomas@grid.ai>
Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
Co-authored-by: Nicki Skafte <skaftenicki@gmail.com>
Co-authored-by: Sean Naren <sean.narenthiran@gmail.com>
2020-12-05 21:00:31 +00:00
Gianluca Scarpellini 16fa4ed1e5
Fixed PYTHONPATH for ddp test model (#4528)
* Fixed PYTHONPATH for ddp test model

* Removed debug calls

* Apply suggestions from code review

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
Co-authored-by: chaton <thomas@grid.ai>
Co-authored-by: Sean Naren <sean.narenthiran@gmail.com>
2020-12-05 20:09:47 +00:00
Nicki Skafte 1b40a4053d
Auto convert to contiguous format for all_gather (#4907)
* convert memory format

* changelog

* formatting

* suggestions

* retrigger tests

Co-authored-by: Nicki Skafte <nugginea@gmail.com>
Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
Co-authored-by: chaton <thomas@grid.ai>
2020-12-05 15:49:45 +01:00
Carlos Mocholí 72349706c1
Improve epoch_result_store code quality (#4875)
* Improve code quality

* black -l 120 -S

* Fix pyright error

Co-authored-by: Sean Naren <sean.narenthiran@gmail.com>
Co-authored-by: chaton <thomas@grid.ai>
2020-12-05 11:49:28 +00:00
Nicki Skafte bf7c28cd54
[Metrics] PrecisionRecallCurve, ROC and AveragePrecision class interface (#4549)
* initial changes

* remove old

* init files

* add average precision

* add precision_recall_curve

* add roc

* cleaning

* docs

* pep8

* docs

* pep8

* changelog

* examples prune duplicate roc

* format

* imports

* fix

* format

* flake8

* duplicate

* fix

* flake8

* docs

* docs

Co-authored-by: Teddy Koker <teddy.koker@gmail.com>
Co-authored-by: Nicki Skafte <nugginea@gmail.com>
Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
Co-authored-by: Jirka Borovec <jirka.borovec@seznam.cz>
2020-12-04 22:42:23 +01:00
Justus Schock f23f5e5648
Fix DP Logging Aggregation (#4138)
* add option to step result to do aggregation on a specific device

* in dp: do aggregation on root gpu

* Update CHANGELOG.md

* pep8

* trailing whitespace

* move to root


move result


stupid result object


revert to master


undo import


add "to" method to result


generalize to


try a test


try a test


Revert "try a test"

This reverts commit 22e3c1001e6c5774ea18ad925830304c245bf145.

Revert "try a test"

This reverts commit 4d2d8fb2a52d552894809a0cbe51af126d78f070.

new test


max epochs


super epoch end 


log in test


hanging test


undo test


initial test that fails on master


step end


pass


step end


step end


epoch end


print


step


check dev


clean up test


sanity check


wtf is go ing on


frustration


debugging test


test


test


test


test


test


test


test


test


unused import

* move chlog entry

* clean

* remove outdated changes

Co-authored-by: Adrian Wälchli <aedu.waelchli@gmail.com>
Co-authored-by: Jirka Borovec <jirka.borovec@seznam.cz>
2020-12-04 19:10:07 +01:00
Sean Naren ed5bda3eda
[docs] Added description of saving using ddp (#4660)
* Added description of saving using ddp

* Added code block example to explain DDP saving logic

* Fixed underline

* Added verbose explanation

* Apply suggestions from code review

* Added caveat when using custom saving functions

* flake8

Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>
Co-authored-by: Jirka Borovec <jirka.borovec@seznam.cz>
2020-12-04 17:59:38 +01:00
chaton 62903717a4
[TEST] Min steps override early stopping (#4283)
* test to make sure behaviour is enforced

* test_min_steps_override_early_stopping_functionality

* make sure Excepted Behaviour is reproduced

* remove pollution from extra logging

* update docstring

* reduce test time

* resolve pep8
2020-12-04 17:10:14 +01:00
Rohit Gupta 342a2b6f25
Deprecate auto mode from ModelCheckpoint and EarlyStopping (#4695)
* remove auto mode from callbacks

* chlog

* remove auto mode from callbacks

* mode

* mode

* move back

* update docs

* update docstrings

* docstring warning

* fix syntax

* Apply suggestions from code review

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>

* isort

* default to 'auto'

* syntax

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
2020-12-04 16:11:58 +01:00
Adrian Wälchli f878a2699f
deprecate hprams setter method (#4813)
* deprecate hprams setter method

* update chlog

* isort

* update deprecation warning

Co-authored-by: Nicki Skafte <skaftenicki@gmail.com>
Co-authored-by: chaton <thomas@grid.ai>
Co-authored-by: Ananya Harsh Jha <ananya@pytorchlightning.ai>
Co-authored-by: Roger Shieh <sh.rog@protonmail.ch>
Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
2020-12-04 12:28:53 +01:00
Jirka Borovec 3976db597d
refactor imports of optional dependencies (#4859)
* refactor imports of optional dependencies

* fix

* fix

* fix

* fix

* fix

* flake8

* flake8

Co-authored-by: Sean Naren <sean.narenthiran@gmail.com>
Co-authored-by: chaton <thomas@grid.ai>
2020-12-04 10:26:10 +01:00
Jirka Borovec eeae426b33
CI: skip hanging (#4943)
* CI: try increase time limit

* try min 3.8

* no ex

* CI

* dep

* test

* deps

* deps

* drop

* drop

Co-authored-by: chaton <thomas@grid.ai>
2020-12-02 16:18:14 +00:00
Lezwon Castelino 12cb9942a1
Tpu save (#4309)
* convert xla tensor to cpu before save

* move_to_cpu

* updated CHANGELOG.md

* added on_save to accelerators

* if accelerator is not None

* refactors

* change filename to run test

* run test_tpu_backend

* added xla_device_utils to tests

* added xla_device_utils to test

* removed tests

* Revert "added xla_device_utils to test"

This reverts commit 0c9316bb

* fixed pep

* increase timeout and print traceback

* lazy check tpu exists

* increased timeout
removed barrier for tpu during test
reduced epochs

* fixed torch_xla imports

* fix tests

* define xla utils

* fix test

* aval

* chlog

* docs

* aval

* Apply suggestions from code review

Co-authored-by: Jirka Borovec <jirka.borovec@seznam.cz>
Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
Co-authored-by: chaton <thomas@grid.ai>
Co-authored-by: Sean Naren <sean.narenthiran@gmail.com>
2020-12-02 13:05:11 +00:00
Jirka Borovec add387c6a7
CI cleaning (#4941)
* set

* cut

* env

* oonce

* env

* env

* env
2020-12-02 10:00:05 +00:00
Sean Naren e952dee292
Allow string plugins (#4888)
* Allow plugin to be chosen via string

* Fix implementation, add tests

* Fix codefactor issues

* Added missing env patch

* Skip test for windows

* Reword reason

* Add skip to invalid test

* Create required_plugins function, move sharded amp requirement to plugin

* Pass AMPType, fix setter for apex

* Better doc strings

* Add exception when using apex

* Add trainer available_plugins function, warn user when plugins have been added automatically with option to override behaviour

* Fixed pep8 indent

* Fix codefactor issues

* Add env variables

* Update pytorch_lightning/cluster_environments/cluster_environment.py

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>

* Addressed code review

* Update pytorch_lightning/plugins/plugin_connector.py

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>

* Update pytorch_lightning/plugins/plugin_connector.py

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>

* Update pytorch_lightning/plugins/plugin_connector.py

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>

* Addressed more code review feedback

* Fixed docstrings

* Swapped to verbose runtime error

* Apply suggestions from code review

* Apply suggestions from code review

* Update pytorch_lightning/plugins/sharded_plugin.py

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>

* Change name

* Pass trainer to plugins that may require it

* Fix sharded plugin

* Added test to ensure string sharded works

* Removed trainer typing as this breaks pep8

* Fixed doc issues

* Fixed tests

Co-authored-by: chaton <thomas@grid.ai>
Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
2020-12-01 20:30:49 +00:00
chaton 1d3724a878
[HotFix] Logging - One epoch delay on training epoch metrics. (#4913)
* add test

* resolve logging bug

* update

* resolve pep8

* resolve tests

Co-authored-by: Roger Shieh <sh.rog@protonmail.ch>
2020-12-01 09:26:52 +00:00
chaton c2e6e68c7e
optimizer clean up (#4658)
* add LightningOptimizer

* typo

* add mock closure

* typo

* remove logic in optimizer_step

* update

* update

* update

* desactivate LightningOptimizer for hovorod

* resolve flake

* typo

* check optimizer name

* change name

* added backward to LightningOptimizer

* remove use_lightning_optimizer

* move update

* simplify init

* resolve comments

* resolve bug

* update

* update

* resolve bugs

* resolve flake8

* set state

* work manual_optimizer_step

* add doc

* add enable_pl_optimizer

* make optimizer_step

* add make_optimizer_step

* add examples

* resolve test

* add test_optimizer_return_options_enable_pl_optimizer

* add enable_pl_optimizer=True

* update

* update tests

* resolve bugs

* update

* set Trainer to False

* update

* resolve bugs

* update

* remove from doc

* resolve bug

* typo

* update

* set to True

* simplification

* typo

* resolve horovod

* unwrap horovod

* remove Optimizer

* resolve horovod

* move logic to amp_backend

* doesn't seem to be pickable

* update

* add again

* resolve some bugs

* cleanup

* resolve bug with AMP

* change __repr__

* round at -12

* udpate

* update

* update

* remove from horovod

* typo

* add convert_to_lightning_optimizers in each accelerators

* typo

* forgot

* forgot a convert_to_lightning_optimizers

* update

* update

* update

* increase coverage

* update

* resolve flake8

* update

* remove useless code

* resolve comments + add support for LightningOptimizer base class

* resolve flake

* check optimizer get wrapped back

* resolve DDPSharded

* reduce code

* lightningoptimizer

* Update pytorch_lightning/core/optimizer.py

Co-authored-by: Carlos Mocholí <carlossmocholi@gmail.com>

* Update pytorch_lightning/core/lightning.py

* remove reference to step function

* Apply suggestions from code review

* update on comments

* resolve

* Update CHANGELOG.md

* add back training_step in apex and native_amp

* rename optimizer_step

Co-authored-by: Carlos Mocholí <carlossmocholi@gmail.com>
Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
Co-authored-by: William Falcon <waf2107@columbia.edu>
Co-authored-by: Sean Naren <sean.narenthiran@gmail.com>
2020-12-01 00:09:46 +00:00
Jirka Borovec 405645daf8
formatting (#4898)
Co-authored-by: Sean Naren <sean.narenthiran@gmail.com>
2020-11-30 00:57:28 -05:00
William Falcon f677efe61e
Merge pull request #4880 from PyTorchLightning/better_simple_profiler
Logging
2020-11-27 15:33:58 -05:00
SeanNaren 1719b2dca4 Skip a few tests to reduce drone CI wait times 2020-11-27 20:21:50 +00:00
tchaton c6502adba1 resolve test 2020-11-27 19:34:45 +00:00
Sean Naren 06a856e055
Merge branch 'master' into feature/plug 2020-11-27 18:48:58 +00:00
chaton 6ba77c2611
Merge branch 'master' into better_simple_profiler 2020-11-27 18:43:01 +00:00
tchaton 1f1a20c45f reduce parity to 0.22 2020-11-27 18:36:18 +00:00
tchaton cef83dbbf8 optimize logging 2020-11-27 18:21:23 +00:00
Jirka Borovec 042152cd61
ref: fix & simplify test callback (#4009)
* simplify test callback

* update

* use mock

* flake8
2020-11-27 19:12:56 +01:00
tchaton e17300f97d add more profiler 2020-11-27 18:00:48 +00:00
tchaton 3a8fa6bf11 update 2020-11-27 17:48:51 +00:00
tchaton 290d74b40e resolve test 2020-11-27 16:47:13 +00:00
SeanNaren 1704773712 Address code review 2020-11-27 14:50:12 +00:00
Sean Naren 00bd0d2e72
Merge branch 'master' into feature/plug 2020-11-27 13:18:50 +00:00
chaton dee968f20b
[bug] Replace_sampler attach previous multiprocessing_context (#4742)
* resolve bug

* add test docstring

* Update tests/trainer/test_dataloaders.py

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>

* update test

Co-authored-by: Sean Naren <sean.narenthiran@gmail.com>
Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
2020-11-27 12:57:25 +00:00
SeanNaren bde2a12990 Fix var name 2020-11-27 10:37:49 +00:00
SeanNaren 04bb0abe36 Merge branch 'master' into feature/plug
# Conflicts:
#	pytorch_lightning/utilities/__init__.py
#	requirements/extra.txt
2020-11-27 10:00:05 +00:00
Jirka Borovec 442d57f1e9
simplify imports xla / TPU (#4872)
* xla

* tpu

* fix

* fix

* flake8
2020-11-27 00:37:48 +01:00
SeanNaren 737447fc6e Merge branch 'master' into feature/plug
# Conflicts:
#	pytorch_lightning/trainer/connectors/precision_connector.py
#	pytorch_lightning/utilities/__init__.py
2020-11-26 23:02:36 +00:00
Jirka Borovec 11e73ceaa6
fix import and typo in AMP (#4871)
* fix import and typo

* docs

* apex

* fix

* typo
2020-11-26 23:45:52 +01:00
SeanNaren fc9b2bf015 Fix logic and add test for apex check, rename file, add DDP launcher tests 2020-11-26 22:45:21 +00:00
Sean Naren 74afcf71b7
Merge branch 'master' into feature/plug 2020-11-26 21:54:55 +00:00
Justus Schock 742ddd81b3
make device property always return a device with index (#4851)
* make device property always return a device with index

* pep8

* Update test_dtype_device_mixin.py

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
2020-11-27 00:49:51 +05:30
SeanNaren ab655e5118 Removed old eval logic, added eval tests 2020-11-26 18:49:06 +00:00
SeanNaren 47c121ef1a Addressed code review points 2020-11-26 16:44:45 +00:00
Sean Naren ff34a8fed9
Update tests/plugins/test_sharded_plugin.py
Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
2020-11-26 16:37:22 +00:00