From f2c29fb76c8d070167f79e93feccc1cf77a4e0e9 Mon Sep 17 00:00:00 2001 From: Ainesh Nanda Date: Thu, 18 Jan 2024 12:53:24 +0530 Subject: [PATCH 01/10] imported novograd and WCS from monai.optimizers --- GANDLF/optimizers/wrap_monai.py | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 GANDLF/optimizers/wrap_monai.py diff --git a/GANDLF/optimizers/wrap_monai.py b/GANDLF/optimizers/wrap_monai.py new file mode 100644 index 000000000..ee3faf37c --- /dev/null +++ b/GANDLF/optimizers/wrap_monai.py @@ -0,0 +1,6 @@ +from monai.optimizers import ( + novograd +) + +def novograd(parameters): + print("currently here") \ No newline at end of file From 4611ea5bf3e3985f85f04e4c62a8348e11cf8232 Mon Sep 17 00:00:00 2001 From: Ainesh Nanda Date: Fri, 19 Jan 2024 11:18:58 +0530 Subject: [PATCH 02/10] test push to check working of git push --- GANDLF/optimizers/wrap_monai.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/GANDLF/optimizers/wrap_monai.py b/GANDLF/optimizers/wrap_monai.py index ee3faf37c..b775d5cda 100644 --- a/GANDLF/optimizers/wrap_monai.py +++ b/GANDLF/optimizers/wrap_monai.py @@ -3,4 +3,5 @@ ) def novograd(parameters): - print("currently here") \ No newline at end of file + print("currently here") +#test push to check git push From 741365a33197ef52f4966208784a08481b9c38fe Mon Sep 17 00:00:00 2001 From: Ainesh Nanda Date: Mon, 22 Jan 2024 21:37:37 +0530 Subject: [PATCH 03/10] wrote function for Novograd optimizer --- GANDLF/optimizers/wrap_monai.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/GANDLF/optimizers/wrap_monai.py b/GANDLF/optimizers/wrap_monai.py index b775d5cda..98ea19242 100644 --- a/GANDLF/optimizers/wrap_monai.py +++ b/GANDLF/optimizers/wrap_monai.py @@ -1,7 +1,19 @@ from monai.optimizers import ( - novograd + novograd, + WarmupCosineSchedule as WCS ) def novograd(parameters): - print("currently here") -#test push to check git push + return novograd( + parameters["model_parameters"], + lr=parameters.get("learning_rate"), + betas=parameters["optimizer"].get("betas", (0.9, 0.999)), + eps=parameters["optimizer"].get("eps", 1e-8), + weight_decay=parameters["optimizer"].get("weight_decay", 3e-05), + amsgrad=parameters["optimizer"].get("amsgrad", False), + ) + +def WCS(parameters): + return WCS( + + ) From bd7100e313737cae926c2e1d66f03a012e84d4c7 Mon Sep 17 00:00:00 2001 From: Ainesh Nanda Date: Thu, 25 Jan 2024 14:13:51 +0530 Subject: [PATCH 04/10] novograd successfully added as an optimizer --- GANDLF/optimizers/__init__.py | 3 +++ GANDLF/optimizers/wrap_monai.py | 12 +++--------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/GANDLF/optimizers/__init__.py b/GANDLF/optimizers/__init__.py index f4d0f4902..7fb5c3932 100644 --- a/GANDLF/optimizers/__init__.py +++ b/GANDLF/optimizers/__init__.py @@ -12,6 +12,8 @@ radam, ) +from .wrap_monai import novograd_wrapper + global_optimizer_dict = { "sgd": sgd, "asgd": asgd, @@ -24,6 +26,7 @@ "adagrad": adagrad, "rmsprop": rmsprop, "radam": radam, + "novograd": novograd_wrapper #value needs to be the functions } diff --git a/GANDLF/optimizers/wrap_monai.py b/GANDLF/optimizers/wrap_monai.py index 98ea19242..4e76fc95f 100644 --- a/GANDLF/optimizers/wrap_monai.py +++ b/GANDLF/optimizers/wrap_monai.py @@ -1,9 +1,8 @@ from monai.optimizers import ( - novograd, - WarmupCosineSchedule as WCS + novograd ) -def novograd(parameters): +def novograd_wrapper(parameters): return novograd( parameters["model_parameters"], lr=parameters.get("learning_rate"), @@ -11,9 +10,4 @@ def novograd(parameters): eps=parameters["optimizer"].get("eps", 1e-8), weight_decay=parameters["optimizer"].get("weight_decay", 3e-05), amsgrad=parameters["optimizer"].get("amsgrad", False), - ) - -def WCS(parameters): - return WCS( - - ) + ) \ No newline at end of file From 4d765dd9f02e4e4b5f624df30682230298dcf070 Mon Sep 17 00:00:00 2001 From: Ainesh Nanda Date: Fri, 26 Jan 2024 13:19:34 +0530 Subject: [PATCH 05/10] added "monai" to requirements --- setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.py b/setup.py index 4917c2432..17e70cc07 100644 --- a/setup.py +++ b/setup.py @@ -117,6 +117,7 @@ def run(self): "twine", "zarr", "keyring", + "monai", ] if __name__ == "__main__": From 1732f28b93ca7bfd7e21ce02381f52ce23614298 Mon Sep 17 00:00:00 2001 From: Ainesh Nanda Date: Fri, 26 Jan 2024 19:19:28 +0530 Subject: [PATCH 06/10] made some changes in function names --- GANDLF/optimizers/__init__.py | 2 +- GANDLF/optimizers/wrap_monai.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/GANDLF/optimizers/__init__.py b/GANDLF/optimizers/__init__.py index 7fb5c3932..b8bcf68ca 100644 --- a/GANDLF/optimizers/__init__.py +++ b/GANDLF/optimizers/__init__.py @@ -26,7 +26,7 @@ "adagrad": adagrad, "rmsprop": rmsprop, "radam": radam, - "novograd": novograd_wrapper #value needs to be the functions + "Novograd": novograd_wrapper #value needs to be the functions } diff --git a/GANDLF/optimizers/wrap_monai.py b/GANDLF/optimizers/wrap_monai.py index 4e76fc95f..a5f0a9120 100644 --- a/GANDLF/optimizers/wrap_monai.py +++ b/GANDLF/optimizers/wrap_monai.py @@ -1,9 +1,9 @@ from monai.optimizers import ( - novograd + Novograd ) def novograd_wrapper(parameters): - return novograd( + return Novograd( parameters["model_parameters"], lr=parameters.get("learning_rate"), betas=parameters["optimizer"].get("betas", (0.9, 0.999)), From 45000deb59e8d570dbb4d91bfac8f5914afc7894 Mon Sep 17 00:00:00 2001 From: Ainesh Nanda Date: Fri, 26 Jan 2024 19:42:18 +0530 Subject: [PATCH 07/10] removed unwanted comments --- GANDLF/optimizers/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GANDLF/optimizers/__init__.py b/GANDLF/optimizers/__init__.py index b8bcf68ca..8b5daf6d2 100644 --- a/GANDLF/optimizers/__init__.py +++ b/GANDLF/optimizers/__init__.py @@ -26,7 +26,7 @@ "adagrad": adagrad, "rmsprop": rmsprop, "radam": radam, - "Novograd": novograd_wrapper #value needs to be the functions + "Novograd": novograd_wrapper } From 817d6e8bbcdb5a25eb19d65500ba9970117e6584 Mon Sep 17 00:00:00 2001 From: Ainesh Nanda Date: Fri, 26 Jan 2024 20:45:01 +0530 Subject: [PATCH 08/10] updated monai version in requirements --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 17e70cc07..1790bc947 100644 --- a/setup.py +++ b/setup.py @@ -117,7 +117,7 @@ def run(self): "twine", "zarr", "keyring", - "monai", + "monai==1.3.0", ] if __name__ == "__main__": From d3a5d423fe9eb77ec75de64b5374d409e498e4c8 Mon Sep 17 00:00:00 2001 From: Ainesh Nanda Date: Fri, 26 Jan 2024 20:45:42 +0530 Subject: [PATCH 09/10] made novograd lowercase --- GANDLF/optimizers/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GANDLF/optimizers/__init__.py b/GANDLF/optimizers/__init__.py index 8b5daf6d2..09323c313 100644 --- a/GANDLF/optimizers/__init__.py +++ b/GANDLF/optimizers/__init__.py @@ -26,7 +26,7 @@ "adagrad": adagrad, "rmsprop": rmsprop, "radam": radam, - "Novograd": novograd_wrapper + "novograd": novograd_wrapper } From 0528a03ebe1a5d40d896a89ca1608fcfa52838f4 Mon Sep 17 00:00:00 2001 From: Sarthak Pati Date: Fri, 26 Jan 2024 10:55:49 -0500 Subject: [PATCH 10/10] Update GANDLF/optimizers/wrap_monai.py --- GANDLF/optimizers/wrap_monai.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GANDLF/optimizers/wrap_monai.py b/GANDLF/optimizers/wrap_monai.py index a5f0a9120..93e429dc1 100644 --- a/GANDLF/optimizers/wrap_monai.py +++ b/GANDLF/optimizers/wrap_monai.py @@ -10,4 +10,4 @@ def novograd_wrapper(parameters): eps=parameters["optimizer"].get("eps", 1e-8), weight_decay=parameters["optimizer"].get("weight_decay", 3e-05), amsgrad=parameters["optimizer"].get("amsgrad", False), - ) \ No newline at end of file + )