From 8acca237b7061f10ac8938f88488683281451ff2 Mon Sep 17 00:00:00 2001 From: "Michael Pilosov, PhD" <40366263+mathematicalmichael@users.noreply.github.com> Date: Sat, 27 Jan 2024 15:03:44 -0700 Subject: [PATCH 01/12] Shorten docstring (for CLI compat) CLI only shows first line, this helps the summary fit inside --- src/lightning/pytorch/callbacks/batch_size_finder.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lightning/pytorch/callbacks/batch_size_finder.py b/src/lightning/pytorch/callbacks/batch_size_finder.py index c95803c035db0..2aebbd9e4e341 100644 --- a/src/lightning/pytorch/callbacks/batch_size_finder.py +++ b/src/lightning/pytorch/callbacks/batch_size_finder.py @@ -31,8 +31,8 @@ class BatchSizeFinder(Callback): - """The ``BatchSizeFinder`` callback tries to find the largest batch size for a given model that does not give an - out of memory (OOM) error. All you need to do is add it as a callback inside Trainer and call + """Attempts to find the largest batch size for a given model that avoids an out of memory (OOM) error. + All you need to do is add it as a callback inside Trainer and call ``trainer.{fit,validate,test,predict}``. Internally it calls the respective step function ``steps_per_trial`` times for each batch size until one of the batch sizes generates an OOM error. From 7419ce33e11411424695802b1feeff14885dddb7 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 27 Jan 2024 22:07:48 +0000 Subject: [PATCH 02/12] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/lightning/pytorch/callbacks/batch_size_finder.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lightning/pytorch/callbacks/batch_size_finder.py b/src/lightning/pytorch/callbacks/batch_size_finder.py index 2aebbd9e4e341..24b0a56ae8968 100644 --- a/src/lightning/pytorch/callbacks/batch_size_finder.py +++ b/src/lightning/pytorch/callbacks/batch_size_finder.py @@ -31,10 +31,10 @@ class BatchSizeFinder(Callback): - """Attempts to find the largest batch size for a given model that avoids an out of memory (OOM) error. - All you need to do is add it as a callback inside Trainer and call - ``trainer.{fit,validate,test,predict}``. Internally it calls the respective step function ``steps_per_trial`` times - for each batch size until one of the batch sizes generates an OOM error. + """Attempts to find the largest batch size for a given model that avoids an out of memory (OOM) error. All you need + to do is add it as a callback inside Trainer and call ``trainer.{fit,validate,test,predict}``. Internally it calls + the respective step function ``steps_per_trial`` times for each batch size until one of the batch sizes generates + an OOM error. .. warning:: This is an :ref:`experimental ` feature. From 8960b6aafee29efb5fcf3c910e486d99cb0322a1 Mon Sep 17 00:00:00 2001 From: "Michael Pilosov, PhD" <40366263+mathematicalmichael@users.noreply.github.com> Date: Sat, 27 Jan 2024 16:22:39 -0700 Subject: [PATCH 03/12] syntax for linting spacing --- src/lightning/pytorch/callbacks/batch_size_finder.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lightning/pytorch/callbacks/batch_size_finder.py b/src/lightning/pytorch/callbacks/batch_size_finder.py index 24b0a56ae8968..d8eea5c90c9b2 100644 --- a/src/lightning/pytorch/callbacks/batch_size_finder.py +++ b/src/lightning/pytorch/callbacks/batch_size_finder.py @@ -31,10 +31,10 @@ class BatchSizeFinder(Callback): - """Attempts to find the largest batch size for a given model that avoids an out of memory (OOM) error. All you need - to do is add it as a callback inside Trainer and call ``trainer.{fit,validate,test,predict}``. Internally it calls - the respective step function ``steps_per_trial`` times for each batch size until one of the batch sizes generates - an OOM error. + """Attemps to find the largest batch size before an out of memory (OOM) error is thrown for a given model. + All you need to do is add it as a callback inside Trainer and call ``trainer.{fit,validate,test,predict}``. + Internally it calls the respective step function ``steps_per_trial`` times for each batch size until one of + the batch sizes generates an OOM error. .. warning:: This is an :ref:`experimental ` feature. From a59444d17e60f33ae3bca7e8e936a6618d3afa3c Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 27 Jan 2024 23:24:00 +0000 Subject: [PATCH 04/12] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/lightning/pytorch/callbacks/batch_size_finder.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lightning/pytorch/callbacks/batch_size_finder.py b/src/lightning/pytorch/callbacks/batch_size_finder.py index d8eea5c90c9b2..ff2a274899756 100644 --- a/src/lightning/pytorch/callbacks/batch_size_finder.py +++ b/src/lightning/pytorch/callbacks/batch_size_finder.py @@ -31,10 +31,10 @@ class BatchSizeFinder(Callback): - """Attemps to find the largest batch size before an out of memory (OOM) error is thrown for a given model. - All you need to do is add it as a callback inside Trainer and call ``trainer.{fit,validate,test,predict}``. - Internally it calls the respective step function ``steps_per_trial`` times for each batch size until one of - the batch sizes generates an OOM error. + """Attemps to find the largest batch size before an out of memory (OOM) error is thrown for a given model. All you + need to do is add it as a callback inside Trainer and call ``trainer.{fit,validate,test,predict}``. Internally it + calls the respective step function ``steps_per_trial`` times for each batch size until one of the batch sizes + generates an OOM error. .. warning:: This is an :ref:`experimental ` feature. From f19dcf41730f7e27887ee4dc82e785074156da46 Mon Sep 17 00:00:00 2001 From: "Michael Pilosov, PhD" <40366263+mathematicalmichael@users.noreply.github.com> Date: Sat, 27 Jan 2024 16:28:01 -0700 Subject: [PATCH 05/12] Update batch_size_finder.py spacing (again) --- src/lightning/pytorch/callbacks/batch_size_finder.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lightning/pytorch/callbacks/batch_size_finder.py b/src/lightning/pytorch/callbacks/batch_size_finder.py index ff2a274899756..7d0469b9e38b4 100644 --- a/src/lightning/pytorch/callbacks/batch_size_finder.py +++ b/src/lightning/pytorch/callbacks/batch_size_finder.py @@ -31,8 +31,8 @@ class BatchSizeFinder(Callback): - """Attemps to find the largest batch size before an out of memory (OOM) error is thrown for a given model. All you - need to do is add it as a callback inside Trainer and call ``trainer.{fit,validate,test,predict}``. Internally it + """This callback finds the largest batch size supported by a given model before an out of memory (OOM) error is thrown. + All you need to do is add it as a callback inside Trainer and call ``trainer.{fit,validate,test,predict}``. Internally it calls the respective step function ``steps_per_trial`` times for each batch size until one of the batch sizes generates an OOM error. From 592305f98a7e7bdee7631263d62ec7751e345860 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 27 Jan 2024 23:29:21 +0000 Subject: [PATCH 06/12] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/lightning/pytorch/callbacks/batch_size_finder.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lightning/pytorch/callbacks/batch_size_finder.py b/src/lightning/pytorch/callbacks/batch_size_finder.py index 7d0469b9e38b4..1353f6c4856bb 100644 --- a/src/lightning/pytorch/callbacks/batch_size_finder.py +++ b/src/lightning/pytorch/callbacks/batch_size_finder.py @@ -31,10 +31,10 @@ class BatchSizeFinder(Callback): - """This callback finds the largest batch size supported by a given model before an out of memory (OOM) error is thrown. - All you need to do is add it as a callback inside Trainer and call ``trainer.{fit,validate,test,predict}``. Internally it - calls the respective step function ``steps_per_trial`` times for each batch size until one of the batch sizes - generates an OOM error. + """This callback finds the largest batch size supported by a given model before an out of memory (OOM) error is + thrown. All you need to do is add it as a callback inside Trainer and call ``trainer.{fit,validate,test,predict}``. + Internally it calls the respective step function ``steps_per_trial`` times for each batch size until one of the + batch sizes generates an OOM error. .. warning:: This is an :ref:`experimental ` feature. From b81365ca8cad2acf37ab3f71a2635345590647ef Mon Sep 17 00:00:00 2001 From: "Michael Pilosov, PhD" <40366263+mathematicalmichael@users.noreply.github.com> Date: Sat, 27 Jan 2024 17:11:46 -0700 Subject: [PATCH 07/12] Update batch_size_finder.py --- src/lightning/pytorch/callbacks/batch_size_finder.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lightning/pytorch/callbacks/batch_size_finder.py b/src/lightning/pytorch/callbacks/batch_size_finder.py index 1353f6c4856bb..2f7fdf273b9ab 100644 --- a/src/lightning/pytorch/callbacks/batch_size_finder.py +++ b/src/lightning/pytorch/callbacks/batch_size_finder.py @@ -31,8 +31,8 @@ class BatchSizeFinder(Callback): - """This callback finds the largest batch size supported by a given model before an out of memory (OOM) error is - thrown. All you need to do is add it as a callback inside Trainer and call ``trainer.{fit,validate,test,predict}``. + """Maximizes the choice of batch size supported by a model before encountering an out of memory (OOM) error. + All you need to do is add it as a callback inside Trainer and call ``trainer.{fit,validate,test,predict}``. Internally it calls the respective step function ``steps_per_trial`` times for each batch size until one of the batch sizes generates an OOM error. From 822df856e27f9131ce77cff4718b2cacbb05530f Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 28 Jan 2024 00:13:08 +0000 Subject: [PATCH 08/12] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/lightning/pytorch/callbacks/batch_size_finder.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lightning/pytorch/callbacks/batch_size_finder.py b/src/lightning/pytorch/callbacks/batch_size_finder.py index 2f7fdf273b9ab..44c5710f54245 100644 --- a/src/lightning/pytorch/callbacks/batch_size_finder.py +++ b/src/lightning/pytorch/callbacks/batch_size_finder.py @@ -31,10 +31,10 @@ class BatchSizeFinder(Callback): - """Maximizes the choice of batch size supported by a model before encountering an out of memory (OOM) error. - All you need to do is add it as a callback inside Trainer and call ``trainer.{fit,validate,test,predict}``. - Internally it calls the respective step function ``steps_per_trial`` times for each batch size until one of the - batch sizes generates an OOM error. + """Maximizes the choice of batch size supported by a model before encountering an out of memory (OOM) error. All + you need to do is add it as a callback inside Trainer and call ``trainer.{fit,validate,test,predict}``. Internally + it calls the respective step function ``steps_per_trial`` times for each batch size until one of the batch sizes + generates an OOM error. .. warning:: This is an :ref:`experimental ` feature. From 31916b2e1bca2929768334d9a2a701f678034cbc Mon Sep 17 00:00:00 2001 From: "Michael Pilosov, PhD" <40366263+mathematicalmichael@users.noreply.github.com> Date: Sat, 27 Jan 2024 19:11:56 -0700 Subject: [PATCH 09/12] Update batch_size_finder.py --- src/lightning/pytorch/callbacks/batch_size_finder.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/lightning/pytorch/callbacks/batch_size_finder.py b/src/lightning/pytorch/callbacks/batch_size_finder.py index 44c5710f54245..6e37e5129a183 100644 --- a/src/lightning/pytorch/callbacks/batch_size_finder.py +++ b/src/lightning/pytorch/callbacks/batch_size_finder.py @@ -31,9 +31,10 @@ class BatchSizeFinder(Callback): - """Maximizes the choice of batch size supported by a model before encountering an out of memory (OOM) error. All - you need to do is add it as a callback inside Trainer and call ``trainer.{fit,validate,test,predict}``. Internally - it calls the respective step function ``steps_per_trial`` times for each batch size until one of the batch sizes + """Finds the largest batch size supported by a given model before encountering an out of memory (OOM) error. + + All you need to do is add it as a callback inside Trainer and call ``trainer.{fit,validate,test,predict}``. + Internally, it calls the respective step function ``steps_per_trial`` times for each batch size until one of the batch sizes generates an OOM error. .. warning:: This is an :ref:`experimental ` feature. From e6615cc6e8e69a2637afc7f89ea8ff2b4c0886c7 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 28 Jan 2024 02:13:36 +0000 Subject: [PATCH 10/12] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/lightning/pytorch/callbacks/batch_size_finder.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lightning/pytorch/callbacks/batch_size_finder.py b/src/lightning/pytorch/callbacks/batch_size_finder.py index 6e37e5129a183..ff3461ea39eec 100644 --- a/src/lightning/pytorch/callbacks/batch_size_finder.py +++ b/src/lightning/pytorch/callbacks/batch_size_finder.py @@ -33,7 +33,7 @@ class BatchSizeFinder(Callback): """Finds the largest batch size supported by a given model before encountering an out of memory (OOM) error. - All you need to do is add it as a callback inside Trainer and call ``trainer.{fit,validate,test,predict}``. + All you need to do is add it as a callback inside Trainer and call ``trainer.{fit,validate,test,predict}``. Internally, it calls the respective step function ``steps_per_trial`` times for each batch size until one of the batch sizes generates an OOM error. From bc3c6c8ba1f26fc3da33119738627bb2362df75c Mon Sep 17 00:00:00 2001 From: "Michael Pilosov, PhD" <40366263+mathematicalmichael@users.noreply.github.com> Date: Sun, 28 Jan 2024 01:19:51 -0700 Subject: [PATCH 11/12] final linting fix linter was auto-fixing lines before and all of the sudden chose not to. --- src/lightning/pytorch/callbacks/batch_size_finder.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lightning/pytorch/callbacks/batch_size_finder.py b/src/lightning/pytorch/callbacks/batch_size_finder.py index ff3461ea39eec..226bbde852fd2 100644 --- a/src/lightning/pytorch/callbacks/batch_size_finder.py +++ b/src/lightning/pytorch/callbacks/batch_size_finder.py @@ -34,8 +34,8 @@ class BatchSizeFinder(Callback): """Finds the largest batch size supported by a given model before encountering an out of memory (OOM) error. All you need to do is add it as a callback inside Trainer and call ``trainer.{fit,validate,test,predict}``. - Internally, it calls the respective step function ``steps_per_trial`` times for each batch size until one of the batch sizes - generates an OOM error. + Internally, it calls the respective step function ``steps_per_trial`` times for each batch size until one + of the batch sizes generates an OOM error. .. warning:: This is an :ref:`experimental ` feature. From a101fd8c93c9acb53373394aa1e30db2804f2d08 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 28 Jan 2024 08:21:12 +0000 Subject: [PATCH 12/12] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/lightning/pytorch/callbacks/batch_size_finder.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lightning/pytorch/callbacks/batch_size_finder.py b/src/lightning/pytorch/callbacks/batch_size_finder.py index 226bbde852fd2..e348f4946e51b 100644 --- a/src/lightning/pytorch/callbacks/batch_size_finder.py +++ b/src/lightning/pytorch/callbacks/batch_size_finder.py @@ -34,7 +34,7 @@ class BatchSizeFinder(Callback): """Finds the largest batch size supported by a given model before encountering an out of memory (OOM) error. All you need to do is add it as a callback inside Trainer and call ``trainer.{fit,validate,test,predict}``. - Internally, it calls the respective step function ``steps_per_trial`` times for each batch size until one + Internally, it calls the respective step function ``steps_per_trial`` times for each batch size until one of the batch sizes generates an OOM error. .. warning:: This is an :ref:`experimental ` feature.