PVNet 3.0.44__tar.gz → 3.0.46__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.
Files changed (49) hide show
  1. {pvnet-3.0.44 → pvnet-3.0.46}/PKG-INFO +2 -2
  2. {pvnet-3.0.44 → pvnet-3.0.46}/PVNet.egg-info/PKG-INFO +2 -2
  3. {pvnet-3.0.44 → pvnet-3.0.46}/PVNet.egg-info/requires.txt +1 -1
  4. pvnet-3.0.46/pvnet/__init__.py +2 -0
  5. {pvnet-3.0.44 → pvnet-3.0.46}/pvnet/models/base_model.py +69 -1
  6. {pvnet-3.0.44 → pvnet-3.0.46}/pvnet/models/multimodal/multimodal.py +1 -1
  7. {pvnet-3.0.44 → pvnet-3.0.46}/pyproject.toml +1 -1
  8. pvnet-3.0.44/pvnet/__init__.py +0 -2
  9. {pvnet-3.0.44 → pvnet-3.0.46}/LICENSE +0 -0
  10. {pvnet-3.0.44 → pvnet-3.0.46}/MANIFEST.in +0 -0
  11. {pvnet-3.0.44 → pvnet-3.0.46}/PVNet.egg-info/SOURCES.txt +0 -0
  12. {pvnet-3.0.44 → pvnet-3.0.46}/PVNet.egg-info/dependency_links.txt +0 -0
  13. {pvnet-3.0.44 → pvnet-3.0.46}/PVNet.egg-info/top_level.txt +0 -0
  14. {pvnet-3.0.44 → pvnet-3.0.46}/README.md +0 -0
  15. {pvnet-3.0.44 → pvnet-3.0.46}/pvnet/callbacks.py +0 -0
  16. {pvnet-3.0.44 → pvnet-3.0.46}/pvnet/data/__init__.py +0 -0
  17. {pvnet-3.0.44 → pvnet-3.0.46}/pvnet/data/base.py +0 -0
  18. {pvnet-3.0.44 → pvnet-3.0.46}/pvnet/data/datamodule.py +0 -0
  19. {pvnet-3.0.44 → pvnet-3.0.46}/pvnet/data/pv_site_datamodule.py +0 -0
  20. {pvnet-3.0.44 → pvnet-3.0.46}/pvnet/data/utils.py +0 -0
  21. {pvnet-3.0.44 → pvnet-3.0.46}/pvnet/data/wind_datamodule.py +0 -0
  22. {pvnet-3.0.44 → pvnet-3.0.46}/pvnet/load_model.py +0 -0
  23. {pvnet-3.0.44 → pvnet-3.0.46}/pvnet/models/__init__.py +0 -0
  24. {pvnet-3.0.44 → pvnet-3.0.46}/pvnet/models/baseline/__init__.py +0 -0
  25. {pvnet-3.0.44 → pvnet-3.0.46}/pvnet/models/baseline/last_value.py +0 -0
  26. {pvnet-3.0.44 → pvnet-3.0.46}/pvnet/models/baseline/single_value.py +0 -0
  27. {pvnet-3.0.44 → pvnet-3.0.46}/pvnet/models/ensemble.py +0 -0
  28. {pvnet-3.0.44 → pvnet-3.0.46}/pvnet/models/multimodal/__init__.py +0 -0
  29. {pvnet-3.0.44 → pvnet-3.0.46}/pvnet/models/multimodal/basic_blocks.py +0 -0
  30. {pvnet-3.0.44 → pvnet-3.0.46}/pvnet/models/multimodal/encoders/__init__.py +0 -0
  31. {pvnet-3.0.44 → pvnet-3.0.46}/pvnet/models/multimodal/encoders/basic_blocks.py +0 -0
  32. {pvnet-3.0.44 → pvnet-3.0.46}/pvnet/models/multimodal/encoders/encoders2d.py +0 -0
  33. {pvnet-3.0.44 → pvnet-3.0.46}/pvnet/models/multimodal/encoders/encoders3d.py +0 -0
  34. {pvnet-3.0.44 → pvnet-3.0.46}/pvnet/models/multimodal/encoders/encodersRNN.py +0 -0
  35. {pvnet-3.0.44 → pvnet-3.0.46}/pvnet/models/multimodal/linear_networks/__init__.py +0 -0
  36. {pvnet-3.0.44 → pvnet-3.0.46}/pvnet/models/multimodal/linear_networks/basic_blocks.py +0 -0
  37. {pvnet-3.0.44 → pvnet-3.0.46}/pvnet/models/multimodal/linear_networks/networks.py +0 -0
  38. {pvnet-3.0.44 → pvnet-3.0.46}/pvnet/models/multimodal/multimodal_base.py +0 -0
  39. {pvnet-3.0.44 → pvnet-3.0.46}/pvnet/models/multimodal/site_encoders/__init__.py +0 -0
  40. {pvnet-3.0.44 → pvnet-3.0.46}/pvnet/models/multimodal/site_encoders/basic_blocks.py +0 -0
  41. {pvnet-3.0.44 → pvnet-3.0.46}/pvnet/models/multimodal/site_encoders/encoders.py +0 -0
  42. {pvnet-3.0.44 → pvnet-3.0.46}/pvnet/models/multimodal/unimodal_teacher.py +0 -0
  43. {pvnet-3.0.44 → pvnet-3.0.46}/pvnet/models/utils.py +0 -0
  44. {pvnet-3.0.44 → pvnet-3.0.46}/pvnet/optimizers.py +0 -0
  45. {pvnet-3.0.44 → pvnet-3.0.46}/pvnet/training.py +0 -0
  46. {pvnet-3.0.44 → pvnet-3.0.46}/pvnet/utils.py +0 -0
  47. {pvnet-3.0.44 → pvnet-3.0.46}/setup.cfg +0 -0
  48. {pvnet-3.0.44 → pvnet-3.0.46}/tests/test_end2end.py +0 -0
  49. {pvnet-3.0.44 → pvnet-3.0.46}/tests/test_utils.py +0 -0
@@ -1,11 +1,11 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PVNet
3
- Version: 3.0.44
3
+ Version: 3.0.46
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_datapipes>=3.3.6
8
+ Requires-Dist: ocf_datapipes>=3.3.34
9
9
  Requires-Dist: ocf_ml_metrics>=0.0.11
10
10
  Requires-Dist: numpy
11
11
  Requires-Dist: pandas
@@ -1,11 +1,11 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PVNet
3
- Version: 3.0.44
3
+ Version: 3.0.46
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_datapipes>=3.3.6
8
+ Requires-Dist: ocf_datapipes>=3.3.34
9
9
  Requires-Dist: ocf_ml_metrics>=0.0.11
10
10
  Requires-Dist: numpy
11
11
  Requires-Dist: pandas
@@ -1,4 +1,4 @@
1
- ocf_datapipes>=3.3.6
1
+ ocf_datapipes>=3.3.34
2
2
  ocf_ml_metrics>=0.0.11
3
3
  numpy
4
4
  pandas
@@ -0,0 +1,2 @@
1
+ """PVNet"""
2
+ __version__ = "3.0.46"
@@ -79,6 +79,68 @@ def make_clean_data_config(input_path, output_path, placeholder="PLACEHOLDER"):
79
79
  yaml.dump(config, outfile, default_flow_style=False)
80
80
 
81
81
 
82
+ def minimize_data_config(input_path, output_path, model):
83
+ """Strip out parts of the data config which aren't used by the model
84
+
85
+ Args:
86
+ input_path: Path to input datapipes configuration file
87
+ output_path: Location to save the output configuration file
88
+ model: The PVNet model object
89
+ """
90
+ with open(input_path) as cfg:
91
+ config = yaml.load(cfg, Loader=yaml.FullLoader)
92
+
93
+ if "nwp" in config["input_data"]:
94
+ if not model.include_nwp:
95
+ del config["input_data"]["nwp"]
96
+ else:
97
+ for nwp_source in config["input_data"]["nwp"].keys():
98
+ nwp_config = config["input_data"]["nwp"][nwp_source]
99
+
100
+ if nwp_source not in model.nwp_encoders_dict:
101
+ # If not used, delete this source from the config
102
+ del config["input_data"]["nwp"][nwp_source]
103
+ else:
104
+ # Replace the image size
105
+ nwp_pixel_size = model.nwp_encoders_dict[nwp_source].image_size_pixels
106
+ nwp_config["nwp_image_size_pixels_height"] = nwp_pixel_size
107
+ nwp_config["nwp_image_size_pixels_width"] = nwp_pixel_size
108
+
109
+ # Replace the forecast minutes
110
+ nwp_config["forecast_minutes"] = (
111
+ model.nwp_encoders_dict[nwp_source].sequence_length
112
+ - nwp_config["history_minutes"] / nwp_config["time_resolution_minutes"]
113
+ - 1
114
+ ) * nwp_config["time_resolution_minutes"]
115
+
116
+ if "satellite" in config["input_data"]:
117
+ if not model.include_sat:
118
+ del config["input_data"]["satellite"]
119
+ else:
120
+ sat_config = config["input_data"]["satellite"]
121
+
122
+ # Replace the image size
123
+ sat_pixel_size = model.sat_encoder.image_size_pixels
124
+ sat_config["satellite_image_size_pixels_height"] = sat_pixel_size
125
+ sat_config["satellite_image_size_pixels_width"] = sat_pixel_size
126
+
127
+ # Replace the satellite delay
128
+ sat_config["live_delay_minutes"] = model.min_sat_delay_minutes
129
+
130
+ if "pv" in config["input_data"]:
131
+ if not model.include_pv:
132
+ del config["input_data"]["pv"]
133
+
134
+ if "gsp" in config["input_data"]:
135
+ gsp_config = config["input_data"]["gsp"]
136
+
137
+ # Replace the forecast minutes
138
+ gsp_config["forecast_minutes"] = model.forecast_minutes
139
+
140
+ with open(output_path, "w") as outfile:
141
+ yaml.dump(config, outfile, default_flow_style=False)
142
+
143
+
82
144
  class PVNetModelHubMixin(PyTorchModelHubMixin):
83
145
  """
84
146
  Implementation of [`PyTorchModelHubMixin`] to provide model Hub upload/download capabilities.
@@ -207,7 +269,13 @@ class PVNetModelHubMixin(PyTorchModelHubMixin):
207
269
 
208
270
  # Save cleaned datapipes configuration file
209
271
  if data_config is not None:
210
- make_clean_data_config(data_config, save_directory / DATA_CONFIG_NAME)
272
+ new_data_config_path = save_directory / DATA_CONFIG_NAME
273
+
274
+ # Replace the input filenames with place holders
275
+ make_clean_data_config(data_config, new_data_config_path)
276
+
277
+ # Taylor the data config to the model being saved
278
+ minimize_data_config(new_data_config_path, new_data_config_path, self)
211
279
 
212
280
  # Creating and saving model card.
213
281
  card_data = ModelCardData(language="en", license="mit", library_name="pytorch")
@@ -146,6 +146,7 @@ class Model(MultimodalBaseModel):
146
146
  self.embedding_dim = embedding_dim
147
147
  self.add_image_embedding_channel = add_image_embedding_channel
148
148
  self.interval_minutes = interval_minutes
149
+ self.min_sat_delay_minutes = min_sat_delay_minutes
149
150
  self.adapt_batches = adapt_batches
150
151
 
151
152
  super().__init__(
@@ -167,7 +168,6 @@ class Model(MultimodalBaseModel):
167
168
  if self.include_sat:
168
169
  # Param checks
169
170
  assert sat_history_minutes is not None
170
- assert nwp_forecast_minutes is not None
171
171
 
172
172
  self.sat_sequence_len = (
173
173
  sat_history_minutes - min_sat_delay_minutes
@@ -6,7 +6,7 @@ dynamic = ["version", "readme"]
6
6
  license={file="LICENCE"}
7
7
 
8
8
  dependencies = [
9
- "ocf_datapipes>=3.3.6",
9
+ "ocf_datapipes>=3.3.34",
10
10
  "ocf_ml_metrics>=0.0.11",
11
11
  "numpy",
12
12
  "pandas",
@@ -1,2 +0,0 @@
1
- """PVNet"""
2
- __version__ = "3.0.44"
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