PVNet 3.0.55__tar.gz → 3.0.57__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pvnet-3.0.55 → pvnet-3.0.57}/PKG-INFO +5 -2
- {pvnet-3.0.55 → pvnet-3.0.57}/PVNet.egg-info/PKG-INFO +5 -2
- {pvnet-3.0.55 → pvnet-3.0.57}/README.md +4 -1
- pvnet-3.0.57/pvnet/__init__.py +2 -0
- {pvnet-3.0.55 → pvnet-3.0.57}/pvnet/models/base_model.py +70 -2
- pvnet-3.0.55/pvnet/__init__.py +0 -2
- {pvnet-3.0.55 → pvnet-3.0.57}/LICENSE +0 -0
- {pvnet-3.0.55 → pvnet-3.0.57}/MANIFEST.in +0 -0
- {pvnet-3.0.55 → pvnet-3.0.57}/PVNet.egg-info/SOURCES.txt +0 -0
- {pvnet-3.0.55 → pvnet-3.0.57}/PVNet.egg-info/dependency_links.txt +0 -0
- {pvnet-3.0.55 → pvnet-3.0.57}/PVNet.egg-info/requires.txt +0 -0
- {pvnet-3.0.55 → pvnet-3.0.57}/PVNet.egg-info/top_level.txt +0 -0
- {pvnet-3.0.55 → pvnet-3.0.57}/pvnet/callbacks.py +0 -0
- {pvnet-3.0.55 → pvnet-3.0.57}/pvnet/data/__init__.py +0 -0
- {pvnet-3.0.55 → pvnet-3.0.57}/pvnet/data/base.py +0 -0
- {pvnet-3.0.55 → pvnet-3.0.57}/pvnet/data/datamodule.py +0 -0
- {pvnet-3.0.55 → pvnet-3.0.57}/pvnet/data/pv_site_datamodule.py +0 -0
- {pvnet-3.0.55 → pvnet-3.0.57}/pvnet/data/utils.py +0 -0
- {pvnet-3.0.55 → pvnet-3.0.57}/pvnet/data/wind_datamodule.py +0 -0
- {pvnet-3.0.55 → pvnet-3.0.57}/pvnet/load_model.py +0 -0
- {pvnet-3.0.55 → pvnet-3.0.57}/pvnet/models/__init__.py +0 -0
- {pvnet-3.0.55 → pvnet-3.0.57}/pvnet/models/baseline/__init__.py +0 -0
- {pvnet-3.0.55 → pvnet-3.0.57}/pvnet/models/baseline/last_value.py +0 -0
- {pvnet-3.0.55 → pvnet-3.0.57}/pvnet/models/baseline/single_value.py +0 -0
- {pvnet-3.0.55 → pvnet-3.0.57}/pvnet/models/ensemble.py +0 -0
- {pvnet-3.0.55 → pvnet-3.0.57}/pvnet/models/multimodal/__init__.py +0 -0
- {pvnet-3.0.55 → pvnet-3.0.57}/pvnet/models/multimodal/basic_blocks.py +0 -0
- {pvnet-3.0.55 → pvnet-3.0.57}/pvnet/models/multimodal/encoders/__init__.py +0 -0
- {pvnet-3.0.55 → pvnet-3.0.57}/pvnet/models/multimodal/encoders/basic_blocks.py +0 -0
- {pvnet-3.0.55 → pvnet-3.0.57}/pvnet/models/multimodal/encoders/encoders2d.py +0 -0
- {pvnet-3.0.55 → pvnet-3.0.57}/pvnet/models/multimodal/encoders/encoders3d.py +0 -0
- {pvnet-3.0.55 → pvnet-3.0.57}/pvnet/models/multimodal/encoders/encodersRNN.py +0 -0
- {pvnet-3.0.55 → pvnet-3.0.57}/pvnet/models/multimodal/linear_networks/__init__.py +0 -0
- {pvnet-3.0.55 → pvnet-3.0.57}/pvnet/models/multimodal/linear_networks/basic_blocks.py +0 -0
- {pvnet-3.0.55 → pvnet-3.0.57}/pvnet/models/multimodal/linear_networks/networks.py +0 -0
- {pvnet-3.0.55 → pvnet-3.0.57}/pvnet/models/multimodal/multimodal.py +0 -0
- {pvnet-3.0.55 → pvnet-3.0.57}/pvnet/models/multimodal/multimodal_base.py +0 -0
- {pvnet-3.0.55 → pvnet-3.0.57}/pvnet/models/multimodal/site_encoders/__init__.py +0 -0
- {pvnet-3.0.55 → pvnet-3.0.57}/pvnet/models/multimodal/site_encoders/basic_blocks.py +0 -0
- {pvnet-3.0.55 → pvnet-3.0.57}/pvnet/models/multimodal/site_encoders/encoders.py +0 -0
- {pvnet-3.0.55 → pvnet-3.0.57}/pvnet/models/multimodal/unimodal_teacher.py +0 -0
- {pvnet-3.0.55 → pvnet-3.0.57}/pvnet/models/utils.py +0 -0
- {pvnet-3.0.55 → pvnet-3.0.57}/pvnet/optimizers.py +0 -0
- {pvnet-3.0.55 → pvnet-3.0.57}/pvnet/training.py +0 -0
- {pvnet-3.0.55 → pvnet-3.0.57}/pvnet/utils.py +0 -0
- {pvnet-3.0.55 → pvnet-3.0.57}/pyproject.toml +0 -0
- {pvnet-3.0.55 → pvnet-3.0.57}/setup.cfg +0 -0
- {pvnet-3.0.55 → pvnet-3.0.57}/tests/test_end2end.py +0 -0
- {pvnet-3.0.55 → pvnet-3.0.57}/tests/test_utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: PVNet
|
|
3
|
-
Version: 3.0.
|
|
3
|
+
Version: 3.0.57
|
|
4
4
|
Summary: PVNet
|
|
5
5
|
Author-email: Peter Dudfield <info@openclimatefix.org>
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
@@ -48,7 +48,8 @@ Requires-Dist: PVNet[all_models,dev]; extra == "all"
|
|
|
48
48
|
|
|
49
49
|
# PVNet 2.1
|
|
50
50
|
|
|
51
|
-
[](https://github.com/openclimatefix/PVNet/actions/workflows/release.yml)
|
|
51
|
+
[](https://github.com/openclimatefix/PVNet/actions/workflows/release.yml) [](https://github.com/openclimatefix/ocf-meta-repo?tab=readme-ov-file#overview-of-ocfs-nowcasting-repositories)
|
|
52
|
+
|
|
52
53
|
|
|
53
54
|
This project is used for training PVNet and running PVNet on live data.
|
|
54
55
|
|
|
@@ -133,6 +134,8 @@ OCF maintains a Zarr formatted version of the German Weather Service's (DWD)
|
|
|
133
134
|
ICON-EU NWP model here:
|
|
134
135
|
https://huggingface.co/datasets/openclimatefix/dwd-icon-eu which includes the UK
|
|
135
136
|
|
|
137
|
+
Please note that the current version of [ICON loader]([url](https://github.com/openclimatefix/ocf_datapipes/blob/9ec252eeee44937c12ab52699579bdcace76e72f/ocf_datapipes/load/nwp/providers/icon.py#L9-L30)) supports a different format. If you want to use our ICON-EU dataset or your own NWP source, you can create a loader for it using [the instructions here]([url](https://github.com/openclimatefix/ocf_datapipes/tree/main/ocf_datapipes/load#nwp)).
|
|
138
|
+
|
|
136
139
|
**PV**\
|
|
137
140
|
OCF maintains a dataset of PV generation from 1311 private PV installations
|
|
138
141
|
here: https://huggingface.co/datasets/openclimatefix/uk_pv
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: PVNet
|
|
3
|
-
Version: 3.0.
|
|
3
|
+
Version: 3.0.57
|
|
4
4
|
Summary: PVNet
|
|
5
5
|
Author-email: Peter Dudfield <info@openclimatefix.org>
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
@@ -48,7 +48,8 @@ Requires-Dist: PVNet[all_models,dev]; extra == "all"
|
|
|
48
48
|
|
|
49
49
|
# PVNet 2.1
|
|
50
50
|
|
|
51
|
-
[](https://github.com/openclimatefix/PVNet/actions/workflows/release.yml)
|
|
51
|
+
[](https://github.com/openclimatefix/PVNet/actions/workflows/release.yml) [](https://github.com/openclimatefix/ocf-meta-repo?tab=readme-ov-file#overview-of-ocfs-nowcasting-repositories)
|
|
52
|
+
|
|
52
53
|
|
|
53
54
|
This project is used for training PVNet and running PVNet on live data.
|
|
54
55
|
|
|
@@ -133,6 +134,8 @@ OCF maintains a Zarr formatted version of the German Weather Service's (DWD)
|
|
|
133
134
|
ICON-EU NWP model here:
|
|
134
135
|
https://huggingface.co/datasets/openclimatefix/dwd-icon-eu which includes the UK
|
|
135
136
|
|
|
137
|
+
Please note that the current version of [ICON loader]([url](https://github.com/openclimatefix/ocf_datapipes/blob/9ec252eeee44937c12ab52699579bdcace76e72f/ocf_datapipes/load/nwp/providers/icon.py#L9-L30)) supports a different format. If you want to use our ICON-EU dataset or your own NWP source, you can create a loader for it using [the instructions here]([url](https://github.com/openclimatefix/ocf_datapipes/tree/main/ocf_datapipes/load#nwp)).
|
|
138
|
+
|
|
136
139
|
**PV**\
|
|
137
140
|
OCF maintains a dataset of PV generation from 1311 private PV installations
|
|
138
141
|
here: https://huggingface.co/datasets/openclimatefix/uk_pv
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# PVNet 2.1
|
|
2
2
|
|
|
3
|
-
[](https://github.com/openclimatefix/PVNet/actions/workflows/release.yml)
|
|
3
|
+
[](https://github.com/openclimatefix/PVNet/actions/workflows/release.yml) [](https://github.com/openclimatefix/ocf-meta-repo?tab=readme-ov-file#overview-of-ocfs-nowcasting-repositories)
|
|
4
|
+
|
|
4
5
|
|
|
5
6
|
This project is used for training PVNet and running PVNet on live data.
|
|
6
7
|
|
|
@@ -85,6 +86,8 @@ OCF maintains a Zarr formatted version of the German Weather Service's (DWD)
|
|
|
85
86
|
ICON-EU NWP model here:
|
|
86
87
|
https://huggingface.co/datasets/openclimatefix/dwd-icon-eu which includes the UK
|
|
87
88
|
|
|
89
|
+
Please note that the current version of [ICON loader]([url](https://github.com/openclimatefix/ocf_datapipes/blob/9ec252eeee44937c12ab52699579bdcace76e72f/ocf_datapipes/load/nwp/providers/icon.py#L9-L30)) supports a different format. If you want to use our ICON-EU dataset or your own NWP source, you can create a loader for it using [the instructions here]([url](https://github.com/openclimatefix/ocf_datapipes/tree/main/ocf_datapipes/load#nwp)).
|
|
90
|
+
|
|
88
91
|
**PV**\
|
|
89
92
|
OCF maintains a dataset of PV generation from 1311 private PV installations
|
|
90
93
|
here: https://huggingface.co/datasets/openclimatefix/uk_pv
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import json
|
|
3
3
|
import logging
|
|
4
4
|
import os
|
|
5
|
+
import tempfile
|
|
5
6
|
from pathlib import Path
|
|
6
7
|
from typing import Dict, Optional, Union
|
|
7
8
|
|
|
@@ -410,6 +411,9 @@ class BaseModel(pl.LightningModule, PVNetModelHubMixin):
|
|
|
410
411
|
else:
|
|
411
412
|
self.num_output_features = self.forecast_len
|
|
412
413
|
|
|
414
|
+
# save all validation results to array, so we can save these to weights n biases
|
|
415
|
+
self.validation_epoch_results = []
|
|
416
|
+
|
|
413
417
|
def _quantiles_to_prediction(self, y_quantiles):
|
|
414
418
|
"""
|
|
415
419
|
Convert network prediction into a point prediction.
|
|
@@ -609,12 +613,61 @@ class BaseModel(pl.LightningModule, PVNetModelHubMixin):
|
|
|
609
613
|
print(e)
|
|
610
614
|
plt.close(fig)
|
|
611
615
|
|
|
616
|
+
def _log_validation_results(self, batch, y_hat, accum_batch_num):
|
|
617
|
+
"""Append validation results to self.validation_epoch_results"""
|
|
618
|
+
|
|
619
|
+
# get truth values, shape (b, forecast_len)
|
|
620
|
+
y = batch[self._target_key][:, -self.forecast_len :, 0]
|
|
621
|
+
y = y.detach().cpu().numpy()
|
|
622
|
+
batch_size = y.shape[0]
|
|
623
|
+
|
|
624
|
+
# get prediction values, shape (b, forecast_len, quantiles?)
|
|
625
|
+
y_hat = y_hat.detach().cpu().numpy()
|
|
626
|
+
|
|
627
|
+
# get time_utc, shape (b, forecast_len)
|
|
628
|
+
time_utc_key = BatchKey[f"{self._target_key_name}_time_utc"]
|
|
629
|
+
time_utc = batch[time_utc_key][:, -self.forecast_len :].detach().cpu().numpy()
|
|
630
|
+
|
|
631
|
+
# get target id and change from (b,1) to (b,)
|
|
632
|
+
id_key = BatchKey[f"{self._target_key_name}_id"]
|
|
633
|
+
target_id = batch[id_key].detach().cpu().numpy()
|
|
634
|
+
target_id = target_id.squeeze()
|
|
635
|
+
|
|
636
|
+
for i in range(batch_size):
|
|
637
|
+
y_i = y[i]
|
|
638
|
+
y_hat_i = y_hat[i]
|
|
639
|
+
time_utc_i = time_utc[i]
|
|
640
|
+
target_id_i = target_id[i]
|
|
641
|
+
|
|
642
|
+
results_dict = {
|
|
643
|
+
"y": y_i,
|
|
644
|
+
"time_utc": time_utc_i,
|
|
645
|
+
}
|
|
646
|
+
if self.use_quantile_regression:
|
|
647
|
+
results_dict.update(
|
|
648
|
+
{f"y_quantile_{q}": y_hat_i[:, i] for i, q in enumerate(self.output_quantiles)}
|
|
649
|
+
)
|
|
650
|
+
else:
|
|
651
|
+
results_dict["y_hat"] = y_hat_i
|
|
652
|
+
|
|
653
|
+
results_df = pd.DataFrame(results_dict)
|
|
654
|
+
results_df["id"] = target_id_i
|
|
655
|
+
results_df["batch_idx"] = accum_batch_num
|
|
656
|
+
results_df["example_idx"] = i
|
|
657
|
+
|
|
658
|
+
self.validation_epoch_results.append(results_df)
|
|
659
|
+
|
|
612
660
|
def validation_step(self, batch: dict, batch_idx):
|
|
613
661
|
"""Run validation step"""
|
|
662
|
+
|
|
663
|
+
accum_batch_num = batch_idx // self.trainer.accumulate_grad_batches
|
|
664
|
+
|
|
614
665
|
y_hat = self(batch)
|
|
615
666
|
# Sensor seems to be in batch, station, time order
|
|
616
667
|
y = batch[self._target_key][:, -self.forecast_len :, 0]
|
|
617
668
|
|
|
669
|
+
self._log_validation_results(batch, y_hat, accum_batch_num)
|
|
670
|
+
|
|
618
671
|
# Expand persistence to be the same shape as y
|
|
619
672
|
losses = self._calculate_common_losses(y, y_hat)
|
|
620
673
|
losses.update(self._calculate_val_losses(y, y_hat))
|
|
@@ -632,8 +685,6 @@ class BaseModel(pl.LightningModule, PVNetModelHubMixin):
|
|
|
632
685
|
on_epoch=True,
|
|
633
686
|
)
|
|
634
687
|
|
|
635
|
-
accum_batch_num = batch_idx // self.trainer.accumulate_grad_batches
|
|
636
|
-
|
|
637
688
|
# Make plots only if using wandb logger
|
|
638
689
|
if isinstance(self.logger, pl.loggers.WandbLogger) and accum_batch_num in [0, 1]:
|
|
639
690
|
# Store these temporarily under self
|
|
@@ -675,6 +726,23 @@ class BaseModel(pl.LightningModule, PVNetModelHubMixin):
|
|
|
675
726
|
def on_validation_epoch_end(self):
|
|
676
727
|
"""Run on epoch end"""
|
|
677
728
|
|
|
729
|
+
try:
|
|
730
|
+
# join together validation results, and save to wandb
|
|
731
|
+
validation_results_df = pd.concat(self.validation_epoch_results)
|
|
732
|
+
with tempfile.TemporaryDirectory() as tempdir:
|
|
733
|
+
filename = os.path.join(tempdir, f"validation_results_{self.current_epoch}.csv")
|
|
734
|
+
validation_results_df.to_csv(filename, index=False)
|
|
735
|
+
|
|
736
|
+
# make and log wand artifact
|
|
737
|
+
validation_artifact = wandb.Artifact(
|
|
738
|
+
f"validation_results_epoch_{self.current_epoch}", type="dataset"
|
|
739
|
+
)
|
|
740
|
+
validation_artifact.add_file(filename)
|
|
741
|
+
wandb.log_artifact(validation_artifact)
|
|
742
|
+
except Exception as e:
|
|
743
|
+
print("Failed to log validation results to wandb")
|
|
744
|
+
print(e)
|
|
745
|
+
|
|
678
746
|
horizon_maes_dict = self._horizon_maes.flush()
|
|
679
747
|
|
|
680
748
|
# Create the horizon accuracy curve
|
pvnet-3.0.55/pvnet/__init__.py
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|