From 2bfc33a81a14f23ea46fe95c71bdc37d62cc36a0 Mon Sep 17 00:00:00 2001 From: peterdudfield Date: Wed, 20 Dec 2023 13:22:11 +0000 Subject: [PATCH 01/18] remove nowcasting utils --- requirements.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 3b2fad3..4da12cd 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,3 @@ -nowcasting_utils ocf_datapipes>=1.2.44 pvnet>=2.4.0 ocf_ml_metrics From 771340bf300f0cf902ce547d64e40981cf799563 Mon Sep 17 00:00:00 2001 From: peterdudfield Date: Wed, 20 Dec 2023 13:44:23 +0000 Subject: [PATCH 02/18] restrict to 3.12 --- .github/workflows/workflows.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/workflows.yaml b/.github/workflows/workflows.yaml index d5b946a..d66d000 100644 --- a/.github/workflows/workflows.yaml +++ b/.github/workflows/workflows.yaml @@ -16,3 +16,4 @@ jobs: sudo_apt_install: "libgeos++-dev libproj-dev proj-data proj-bin" # brew_install: "proj geos librttopo" os_list: '["ubuntu-latest"]' + python_version: "['3.10', '3.11']" \ No newline at end of file From 9b54a54cfe69f325449c1dcbe7e509d7b32899f2 Mon Sep 17 00:00:00 2001 From: peterdudfield Date: Wed, 20 Dec 2023 13:59:11 +0000 Subject: [PATCH 03/18] typo --- .github/workflows/workflows.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/workflows.yaml b/.github/workflows/workflows.yaml index d66d000..686ed86 100644 --- a/.github/workflows/workflows.yaml +++ b/.github/workflows/workflows.yaml @@ -16,4 +16,4 @@ jobs: sudo_apt_install: "libgeos++-dev libproj-dev proj-data proj-bin" # brew_install: "proj geos librttopo" os_list: '["ubuntu-latest"]' - python_version: "['3.10', '3.11']" \ No newline at end of file + python-version: "['3.10', '3.11']" \ No newline at end of file From f78b87fa5005595be24bab93e2b55ef5d9bbd4b6 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 20 Dec 2023 14:01:54 +0000 Subject: [PATCH 04/18] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .github/workflows/workflows.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/workflows.yaml b/.github/workflows/workflows.yaml index 686ed86..28f1ff1 100644 --- a/.github/workflows/workflows.yaml +++ b/.github/workflows/workflows.yaml @@ -16,4 +16,4 @@ jobs: sudo_apt_install: "libgeos++-dev libproj-dev proj-data proj-bin" # brew_install: "proj geos librttopo" os_list: '["ubuntu-latest"]' - python-version: "['3.10', '3.11']" \ No newline at end of file + python-version: "['3.10', '3.11']" From 1787b07b29d269e7d366553e7db31a368f3224c2 Mon Sep 17 00:00:00 2001 From: peterdudfield Date: Wed, 20 Dec 2023 14:06:25 +0000 Subject: [PATCH 05/18] update imports --- pvnet_summation/models/base_model.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/pvnet_summation/models/base_model.py b/pvnet_summation/models/base_model.py index dc09875..f46ee34 100644 --- a/pvnet_summation/models/base_model.py +++ b/pvnet_summation/models/base_model.py @@ -6,11 +6,6 @@ import torch import torch.nn.functional as F import wandb -from nowcasting_utils.models.loss import WeightedLosses -from nowcasting_utils.models.metrics import ( - mae_each_forecast_horizon, - mse_each_forecast_horizon, -) from pvnet.models.base_model import BaseModel as PVNetBaseModel from pvnet.models.base_model import PVNetModelHubMixin from pvnet.models.utils import ( @@ -18,6 +13,7 @@ PredAccumulator, ) from pvnet.optimizers import AbstractOptimizer +from pvnet.models.utils import WeightedLosses from pvnet_summation.utils import plot_forecasts @@ -187,8 +183,8 @@ def validation_step(self, batch: dict, batch_idx): "MSE/val": F.mse_loss(y_sum, y), "MAE/val": F.l1_loss(y_sum, y), } - mse_each_step = mse_each_forecast_horizon(output=y_sum, target=y) - mae_each_step = mae_each_forecast_horizon(output=y_sum, target=y) + mse_each_step = gsp_sum_losses["MSE/val"] + mae_each_step = gsp_sum_losses["MAE/val"] gsp_sum_losses.update({f"MSE_horizon/step_{i:02}": m for i, m in enumerate(mse_each_step)}) gsp_sum_losses.update({f"MAE_horizon/step_{i:02}": m for i, m in enumerate(mae_each_step)}) From c62beb2e6ac33f020b31b7a4fbaca3758e86c9a8 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 20 Dec 2023 14:07:58 +0000 Subject: [PATCH 06/18] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- pvnet_summation/models/base_model.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pvnet_summation/models/base_model.py b/pvnet_summation/models/base_model.py index f46ee34..e4de399 100644 --- a/pvnet_summation/models/base_model.py +++ b/pvnet_summation/models/base_model.py @@ -11,9 +11,9 @@ from pvnet.models.utils import ( MetricAccumulator, PredAccumulator, + WeightedLosses, ) from pvnet.optimizers import AbstractOptimizer -from pvnet.models.utils import WeightedLosses from pvnet_summation.utils import plot_forecasts From a9285b120141df2e1825b384fe1daf47bf507bda Mon Sep 17 00:00:00 2001 From: peterdudfield Date: Wed, 20 Dec 2023 14:14:29 +0000 Subject: [PATCH 07/18] try ocf_datapipes==2.3.1 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 4da12cd..a73f2b4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -ocf_datapipes>=1.2.44 +ocf_datapipes==2.3.1 pvnet>=2.4.0 ocf_ml_metrics numpy From 9ae5096037463db540c4ff808ee3f3773f844cc8 Mon Sep 17 00:00:00 2001 From: peterdudfield Date: Wed, 20 Dec 2023 14:27:52 +0000 Subject: [PATCH 08/18] ocf_datapipes==2.2.7 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index a73f2b4..88745a8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -ocf_datapipes==2.3.1 +ocf_datapipes==2.2.7 pvnet>=2.4.0 ocf_ml_metrics numpy From 4236a2c74d3901744406dbf1f62315da90d389a2 Mon Sep 17 00:00:00 2001 From: peterdudfield Date: Wed, 20 Dec 2023 14:35:55 +0000 Subject: [PATCH 09/18] ocf_ml_metrics==0.0.10 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 88745a8..b80c2cc 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ ocf_datapipes==2.2.7 pvnet>=2.4.0 -ocf_ml_metrics +ocf_ml_metrics==0.0.10 numpy pandas matplotlib From 68db4e8eec34852dd8c660be839b05bc6083391a Mon Sep 17 00:00:00 2001 From: peterdudfield Date: Wed, 20 Dec 2023 14:54:15 +0000 Subject: [PATCH 10/18] pvnet==2.4.1 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index b80c2cc..fef162a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ ocf_datapipes==2.2.7 -pvnet>=2.4.0 +pvnet==2.4.1 ocf_ml_metrics==0.0.10 numpy pandas From bd1ba69bc27c02c9f194d30297ff914b29f54abd Mon Sep 17 00:00:00 2001 From: peterdudfield Date: Wed, 20 Dec 2023 18:02:38 +0000 Subject: [PATCH 11/18] pin to pvnet summation model --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index fef162a..621a4bf 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ ocf_datapipes==2.2.7 -pvnet==2.4.1 +pvnet @ git+https://github.com/openclimatefix/pvnet@fix-common-metrics ocf_ml_metrics==0.0.10 numpy pandas From 076b5e8ba62d4db71a575d94d36fc20ce6d671b2 Mon Sep 17 00:00:00 2001 From: peterdudfield Date: Wed, 20 Dec 2023 18:04:25 +0000 Subject: [PATCH 12/18] ocf_datapipes==2.3.1 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 621a4bf..4732c85 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -ocf_datapipes==2.2.7 +ocf_datapipes==2.3.1 pvnet @ git+https://github.com/openclimatefix/pvnet@fix-common-metrics ocf_ml_metrics==0.0.10 numpy From d55df30352e0a1011c96f89032a31c78506f503a Mon Sep 17 00:00:00 2001 From: peterdudfield Date: Wed, 20 Dec 2023 18:10:37 +0000 Subject: [PATCH 13/18] pvnet 2.5.2 --- requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 4732c85..80ff54f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ -ocf_datapipes==2.3.1 -pvnet @ git+https://github.com/openclimatefix/pvnet@fix-common-metrics +ocf_datapipes==3.0.0 +pvnet==2.5.2 ocf_ml_metrics==0.0.10 numpy pandas From f8ac5a28f1cab400398443c7a4ca8a8abfab8e22 Mon Sep 17 00:00:00 2001 From: peterdudfield Date: Wed, 20 Dec 2023 18:12:36 +0000 Subject: [PATCH 14/18] pvnet==2.6.0 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 80ff54f..92531d6 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ ocf_datapipes==3.0.0 -pvnet==2.5.2 +pvnet==2.6.0 ocf_ml_metrics==0.0.10 numpy pandas From 05ea00d94959a9b3a337cc3d469a6d644590353e Mon Sep 17 00:00:00 2001 From: peterdudfield Date: Wed, 20 Dec 2023 18:32:08 +0000 Subject: [PATCH 15/18] only pin to minor version --- requirements.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/requirements.txt b/requirements.txt index 92531d6..482ecf4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ -ocf_datapipes==3.0.0 -pvnet==2.6.0 -ocf_ml_metrics==0.0.10 +ocf_datapipes==3.0.* +pvnet==2.6.* +ocf_ml_metrics==0.0.* numpy pandas matplotlib From 471e3d68f628c3307a2e709ab0bc1aba46384e7a Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 20 Dec 2023 18:34:24 +0000 Subject: [PATCH 16/18] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- pvnet_summation/data/datamodule.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pvnet_summation/data/datamodule.py b/pvnet_summation/data/datamodule.py index 175e705..14d85ca 100644 --- a/pvnet_summation/data/datamodule.py +++ b/pvnet_summation/data/datamodule.py @@ -2,9 +2,9 @@ import torch from lightning.pytorch import LightningDataModule +from ocf_datapipes.batch import BatchKey from ocf_datapipes.load import OpenGSP from ocf_datapipes.training.pvnet import normalize_gsp -from ocf_datapipes.batch import BatchKey from torch.utils.data import DataLoader from torch.utils.data.datapipes.datapipe import IterDataPipe from torch.utils.data.datapipes.iter import FileLister, Zipper From ed78b5c3f561390cad121de3cf07631446ba1bc4 Mon Sep 17 00:00:00 2001 From: peterdudfield Date: Thu, 21 Dec 2023 16:43:20 +0000 Subject: [PATCH 17/18] use torch functions instead --- pvnet_summation/models/base_model.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pvnet_summation/models/base_model.py b/pvnet_summation/models/base_model.py index e4de399..ee0c6f0 100644 --- a/pvnet_summation/models/base_model.py +++ b/pvnet_summation/models/base_model.py @@ -183,8 +183,9 @@ def validation_step(self, batch: dict, batch_idx): "MSE/val": F.mse_loss(y_sum, y), "MAE/val": F.l1_loss(y_sum, y), } - mse_each_step = gsp_sum_losses["MSE/val"] - mae_each_step = gsp_sum_losses["MAE/val"] + + mse_each_step = torch.mean((output - target) ** 2, dim=0) + mae_each_step = torch.mean(torch.abs(output - target), dim=0) gsp_sum_losses.update({f"MSE_horizon/step_{i:02}": m for i, m in enumerate(mse_each_step)}) gsp_sum_losses.update({f"MAE_horizon/step_{i:02}": m for i, m in enumerate(mae_each_step)}) From 337abe59622f9bce4450d694d0f298d14fada033 Mon Sep 17 00:00:00 2001 From: peterdudfield Date: Thu, 21 Dec 2023 16:49:58 +0000 Subject: [PATCH 18/18] fix --- pvnet_summation/models/base_model.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pvnet_summation/models/base_model.py b/pvnet_summation/models/base_model.py index ee0c6f0..c58e4f6 100644 --- a/pvnet_summation/models/base_model.py +++ b/pvnet_summation/models/base_model.py @@ -184,8 +184,8 @@ def validation_step(self, batch: dict, batch_idx): "MAE/val": F.l1_loss(y_sum, y), } - mse_each_step = torch.mean((output - target) ** 2, dim=0) - mae_each_step = torch.mean(torch.abs(output - target), dim=0) + mse_each_step = torch.mean((y_sum - y) ** 2, dim=0) + mae_each_step = torch.mean(torch.abs(y_sum - y), dim=0) gsp_sum_losses.update({f"MSE_horizon/step_{i:02}": m for i, m in enumerate(mse_each_step)}) gsp_sum_losses.update({f"MAE_horizon/step_{i:02}": m for i, m in enumerate(mae_each_step)})