PVNet 4.0.6__tar.gz → 4.0.8__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 (50) hide show
  1. {pvnet-4.0.6 → pvnet-4.0.8}/PKG-INFO +2 -2
  2. {pvnet-4.0.6 → pvnet-4.0.8}/PVNet.egg-info/PKG-INFO +2 -2
  3. {pvnet-4.0.6 → pvnet-4.0.8}/PVNet.egg-info/requires.txt +1 -1
  4. pvnet-4.0.8/pvnet/__init__.py +2 -0
  5. {pvnet-4.0.6 → pvnet-4.0.8}/pvnet/models/base_model.py +30 -0
  6. {pvnet-4.0.6 → pvnet-4.0.8}/pvnet/models/multimodal/multimodal.py +3 -2
  7. {pvnet-4.0.6 → pvnet-4.0.8}/pvnet/models/multimodal/multimodal_base.py +4 -5
  8. {pvnet-4.0.6 → pvnet-4.0.8}/pvnet/models/multimodal/unimodal_teacher.py +3 -2
  9. {pvnet-4.0.6 → pvnet-4.0.8}/pyproject.toml +1 -1
  10. {pvnet-4.0.6 → pvnet-4.0.8}/tests/test_end2end.py +5 -1
  11. pvnet-4.0.6/pvnet/__init__.py +0 -2
  12. {pvnet-4.0.6 → pvnet-4.0.8}/LICENSE +0 -0
  13. {pvnet-4.0.6 → pvnet-4.0.8}/MANIFEST.in +0 -0
  14. {pvnet-4.0.6 → pvnet-4.0.8}/PVNet.egg-info/SOURCES.txt +0 -0
  15. {pvnet-4.0.6 → pvnet-4.0.8}/PVNet.egg-info/dependency_links.txt +0 -0
  16. {pvnet-4.0.6 → pvnet-4.0.8}/PVNet.egg-info/top_level.txt +0 -0
  17. {pvnet-4.0.6 → pvnet-4.0.8}/README.md +0 -0
  18. {pvnet-4.0.6 → pvnet-4.0.8}/pvnet/callbacks.py +0 -0
  19. {pvnet-4.0.6 → pvnet-4.0.8}/pvnet/data/__init__.py +0 -0
  20. {pvnet-4.0.6 → pvnet-4.0.8}/pvnet/data/base_datamodule.py +0 -0
  21. {pvnet-4.0.6 → pvnet-4.0.8}/pvnet/data/site_datamodule.py +0 -0
  22. {pvnet-4.0.6 → pvnet-4.0.8}/pvnet/data/uk_regional_datamodule.py +0 -0
  23. {pvnet-4.0.6 → pvnet-4.0.8}/pvnet/load_model.py +0 -0
  24. {pvnet-4.0.6 → pvnet-4.0.8}/pvnet/models/__init__.py +0 -0
  25. {pvnet-4.0.6 → pvnet-4.0.8}/pvnet/models/baseline/__init__.py +0 -0
  26. {pvnet-4.0.6 → pvnet-4.0.8}/pvnet/models/baseline/last_value.py +0 -0
  27. {pvnet-4.0.6 → pvnet-4.0.8}/pvnet/models/baseline/single_value.py +0 -0
  28. {pvnet-4.0.6 → pvnet-4.0.8}/pvnet/models/ensemble.py +0 -0
  29. {pvnet-4.0.6 → pvnet-4.0.8}/pvnet/models/model_cards/pv_india_model_card_template.md +0 -0
  30. {pvnet-4.0.6 → pvnet-4.0.8}/pvnet/models/model_cards/pv_uk_regional_model_card_template.md +0 -0
  31. {pvnet-4.0.6 → pvnet-4.0.8}/pvnet/models/model_cards/wind_india_model_card_template.md +0 -0
  32. {pvnet-4.0.6 → pvnet-4.0.8}/pvnet/models/multimodal/__init__.py +0 -0
  33. {pvnet-4.0.6 → pvnet-4.0.8}/pvnet/models/multimodal/basic_blocks.py +0 -0
  34. {pvnet-4.0.6 → pvnet-4.0.8}/pvnet/models/multimodal/encoders/__init__.py +0 -0
  35. {pvnet-4.0.6 → pvnet-4.0.8}/pvnet/models/multimodal/encoders/basic_blocks.py +0 -0
  36. {pvnet-4.0.6 → pvnet-4.0.8}/pvnet/models/multimodal/encoders/encoders2d.py +0 -0
  37. {pvnet-4.0.6 → pvnet-4.0.8}/pvnet/models/multimodal/encoders/encoders3d.py +0 -0
  38. {pvnet-4.0.6 → pvnet-4.0.8}/pvnet/models/multimodal/encoders/encodersRNN.py +0 -0
  39. {pvnet-4.0.6 → pvnet-4.0.8}/pvnet/models/multimodal/linear_networks/__init__.py +0 -0
  40. {pvnet-4.0.6 → pvnet-4.0.8}/pvnet/models/multimodal/linear_networks/basic_blocks.py +0 -0
  41. {pvnet-4.0.6 → pvnet-4.0.8}/pvnet/models/multimodal/linear_networks/networks.py +0 -0
  42. {pvnet-4.0.6 → pvnet-4.0.8}/pvnet/models/multimodal/site_encoders/__init__.py +0 -0
  43. {pvnet-4.0.6 → pvnet-4.0.8}/pvnet/models/multimodal/site_encoders/basic_blocks.py +0 -0
  44. {pvnet-4.0.6 → pvnet-4.0.8}/pvnet/models/multimodal/site_encoders/encoders.py +0 -0
  45. {pvnet-4.0.6 → pvnet-4.0.8}/pvnet/models/utils.py +0 -0
  46. {pvnet-4.0.6 → pvnet-4.0.8}/pvnet/optimizers.py +0 -0
  47. {pvnet-4.0.6 → pvnet-4.0.8}/pvnet/training.py +0 -0
  48. {pvnet-4.0.6 → pvnet-4.0.8}/pvnet/utils.py +0 -0
  49. {pvnet-4.0.6 → pvnet-4.0.8}/setup.cfg +0 -0
  50. {pvnet-4.0.6 → pvnet-4.0.8}/tests/test_utils.py +0 -0
@@ -1,11 +1,11 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PVNet
3
- Version: 4.0.6
3
+ Version: 4.0.8
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.11
8
+ Requires-Dist: ocf-data-sampler==0.1.16
9
9
  Requires-Dist: ocf_datapipes>=3.3.34
10
10
  Requires-Dist: ocf_ml_metrics>=0.0.11
11
11
  Requires-Dist: numpy
@@ -1,11 +1,11 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PVNet
3
- Version: 4.0.6
3
+ Version: 4.0.8
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.11
8
+ Requires-Dist: ocf-data-sampler==0.1.16
9
9
  Requires-Dist: ocf_datapipes>=3.3.34
10
10
  Requires-Dist: ocf_ml_metrics>=0.0.11
11
11
  Requires-Dist: numpy
@@ -1,4 +1,4 @@
1
- ocf_data_sampler==0.1.11
1
+ ocf-data-sampler==0.1.16
2
2
  ocf_datapipes>=3.3.34
3
3
  ocf_ml_metrics>=0.0.11
4
4
  numpy
@@ -0,0 +1,2 @@
1
+ """PVNet"""
2
+ __version__ = "4.0.8"
@@ -1,4 +1,5 @@
1
1
  """Base model for all PVNet submodels"""
2
+
2
3
  import json
3
4
  import logging
4
5
  import os
@@ -722,6 +723,35 @@ class BaseModel(pl.LightningModule, PVNetModelHubMixin):
722
723
  try:
723
724
  # join together validation results, and save to wandb
724
725
  validation_results_df = pd.concat(self.validation_epoch_results)
726
+ validation_results_df["error"] = (
727
+ validation_results_df["y"] - validation_results_df["y_quantile_0.5"]
728
+ )
729
+
730
+ if isinstance(self.logger, pl.loggers.WandbLogger):
731
+ # log error distribution metrics
732
+ wandb.log(
733
+ {
734
+ "2nd_percentile_median_forecast_error": validation_results_df[
735
+ "error"
736
+ ].quantile(0.02),
737
+ "5th_percentile_median_forecast_error": validation_results_df[
738
+ "error"
739
+ ].quantile(0.05),
740
+ "95th_percentile_median_forecast_error": validation_results_df[
741
+ "error"
742
+ ].quantile(0.95),
743
+ "98th_percentile_median_forecast_error": validation_results_df[
744
+ "error"
745
+ ].quantile(0.98),
746
+ "95th_percentile_median_forecast_absolute_error": abs(
747
+ validation_results_df["error"]
748
+ ).quantile(0.95),
749
+ "98th_percentile_median_forecast_absolute_error": abs(
750
+ validation_results_df["error"]
751
+ ).quantile(0.98),
752
+ }
753
+ )
754
+
725
755
  with tempfile.TemporaryDirectory() as tempdir:
726
756
  filename = os.path.join(tempdir, f"validation_results_{self.current_epoch}.csv")
727
757
  validation_results_df.to_csv(filename, index=False)
@@ -345,10 +345,11 @@ class Model(MultimodalBaseModel):
345
345
  modes["id"] = id_embedding
346
346
 
347
347
  if self.include_sun:
348
+ # Use only new direct keys
348
349
  sun = torch.cat(
349
350
  (
350
- x[f"{self._target_key}_solar_azimuth"],
351
- x[f"{self._target_key}_solar_elevation"],
351
+ x["solar_azimuth"],
352
+ x["solar_elevation"],
352
353
  ),
353
354
  dim=1,
354
355
  ).float()
@@ -46,11 +46,10 @@ class MultimodalBaseModel(BaseModel):
46
46
  )[:, : self.nwp_encoders_dict[nwp_source].sequence_length]
47
47
 
48
48
  if self.include_sun:
49
- # Slice off the end of the solar coords data
49
+ sun_len = self.forecast_len + self.history_len + 1
50
+ # Slice off end of solar coords
50
51
  for s in ["solar_azimuth", "solar_elevation"]:
51
- key = f"{self._target_key}_{s}"
52
- if key in new_batch.keys():
53
- sun_len = self.forecast_len + self.history_len + 1
54
- new_batch[key] = new_batch[key][:, :sun_len]
52
+ if s in new_batch.keys():
53
+ new_batch[s] = new_batch[s][:, :sun_len]
55
54
 
56
55
  return new_batch
@@ -305,10 +305,11 @@ class Model(MultimodalBaseModel):
305
305
  modes["id"] = id_embedding
306
306
 
307
307
  if self.include_sun:
308
+ # Use only new direct keys
308
309
  sun = torch.cat(
309
310
  (
310
- x["gsp_solar_azimuth"],
311
- x["gsp_solar_elevation"],
311
+ x["solar_azimuth"],
312
+ x["solar_elevation"],
312
313
  ),
313
314
  dim=1,
314
315
  ).float()
@@ -6,7 +6,7 @@ dynamic = ["version", "readme"]
6
6
  license={file="LICENCE"}
7
7
 
8
8
  dependencies = [
9
- "ocf_data_sampler==0.1.11",
9
+ "ocf-data-sampler==0.1.16",
10
10
  "ocf_datapipes>=3.3.34",
11
11
  "ocf_ml_metrics>=0.0.11",
12
12
  "numpy",
@@ -1,9 +1,13 @@
1
1
  import lightning
2
2
 
3
-
4
3
  def test_model_trainer_fit(multimodal_model, sample_train_val_datamodule):
4
+ """Test end-to-end training."""
5
+ # Get a sample batch for testing
5
6
  batch = next(iter(sample_train_val_datamodule.train_dataloader()))
7
+
8
+ # Run a forward pass to verify the model works with the data
6
9
  y = multimodal_model(batch)
7
10
 
11
+ # Train the model for one batch
8
12
  trainer = lightning.pytorch.trainer.trainer.Trainer(fast_dev_run=True, accelerator="cpu")
9
13
  trainer.fit(model=multimodal_model, datamodule=sample_train_val_datamodule)
@@ -1,2 +0,0 @@
1
- """PVNet"""
2
- __version__ = "4.0.6"
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