PVNet 4.0.1__tar.gz → 4.0.3__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-4.0.1 → pvnet-4.0.3}/PKG-INFO +5 -3
- {pvnet-4.0.1 → pvnet-4.0.3}/PVNet.egg-info/PKG-INFO +5 -3
- {pvnet-4.0.1 → pvnet-4.0.3}/PVNet.egg-info/requires.txt +1 -1
- {pvnet-4.0.1 → pvnet-4.0.3}/README.md +3 -1
- pvnet-4.0.3/pvnet/__init__.py +2 -0
- {pvnet-4.0.1 → pvnet-4.0.3}/pvnet/models/base_model.py +1 -1
- {pvnet-4.0.1 → pvnet-4.0.3}/pvnet/models/multimodal/multimodal_base.py +16 -11
- {pvnet-4.0.1 → pvnet-4.0.3}/pyproject.toml +1 -1
- pvnet-4.0.1/pvnet/__init__.py +0 -2
- {pvnet-4.0.1 → pvnet-4.0.3}/LICENSE +0 -0
- {pvnet-4.0.1 → pvnet-4.0.3}/MANIFEST.in +0 -0
- {pvnet-4.0.1 → pvnet-4.0.3}/PVNet.egg-info/SOURCES.txt +0 -0
- {pvnet-4.0.1 → pvnet-4.0.3}/PVNet.egg-info/dependency_links.txt +0 -0
- {pvnet-4.0.1 → pvnet-4.0.3}/PVNet.egg-info/top_level.txt +0 -0
- {pvnet-4.0.1 → pvnet-4.0.3}/pvnet/callbacks.py +0 -0
- {pvnet-4.0.1 → pvnet-4.0.3}/pvnet/data/__init__.py +0 -0
- {pvnet-4.0.1 → pvnet-4.0.3}/pvnet/data/base_datamodule.py +0 -0
- {pvnet-4.0.1 → pvnet-4.0.3}/pvnet/data/site_datamodule.py +0 -0
- {pvnet-4.0.1 → pvnet-4.0.3}/pvnet/data/uk_regional_datamodule.py +0 -0
- {pvnet-4.0.1 → pvnet-4.0.3}/pvnet/load_model.py +0 -0
- {pvnet-4.0.1 → pvnet-4.0.3}/pvnet/models/__init__.py +0 -0
- {pvnet-4.0.1 → pvnet-4.0.3}/pvnet/models/baseline/__init__.py +0 -0
- {pvnet-4.0.1 → pvnet-4.0.3}/pvnet/models/baseline/last_value.py +0 -0
- {pvnet-4.0.1 → pvnet-4.0.3}/pvnet/models/baseline/single_value.py +0 -0
- {pvnet-4.0.1 → pvnet-4.0.3}/pvnet/models/ensemble.py +0 -0
- {pvnet-4.0.1 → pvnet-4.0.3}/pvnet/models/model_cards/pv_india_model_card_template.md +0 -0
- {pvnet-4.0.1 → pvnet-4.0.3}/pvnet/models/model_cards/pv_uk_regional_model_card_template.md +0 -0
- {pvnet-4.0.1 → pvnet-4.0.3}/pvnet/models/model_cards/wind_india_model_card_template.md +0 -0
- {pvnet-4.0.1 → pvnet-4.0.3}/pvnet/models/multimodal/__init__.py +0 -0
- {pvnet-4.0.1 → pvnet-4.0.3}/pvnet/models/multimodal/basic_blocks.py +0 -0
- {pvnet-4.0.1 → pvnet-4.0.3}/pvnet/models/multimodal/encoders/__init__.py +0 -0
- {pvnet-4.0.1 → pvnet-4.0.3}/pvnet/models/multimodal/encoders/basic_blocks.py +0 -0
- {pvnet-4.0.1 → pvnet-4.0.3}/pvnet/models/multimodal/encoders/encoders2d.py +0 -0
- {pvnet-4.0.1 → pvnet-4.0.3}/pvnet/models/multimodal/encoders/encoders3d.py +0 -0
- {pvnet-4.0.1 → pvnet-4.0.3}/pvnet/models/multimodal/encoders/encodersRNN.py +0 -0
- {pvnet-4.0.1 → pvnet-4.0.3}/pvnet/models/multimodal/linear_networks/__init__.py +0 -0
- {pvnet-4.0.1 → pvnet-4.0.3}/pvnet/models/multimodal/linear_networks/basic_blocks.py +0 -0
- {pvnet-4.0.1 → pvnet-4.0.3}/pvnet/models/multimodal/linear_networks/networks.py +0 -0
- {pvnet-4.0.1 → pvnet-4.0.3}/pvnet/models/multimodal/multimodal.py +0 -0
- {pvnet-4.0.1 → pvnet-4.0.3}/pvnet/models/multimodal/site_encoders/__init__.py +0 -0
- {pvnet-4.0.1 → pvnet-4.0.3}/pvnet/models/multimodal/site_encoders/basic_blocks.py +0 -0
- {pvnet-4.0.1 → pvnet-4.0.3}/pvnet/models/multimodal/site_encoders/encoders.py +0 -0
- {pvnet-4.0.1 → pvnet-4.0.3}/pvnet/models/multimodal/unimodal_teacher.py +0 -0
- {pvnet-4.0.1 → pvnet-4.0.3}/pvnet/models/utils.py +0 -0
- {pvnet-4.0.1 → pvnet-4.0.3}/pvnet/optimizers.py +0 -0
- {pvnet-4.0.1 → pvnet-4.0.3}/pvnet/training.py +0 -0
- {pvnet-4.0.1 → pvnet-4.0.3}/pvnet/utils.py +0 -0
- {pvnet-4.0.1 → pvnet-4.0.3}/setup.cfg +0 -0
- {pvnet-4.0.1 → pvnet-4.0.3}/tests/test_end2end.py +0 -0
- {pvnet-4.0.1 → pvnet-4.0.3}/tests/test_utils.py +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: PVNet
|
|
3
|
-
Version: 4.0.
|
|
3
|
+
Version: 4.0.3
|
|
4
4
|
Summary: PVNet
|
|
5
5
|
Author-email: Peter Dudfield <info@openclimatefix.org>
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
7
7
|
License-File: LICENSE
|
|
8
|
-
Requires-Dist: ocf_data_sampler==0.1.
|
|
8
|
+
Requires-Dist: ocf_data_sampler==0.1.11
|
|
9
9
|
Requires-Dist: ocf_datapipes>=3.3.34
|
|
10
10
|
Requires-Dist: ocf_ml_metrics>=0.0.11
|
|
11
11
|
Requires-Dist: numpy
|
|
@@ -147,7 +147,7 @@ here: https://huggingface.co/datasets/openclimatefix/uk_pv
|
|
|
147
147
|
|
|
148
148
|
Outside the PVNet repo, clone the ocf-data-sampler repo and exit the conda env created for PVNet: https://github.com/openclimatefix/ocf-data-sampler
|
|
149
149
|
```bash
|
|
150
|
-
git clone
|
|
150
|
+
git clone https://github.com/openclimatefix/ocf-data-sampler.git
|
|
151
151
|
conda create -n ocf-data-sampler python=3.11
|
|
152
152
|
```
|
|
153
153
|
|
|
@@ -163,6 +163,8 @@ Then exit this environment, and enter back into the pvnet conda environment and
|
|
|
163
163
|
pip install -e <PATH-TO-ocf-data-sampler-REPO>
|
|
164
164
|
```
|
|
165
165
|
|
|
166
|
+
If you install the local version of `ocf-data-sampler` that is more recent than the version specified in PVNet, you might receive a warning. However, it should still function correctly.
|
|
167
|
+
|
|
166
168
|
## Generating pre-made batches of data for training/validation of PVNet
|
|
167
169
|
|
|
168
170
|
PVNet contains a script for generating batches of data suitable for training the PVNet models. To run the script you will need to make some modifications to the datamodule configuration.
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: PVNet
|
|
3
|
-
Version: 4.0.
|
|
3
|
+
Version: 4.0.3
|
|
4
4
|
Summary: PVNet
|
|
5
5
|
Author-email: Peter Dudfield <info@openclimatefix.org>
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
7
7
|
License-File: LICENSE
|
|
8
|
-
Requires-Dist: ocf_data_sampler==0.1.
|
|
8
|
+
Requires-Dist: ocf_data_sampler==0.1.11
|
|
9
9
|
Requires-Dist: ocf_datapipes>=3.3.34
|
|
10
10
|
Requires-Dist: ocf_ml_metrics>=0.0.11
|
|
11
11
|
Requires-Dist: numpy
|
|
@@ -147,7 +147,7 @@ here: https://huggingface.co/datasets/openclimatefix/uk_pv
|
|
|
147
147
|
|
|
148
148
|
Outside the PVNet repo, clone the ocf-data-sampler repo and exit the conda env created for PVNet: https://github.com/openclimatefix/ocf-data-sampler
|
|
149
149
|
```bash
|
|
150
|
-
git clone
|
|
150
|
+
git clone https://github.com/openclimatefix/ocf-data-sampler.git
|
|
151
151
|
conda create -n ocf-data-sampler python=3.11
|
|
152
152
|
```
|
|
153
153
|
|
|
@@ -163,6 +163,8 @@ Then exit this environment, and enter back into the pvnet conda environment and
|
|
|
163
163
|
pip install -e <PATH-TO-ocf-data-sampler-REPO>
|
|
164
164
|
```
|
|
165
165
|
|
|
166
|
+
If you install the local version of `ocf-data-sampler` that is more recent than the version specified in PVNet, you might receive a warning. However, it should still function correctly.
|
|
167
|
+
|
|
166
168
|
## Generating pre-made batches of data for training/validation of PVNet
|
|
167
169
|
|
|
168
170
|
PVNet contains a script for generating batches of data suitable for training the PVNet models. To run the script you will need to make some modifications to the datamodule configuration.
|
|
@@ -98,7 +98,7 @@ here: https://huggingface.co/datasets/openclimatefix/uk_pv
|
|
|
98
98
|
|
|
99
99
|
Outside the PVNet repo, clone the ocf-data-sampler repo and exit the conda env created for PVNet: https://github.com/openclimatefix/ocf-data-sampler
|
|
100
100
|
```bash
|
|
101
|
-
git clone
|
|
101
|
+
git clone https://github.com/openclimatefix/ocf-data-sampler.git
|
|
102
102
|
conda create -n ocf-data-sampler python=3.11
|
|
103
103
|
```
|
|
104
104
|
|
|
@@ -114,6 +114,8 @@ Then exit this environment, and enter back into the pvnet conda environment and
|
|
|
114
114
|
pip install -e <PATH-TO-ocf-data-sampler-REPO>
|
|
115
115
|
```
|
|
116
116
|
|
|
117
|
+
If you install the local version of `ocf-data-sampler` that is more recent than the version specified in PVNet, you might receive a warning. However, it should still function correctly.
|
|
118
|
+
|
|
117
119
|
## Generating pre-made batches of data for training/validation of PVNet
|
|
118
120
|
|
|
119
121
|
PVNet contains a script for generating batches of data suitable for training the PVNet models. To run the script you will need to make some modifications to the datamodule configuration.
|
|
@@ -18,7 +18,7 @@ from huggingface_hub import ModelCard, ModelCardData, PyTorchModelHubMixin
|
|
|
18
18
|
from huggingface_hub.constants import CONFIG_NAME, PYTORCH_WEIGHTS_NAME
|
|
19
19
|
from huggingface_hub.file_download import hf_hub_download
|
|
20
20
|
from huggingface_hub.hf_api import HfApi
|
|
21
|
-
from
|
|
21
|
+
from ocf_data_sampler.sample.base import copy_batch_to_device
|
|
22
22
|
|
|
23
23
|
from pvnet.models.utils import (
|
|
24
24
|
BatchAccumulator,
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
"""Base model class for multimodal model and unimodal teacher"""
|
|
2
|
+
import copy
|
|
3
|
+
|
|
2
4
|
from torchvision.transforms.functional import center_crop
|
|
3
5
|
|
|
4
6
|
from pvnet.models.base_model import BaseModel
|
|
@@ -8,26 +10,29 @@ class MultimodalBaseModel(BaseModel):
|
|
|
8
10
|
"""Base model class for multimodal model and unimodal teacher"""
|
|
9
11
|
|
|
10
12
|
def _adapt_batch(self, batch):
|
|
11
|
-
"""Slice batches into appropriate shapes for model
|
|
13
|
+
"""Slice batches into appropriate shapes for model.
|
|
12
14
|
|
|
15
|
+
Returns a new batch dictionary with adapted data, leaving the original batch unchanged.
|
|
13
16
|
We make some specific assumptions about the original batch and the derived sliced batch:
|
|
14
17
|
- We are only limiting the future projections. I.e. we are never shrinking the batch from
|
|
15
18
|
the left hand side of the time axis, only slicing it from the right
|
|
16
19
|
- We are only shrinking the spatial crop of the satellite and NWP data
|
|
17
20
|
|
|
18
21
|
"""
|
|
22
|
+
# Create a copy of the batch to avoid modifying the original
|
|
23
|
+
new_batch = {key: copy.deepcopy(value) for key, value in batch.items()}
|
|
19
24
|
|
|
20
|
-
if "gsp" in
|
|
25
|
+
if "gsp" in new_batch.keys():
|
|
21
26
|
# Slice off the end of the GSP data
|
|
22
27
|
gsp_len = self.forecast_len + self.history_len + 1
|
|
23
|
-
|
|
24
|
-
|
|
28
|
+
new_batch["gsp"] = new_batch["gsp"][:, :gsp_len]
|
|
29
|
+
new_batch["gsp_time_utc"] = new_batch["gsp_time_utc"][:, :gsp_len]
|
|
25
30
|
|
|
26
31
|
if self.include_sat:
|
|
27
32
|
# Slice off the end of the satellite data and spatially crop
|
|
28
33
|
# Shape: batch_size, seq_length, channel, height, width
|
|
29
|
-
|
|
30
|
-
|
|
34
|
+
new_batch["satellite_actual"] = center_crop(
|
|
35
|
+
new_batch["satellite_actual"][:, : self.sat_sequence_len],
|
|
31
36
|
output_size=self.sat_encoder.image_size_pixels,
|
|
32
37
|
)
|
|
33
38
|
|
|
@@ -35,8 +40,8 @@ class MultimodalBaseModel(BaseModel):
|
|
|
35
40
|
# Slice off the end of the NWP data and spatially crop
|
|
36
41
|
for nwp_source in self.nwp_encoders_dict:
|
|
37
42
|
# shape: batch_size, seq_len, n_chans, height, width
|
|
38
|
-
|
|
39
|
-
|
|
43
|
+
new_batch["nwp"][nwp_source]["nwp"] = center_crop(
|
|
44
|
+
new_batch["nwp"][nwp_source]["nwp"],
|
|
40
45
|
output_size=self.nwp_encoders_dict[nwp_source].image_size_pixels,
|
|
41
46
|
)[:, : self.nwp_encoders_dict[nwp_source].sequence_length]
|
|
42
47
|
|
|
@@ -44,8 +49,8 @@ class MultimodalBaseModel(BaseModel):
|
|
|
44
49
|
# Slice off the end of the solar coords data
|
|
45
50
|
for s in ["solar_azimuth", "solar_elevation"]:
|
|
46
51
|
key = f"{self._target_key}_{s}"
|
|
47
|
-
if key in
|
|
52
|
+
if key in new_batch.keys():
|
|
48
53
|
sun_len = self.forecast_len + self.history_len + 1
|
|
49
|
-
|
|
54
|
+
new_batch[key] = new_batch[key][:, :sun_len]
|
|
50
55
|
|
|
51
|
-
return
|
|
56
|
+
return new_batch
|
pvnet-4.0.1/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
|