PVNet 5.0.20__py3-none-any.whl → 5.0.22__py3-none-any.whl

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.
@@ -25,6 +25,7 @@ class DefaultPVNet(AbstractNWPSatelliteEncoder):
25
25
  spatial_kernel_size: int = 3,
26
26
  temporal_kernel_size: int = 3,
27
27
  padding: int | tuple[int, ...] = (1, 0, 0),
28
+ stride: int | tuple[int, ...] = 1,
28
29
  ):
29
30
  """This is the original encoding module used in PVNet, with a few minor tweaks.
30
31
 
@@ -39,29 +40,38 @@ class DefaultPVNet(AbstractNWPSatelliteEncoder):
39
40
  spatial_kernel_size: The spatial size of the kernel used in the conv3d layers.
40
41
  temporal_kernel_size: The temporal size of the kernel used in the conv3d layers.
41
42
  padding: The padding used in the conv3d layers. If an int, the same padding
42
- is used in all dimensions
43
+ is used in all dimensions. The dimensions are (time, space, space)
44
+ stride: The stride used in conv3d layers. If an int, the same stride is used
45
+ in all dimensions
43
46
  """
44
47
 
45
48
  super().__init__(sequence_length, image_size_pixels, in_channels, out_features)
46
49
 
47
50
  if isinstance(padding, int):
48
51
  padding = (padding, padding, padding)
52
+
53
+ if isinstance(stride, int):
54
+ stride = (stride, stride, stride)
49
55
 
50
56
  # Check that the output shape of the convolutional layers will be at least 1x1
51
- cnn_spatial_output_size = (
52
- image_size_pixels
53
- - ((spatial_kernel_size - 2 * padding[1]) - 1) * number_of_conv3d_layers
54
- )
55
- cnn_sequence_length = (
56
- sequence_length
57
- - ((temporal_kernel_size - 2 * padding[0]) - 1) * number_of_conv3d_layers
58
- )
57
+ cnn_spatial_output_size = image_size_pixels
58
+
59
+ for _ in range(number_of_conv3d_layers):
60
+ cnn_spatial_output_size = (
61
+ cnn_spatial_output_size - spatial_kernel_size + 2 * padding[1]
62
+ ) // stride[1] + 1
63
+
59
64
  if not (cnn_spatial_output_size >= 1):
60
65
  raise ValueError(
61
66
  f"cannot use this many conv3d layers ({number_of_conv3d_layers}) with this input "
62
67
  f"spatial size ({image_size_pixels})"
63
68
  )
64
69
 
70
+ cnn_sequence_length = (
71
+ sequence_length
72
+ - ((temporal_kernel_size - 2 * padding[0]) - 1) * number_of_conv3d_layers
73
+ )
74
+
65
75
  conv_layers = []
66
76
 
67
77
  conv_layers += [
@@ -70,16 +80,18 @@ class DefaultPVNet(AbstractNWPSatelliteEncoder):
70
80
  out_channels=conv3d_channels,
71
81
  kernel_size=(temporal_kernel_size, spatial_kernel_size, spatial_kernel_size),
72
82
  padding=padding,
83
+ stride=stride,
73
84
  ),
74
85
  nn.ELU(),
75
86
  ]
76
- for i in range(0, number_of_conv3d_layers - 1):
87
+ for _ in range(0, number_of_conv3d_layers - 1):
77
88
  conv_layers += [
78
89
  nn.Conv3d(
79
90
  in_channels=conv3d_channels,
80
91
  out_channels=conv3d_channels,
81
92
  kernel_size=(temporal_kernel_size, spatial_kernel_size, spatial_kernel_size),
82
93
  padding=padding,
94
+ stride=stride,
83
95
  ),
84
96
  nn.ELU(),
85
97
  ]
@@ -38,6 +38,7 @@ class PVNetLightningModule(pl.LightningModule):
38
38
 
39
39
  self.model = model
40
40
  self._optimizer = optimizer
41
+ self.save_all_validation_results = save_all_validation_results
41
42
 
42
43
  # Model must have lr to allow tuning
43
44
  # This setting is only used when lr is tuned with callback
@@ -312,7 +313,7 @@ class PVNetLightningModule(pl.LightningModule):
312
313
  self.log_dict(extreme_error_metrics, on_step=False, on_epoch=True)
313
314
 
314
315
  # Optionally save all validation results - these are overridden each epoch
315
- if self.hparams.save_all_validation_results:
316
+ if self.save_all_validation_results:
316
317
  # Add attributes
317
318
  ds_val_results.attrs["epoch"] = self.current_epoch
318
319
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PVNet
3
- Version: 5.0.20
3
+ Version: 5.0.22
4
4
  Summary: PVNet
5
5
  Author-email: Peter Dudfield <info@openclimatefix.org>
6
6
  Requires-Python: >=3.11
@@ -14,7 +14,7 @@ pvnet/models/late_fusion/basic_blocks.py,sha256=_cYGVyAIyEJS4wd-DEAXQXu0br66guZJ
14
14
  pvnet/models/late_fusion/late_fusion.py,sha256=VpP1aY646iO-JBlYkyoBlj0Z-gzsqaHnMgpNzjTqAIo,15735
15
15
  pvnet/models/late_fusion/encoders/__init__.py,sha256=bLBQdnCeLYhwISW0t88ZZBz-ebS94m7ZwBcsofWMHR4,51
16
16
  pvnet/models/late_fusion/encoders/basic_blocks.py,sha256=DGkFFIZv4S4FLTaAIOrAngAFBpgZQHfkGM4dzezZLk4,3044
17
- pvnet/models/late_fusion/encoders/encoders3d.py,sha256=V6yMQp9CANiJi1Km4Y0nVT7IQMrBSNCPjJdxgg5TSj4,6651
17
+ pvnet/models/late_fusion/encoders/encoders3d.py,sha256=9fmqVHO73F-jN62w065cgEQI_icNFC2nQH6ZEGvTHxU,7116
18
18
  pvnet/models/late_fusion/linear_networks/__init__.py,sha256=16dLdGfH4QWNrI1fUB-cXWx24lArqo2lWIjdUCWbcBY,96
19
19
  pvnet/models/late_fusion/linear_networks/basic_blocks.py,sha256=RnwdeuX_-itY4ncM0NphZ5gRSOpogo7927XIlZJ9LM0,2787
20
20
  pvnet/models/late_fusion/linear_networks/networks.py,sha256=exEIz_Z85f8nSwcvp4wqiiLECEAg9YbkKhSZJvFy75M,2231
@@ -22,11 +22,11 @@ pvnet/models/late_fusion/site_encoders/__init__.py,sha256=QoUiiWWFf12vEpdkw0gO4T
22
22
  pvnet/models/late_fusion/site_encoders/basic_blocks.py,sha256=iEB_N7ZL5HMQ1hZM6H32A71GCwP7YbErUx0oQF21PQM,1042
23
23
  pvnet/models/late_fusion/site_encoders/encoders.py,sha256=k4z690cfcP6J4pm2KtDujHN-W3uOl7QY0WvBIu1tM8c,11703
24
24
  pvnet/training/__init__.py,sha256=FKxmPZ59Vuj5_mXomN4saJ3En5M-aDMxSs6OttTQOcg,49
25
- pvnet/training/lightning_module.py,sha256=TkvLtOPswRtTIwcmAvNOSHg2RvIMzHsJVvs_d0xiRmQ,12891
25
+ pvnet/training/lightning_module.py,sha256=Hoqy_Csulfu-aUGOo9aqPYs7gHmbHqQTE8XaVI0ieVI,12954
26
26
  pvnet/training/plots.py,sha256=4xID7TBA4IazaARaCN5AoG5fFPJF1wIprn0y6I0C31c,2469
27
27
  pvnet/training/train.py,sha256=1tDA34ianCRfilS0yEeIpR9nsQWaJiiZfTD2qRUmgEc,5214
28
- pvnet-5.0.20.dist-info/licenses/LICENSE,sha256=tKUnlSmcLBWMJWkHx3UjZGdrjs9LidGwLo0jsBUBAwU,1077
29
- pvnet-5.0.20.dist-info/METADATA,sha256=1AAsvPun9UlyzXNFnMlz1AeW4zGVtCSrUtVx_VmmoAE,16371
30
- pvnet-5.0.20.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
31
- pvnet-5.0.20.dist-info/top_level.txt,sha256=4mg6WjeW05SR7pg3-Q4JRE2yAoutHYpspOsiUzYVNv0,6
32
- pvnet-5.0.20.dist-info/RECORD,,
28
+ pvnet-5.0.22.dist-info/licenses/LICENSE,sha256=tKUnlSmcLBWMJWkHx3UjZGdrjs9LidGwLo0jsBUBAwU,1077
29
+ pvnet-5.0.22.dist-info/METADATA,sha256=4C-v2KoK7y5AaaCJ13jmSE8iDg_-Shv6fUwdSAMHEOY,16371
30
+ pvnet-5.0.22.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
31
+ pvnet-5.0.22.dist-info/top_level.txt,sha256=4mg6WjeW05SR7pg3-Q4JRE2yAoutHYpspOsiUzYVNv0,6
32
+ pvnet-5.0.22.dist-info/RECORD,,
File without changes