Commit Graph

452 Commits

Author SHA1 Message Date
yuntai 50fd4879a9
Update metrics to use Enum (#5689)
- Add DataType, AverageMethod and MDMCAverageMethod
2021-02-01 13:50:10 -05:00
Adrian Wälchli 8943d8bca0
add missing logic to new plugins and accelerator (#5734)
* add missing logic

* missed imports

* import fixes

* isort

* mv f

* changelog

* format

* move helper to parallel plugin

* d
2021-02-01 13:23:53 -05:00
Adrian Wälchli 344f3a984a
Refactor access to trainer attributes in LightningModule (#5730)
* rank access

* tests for property

* weekref

* logger

* changelog

* torchscript

* changelog

* chlog

* .

* amp

* yapf

* flake8

Co-authored-by: Jirka Borovec <jirka.borovec@seznam.cz>
2021-02-01 14:28:17 +00:00
Justus Schock b3ebc18bcb
Hardware specific parts of Accelerator Refactoring (#5719)
* add basic accelerator class.
Co-Authored with @awaelchi

* pep8

Co-authored-by: @awaelchi

* add cpu accelerator

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

* add gpu accelerator

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

* add tpu accelerator

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

* add accelerator connector

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

* add single device training

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

* add single tpu

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

* add tpu spawn

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

* make on_colab_kaggle utility func

* add basic accelerator class.
Co-Authored with @awaelchi

* pep8

Co-authored-by: @awaelchi

* add cpu accelerator

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

* add gpu accelerator

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

* add tpu accelerator

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

* add accelerator connector

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

* add single device training

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

* add single tpu

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

* add tpu spawn

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

* make on_colab_kaggle utility func

* fixes

* move

* yapf

* .

* .

* .

* flake8

* sync accelerator connector changes from dev1.2

* changelog

* fix tpu handling

* tpu

* aval

* yapf

* Update pytorch_lightning/plugins/training_type/tpu_spawn.py

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

* Update pytorch_lightning/accelerators/accelerator_connector.py

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

* Update pytorch_lightning/plugins/training_type/tpu_spawn.py

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

* Update tpu_spawn.py

* Update pytorch_lightning/accelerators/accelerator_connector.py

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

* indentation

Co-authored-by: Adrian Wälchli <aedu.waelchli@gmail.com>
Co-authored-by: Jirka Borovec <jirka.borovec@seznam.cz>
Co-authored-by: chaton <thomas@grid.ai>
2021-02-01 08:34:59 -05:00
Adrian Wälchli 3bacac7734
accelerator refactor - add parallel plugins (#5714)
Co-authored-by: Justus Schock <12886177+justusschock@users.noreply.github.com>
2021-01-31 07:48:14 -05:00
Adrian Wälchli 692f77b8a7
Refactor LightningDataParallel (#5670)
* module

* fix model access

* scalar conversion

* refactor

* kwargs

* auto unsqueeze

* refactor code duplication

* clean up

* docs

* update dp docs

* changelog

* generalize test

* test

* rename

* warning cache

* isort

* unsqueezing test

* device

* device

* scalar test

* device

* device

* include coverage of overrides

* clear

* add deprecation test

* docs

* improve coverage

* increase coverage

* fix merge

* extend test

* rename base class

* mention the predict method in docs

* combine iteration over collection

* remove override

* move

* line

* Apply suggestions from code review

* fix running stage

* f401

* fix cyclic import

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
2021-01-31 06:08:16 -05:00
Justus Schock 5d239ccd70
Base classes for accelerator refactoring (#5715)
* add basic accelerator class.
Co-Authored with @awaelchi

* Add base plugin class.
Co-authored with @awaelchi

* add basic trainign type plugin.
Co-Authored with @awaelchi

* add basic precision plugin.
Co-Authored with @awaelchi

* Add missing inits.
Co-authored with @awaelchi

* pep8

Co-authored-by: @awaelchi

* ignore  flake8

* coverage omit

* imports in init

* lost

* imports

* flake8

* .

* .

* chlog

* Update pytorch_lightning/plugins/training_type/training_type_plugin.py

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

* Update pytorch_lightning/plugins/training_type/training_type_plugin.py

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

* Update pytorch_lightning/plugins/training_type/training_type_plugin.py

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

* Update pytorch_lightning/plugins/training_type/training_type_plugin.py

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

* Update pytorch_lightning/plugins/training_type/training_type_plugin.py

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

* Update pytorch_lightning/plugins/training_type/training_type_plugin.py

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

* Update pytorch_lightning/plugins/training_type/training_type_plugin.py

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

Co-authored-by: Adrian Wälchli <aedu.waelchli@gmail.com>
Co-authored-by: Jirka Borovec <jirka.borovec@seznam.cz>
Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
2021-01-30 14:55:28 -05:00
Jirka Borovec fca927288c
Refactor: drop LoggerStages (#5673)
* drop LoggerStages

* chlog
2021-01-30 15:59:18 +01:00
chaton 3da28fd634
[feat] 1/2 Add trainer.predict (#5579)
* start adding predict

* add predict

* resolve test

* add predict

* remove limit_predict

* update

* add test for predict

* typo

* update on comments

* remove predict_step

* update ddp_shareded

* check ddp_sharded

* resolve on comments

* resolve isort

* update dp

* add test dp 1 gpu

* made default forward

* resolve path

* resolve bug

* update on comments

* resolve doc

* resolve bug

* update

* resolve bug

* update on comments

* resolve pep8

* update test doc

* update on comments

* solve special tests

* resolve bug

* resolve flake8

* Update pytorch_lightning/callbacks/progress.py

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

* Update pytorch_lightning/trainer/trainer.py

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

* add predict to LightningModule

* missing predict

* typo

* rename is_prediction to _predicting

* add

* update

* update

* update doc

Co-authored-by: Carlos Mocholí <carlossmocholi@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-01-27 11:38:14 -05:00
Nicki Skafte 221c4a0ba2
[Metrics] AUC/AUROC class interface (#5479)
* base files

* auc done

* init files

* auc class interface

* fixing auc

* more fixes

* working auroc

* update auc

* add docs

* remove leftovers from merge

* suggestions

* fix f-string

* Apply suggestions from code review

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

* add deprecated tests

* make logic clearer

* Update pytorch_lightning/metrics/classification/auroc.py

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

* fix

* fix

* fix docs

* fix isort

* fix deprecated test

* fix tests

* fix tests

* fix isort

* Apply suggestions from code review

* add enum

* deprecate old impl

* update from suggestions

* chlog

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Jirka Borovec <jirka.borovec@seznam.cz>
2021-01-27 08:16:54 -05:00
chaton d0aaf983b9
[Feat] Adding PruningCallback (#5618)
* wip

* add pruning callback

* add condition for duplicated weights

* update on comments

* update on comments

* update on comments

* add more tests

* resolve flake8

* resolve on comments

* update changelog

* update on comments

* update on comments

* change order

* remove ddp_spawn skip

* update

* typo

* Update pytorch_lightning/callbacks/pruning.py

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

* Update pytorch_lightning/callbacks/pruning.py

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

* update on comments

* forgot platform

* update on comments

* remove     @rank_zero_only

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-01-27 01:00:42 -05:00
Jirka Borovec 7e2e874d95
Refactor: legacy accelerators and plugins (#5645)
* tests: legacy

* legacy: accel

* legacy: plug

* fix imports

* mypy

* flake8
2021-01-26 20:04:36 -05:00
Carlos Mocholí 9d165f6f56
Start version suffixes at 1 (#5008)
* Rename original filepath to v0

* Clean-up

* Suggestions from code review

* Revert renaming. Start version number at 1

* Add ModelCheckpoint.STARTING_VERSION

* Apply suggestions from code review

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

* Add note about class attributes

* Update CHANGELOG

* Fix doc

Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>
2021-01-26 17:29:34 -05:00
Justus Schock 8c55a08e85
Compositional metrics (#5464)
* implement compositional metrics

* implement composition functions for metrics

* test compositions

* docs

* pytest

* pep8

* fix argument resolution

* return all kwargs if filtering not possible

* fix typo

* implement hashing

* Update pytorch_lightning/metrics/compositional.py

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

* Update docs/source/metrics.rst

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

* add representation

* Apply suggestions from code review

* Update docs/source/metrics.rst

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

* chlog

* flake8

Co-authored-by: Nicki Skafte <skaftenicki@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Jirka Borovec <jirka.borovec@seznam.cz>
2021-01-26 11:56:12 -05:00
Jirka Borovec 4e7e1dffe8 chlog 2021-01-26 14:57:34 +01:00
Sean Naren 942488b279 update CHANGELOG.md (#5482)
(cherry picked from commit 652df1886a)
2021-01-26 14:29:48 +01:00
chaton 0435e23a64 deprecate enable_pl_optimizer as it is not restored properly (#5244)
* update

* clean test

* still in progress

* udpdate test

* update

* update

* resolve flake

* add test for zero_grad

* update

* works without accumulated_grad

* update

* update

* resolve amp

* revert back to True

* update

* clean tests

* cleaned out

* typo

* update test

* git repare bug

* remove print

* udpate

* Fix formatting/optimizer imports

* Refactor the test for cleanliness

* Add vanilla model to the test, better var names

* Fixed var names, let's clean up these mock tests

* repare test

* update test

* resolve flake8

* add manual_optimization

* update tests

* resolve flake8

* add random accumulate_grad_batches

* improve test

* Update tests/trainer/optimization/test_parity_automatic_optimization.py

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

* Update tests/trainer/optimization/test_parity_automatic_optimization.py

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

* update

* clean tests

* correct bug

* Apply suggestions from code review

* format

* adress comments

* update on comments

* wip

* typo

* depreceate enable_pl_optimizer

* resolve latest bugs

* update

* resolve merge

* add comment

* Update pytorch_lightning/core/lightning.py

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

* Update tests/deprecated_api/test_remove_1-3.py

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

* Update pytorch_lightning/trainer/connectors/optimizer_connector.py

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

* Update pytorch_lightning/trainer/trainer.py

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

* Update pytorch_lightning/trainer/trainer.py

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

* Update tests/trainer/optimization/test_parity_automatic_optimization.py

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

* update on comments

* update restore

* add a property

* remove setstate as not needed anymore

* update test

* provide optimizer to on_before_zero_grad

* update on comments

* update on comments

* Update pytorch_lightning/trainer/trainer.py

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

* Update tests/trainer/optimization/test_parity_automatic_optimization.py

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

* Update tests/trainer/optimization/test_parity_automatic_optimization.py

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

* Update tests/trainer/optimization/test_parity_automatic_optimization.py

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

* mofidy import

* update changelog

* resolve flake8

* update

* update

* clean doc

Co-authored-by: SeanNaren <sean@grid.ai>
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: Jirka Borovec <jirka.borovec@seznam.cz>
Co-authored-by: Adrian Wälchli <aedu.waelchli@gmail.com>
Co-authored-by: Sean Naren <sean.narenthiran@gmail.com>

(cherry picked from commit f2e99d617f)
2021-01-26 14:29:46 +01:00
chaton f2f4a49271 [bug-fix] Call transfer_batch_to_device in DDPlugin (#5195)
* hacking out

* update

* remove useless on_before_forward

* update

* remove overriden

* iremove os

* use on_before_forward

* resolve flake8

* add test

* update

* add single_process_per_device

* resolve flake8

* update

* resolve

* update

* update

* update

* add comment

* resolve bug with sharded

* update

* remove property

* update

* resolve test

* resolve bug

* update on comments

* update doc

* Update pytorch_lightning/core/hooks.py

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

* update on comments

* Update pytorch_lightning/plugins/ddp_plugin.py

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

* Update pytorch_lightning/plugins/ddp_plugin.py

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

* resolve pep8

* add device_ids to pipe

* update on comments

* update

* resolve

* update

* update

* update

Co-authored-by: Ubuntu <ubuntu@ip-172-31-62-109.ec2.internal>
Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>
Co-authored-by: Sean Naren <sean.narenthiran@gmail.com>

(cherry picked from commit d510707bc9)
2021-01-26 14:28:45 +01:00
Carlos Mocholí 26e7e58fa8 Add 1.1.4 section to CHANGELOG (#5378)
(cherry picked from commit 019e4ff8cd)
2021-01-26 14:27:56 +01:00
chaton 5f3372871a
[feat] Add PyTorch Profiler. (#5560)
* add profiler

* add profiler

* update

* resolve flake8

* update doc

* update changelog

* clean doc

* delete prof file

* merge pr codebase

* update

* update doc

* update doc

* update doc

* update on comments

* update docstring

* update docstring

* try

* update test

* Update pytorch_lightning/profiler/__init__.py

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

* Update pytorch_lightning/profiler/__init__.py

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

* update on comments

* remove old code

* add support for ddp

* resolve flake8

* Update pytorch_lightning/profiler/__init__.py

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

* resolve tests

* resolve flake8

Co-authored-by: Jirka Borovec <jirka.borovec@seznam.cz>
Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
Co-authored-by: Sean Naren <sean.narenthiran@gmail.com>
2021-01-26 06:48:54 -05:00
Jirka Borovec 304f9c5bca
Fix loading yaml (#5619)
* fix yaml

* chlog
2021-01-25 10:17:55 -05:00
NeuralLink db784225eb
summarize total size of model params in bytes (#5590)
* simplified model size calc

* fix spaces

* fix newlines

* minor refactor

* Update pytorch_lightning/core/memory.py

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

* make model size property

* fix doctest

* Update pytorch_lightning/core/memory.py

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

* remove explicit doctest from file

* better docs

* model precalculate size 1.0 mbs

* better comment

* Update tests/core/test_memory.py

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

* Update tests/core/test_memory.py

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

* merge _model_size into model_size property itself

* minor comment fix

* add feature to changelog

* added precision test

* isort

* minor def name typo

* remove monkeypath set env as boringmodel wont need any torch hub cache

Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>
Co-authored-by: Adrian Wälchli <aedu.waelchli@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-01-25 09:35:29 +01: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
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 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 7e4d6cbe48
set minimal req. PT 1.4 (#5418)
* set minimal req. PT 1.4

* chlog
2021-01-12 19:15:35 -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
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
Jirka Borovec 8a40e80226
fix num_workers for Windows example (#5375)
* fix num_workers for Windows example

* chlog

* Apply suggestions from code review

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

* warn

Co-authored-by: Carlos Mocholí <carlossmocholi@gmail.com>
2021-01-06 19:28:30 -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
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 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 4349de8316 update chlog for future 1.1.3rc (#5242)
* update chlog for future 1.1.3rc

* prune

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

(cherry picked from commit 27f3f973d6)
2021-01-06 11:37:39 +01:00
Jirka Borovec 74d0652164 flake8 ++ 2021-01-05 09:58:37 +01:00
Jirka Borovec 365b9b561c update for v1.1.2 (#5240) 2021-01-05 09:58:37 +01:00
Sean Naren cb45ab0000 Prelease 1.1.2rc (#5171)
* update CHANGELOG.md, increment for RC

* Add missing changelog update

* Added a few more

* Move to added

* Address code review

* Missing space

* Remove unreleased

* Remove lines

* Update CHANGELOG.md

Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>
2021-01-05 09:58:37 +01:00