Skip to content

Commit ddf3461

Browse files
committed
Update example configs and README
1 parent 1879a10 commit ddf3461

File tree

6 files changed

+47
-55
lines changed

6 files changed

+47
-55
lines changed

README.md

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ pip install ".[dev]"
2525
In order to run PVNet summation, we assume that you are already set up with
2626
[PVNet](https://github.com/openclimatefix/pvnet) and have a trained PVNet model already available either locally or pushed to HuggingFace.
2727

28-
Before running any code, copy the example configuration to a
29-
configs directory:
28+
Before running any code, copy the example configuration to a configs directory:
3029

3130
```
3231
cp -r configs.example configs
@@ -41,31 +40,26 @@ The datasets required are the same as documented in
4140
data for the national sum i.e. GSP ID 0.
4241

4342

44-
### Set up and config example for batch creation
45-
46-
47-
The concurrent batches created in the step above will be augmented with a few additional pieces of
48-
data required for the summation model. Within your copy of `PVNet_summation/configs` make sure you
49-
have replaced all of the items marked with `PLACEHOLDER`
50-
5143
### Training PVNet_summation
5244

5345
How PVNet_summation is run is determined by the extensive configuration in the config files. The
54-
configs stored in `PVNet/configs.example` should work with batches created using the steps and
55-
batch creation config mentioned above.
46+
configs stored in `configs.example`.
5647

5748
Make sure to update the following config files before training your model:
5849

59-
1. In `configs/datamodule/default.yaml`:
60-
- update `batch_dir` to point to the directory you stored your concurrent batches in during
61-
batch creation.
62-
- update `gsp_zarr_path` to point to the PVLive data containing the national estimate
63-
2. In `configs/model/default.yaml`:
64-
- update the PVNet model for which you are training a summation model for. A new summation model
65-
should be trained for each PVNet model
66-
- update the hyperparameters and structure of the summation model
67-
3. In `configs/trainer/default.yaml`:
68-
- set `accelerator: 0` if running on a system without a supported GPU
50+
51+
1. At the very start of training we loop over all of the input samples and make predictions for them using PVNet. These predictions are saved to disk and will be loaded in the training loop for more efficient training. In `configs/config.yaml` update `sample_save_dir` to set where the predictions will be saved to.
52+
53+
2. In `configs/datamodule/default.yaml`:
54+
- Update `pvnet_model.model_id` and `pvnet_model.revision` to point to the Huggingface commit or local directory where the exported PVNet model is.
55+
- Update `configuration` to point to a data configuration compatible with the PVNet model whose outputs will be fed into the summation model.
56+
- Set `train_period` and `val_period` to control the time ranges of the train and val period
57+
- Optionally set `max_num_train_samples` and `max_num_val_samples` to limit the number of possible train and validation example which will be used.
58+
59+
3. In `configs/model/default.yaml`:
60+
- Update the hyperparameters and structure of the summation model
61+
4. In `configs/trainer/default.yaml`:
62+
- Set `accelerator: 0` if running on a system without a supported GPU
6963

7064

7165
Assuming you have updated the configs, you should now be able to run:
@@ -74,7 +68,6 @@ Assuming you have updated the configs, you should now be able to run:
7468
python run.py
7569
```
7670

77-
This will then use the pretrained PVNet model to run inference on the concurrent batches, the outputs from this inference will then be used as the training data for the summation model alongside the national PVLive data (GSP ID 0).
7871

7972
## Testing
8073

configs.example/callbacks/default.yaml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,3 @@ model_checkpoint:
1919
dirpath: "PLACEHOLDER/${model_name}"
2020
auto_insert_metric_name: False
2121
save_on_train_epoch_end: False
22-
23-
#stochastic_weight_averaging:
24-
# _target_: pvnet_summation.callbacks.StochasticWeightAveraging
25-
# swa_lrs: 0.0000001
26-
# swa_epoch_start: 0.8
27-
# annealing_epochs: 5

configs.example/config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ defaults:
1010
- hydra: default.yaml
1111

1212
# Before training, the samples are run through PVNet. The samples are saved under this directory
13-
sample_save_dir: /home/jamesfulton/repos/PVNet_summation/presaved_saved_samples
13+
sample_save_dir: PLACEHOLDER
1414

1515
work_dir: ${hydra:runtime.cwd}
1616

configs.example/datamodule/default.yaml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,19 @@ configuration: PLACEHOLDER
22
batch_size: 32
33
num_workers: 20
44
prefetch_factor: 2
5-
5+
persistent_workers: true
66

77
# Set these to integers to limit the number of train/val samples precomputed and saved
88
max_num_train_samples: null
9-
max_num_val_samples: null
9+
max_num_val_samples: null
10+
11+
pvnet_model:
12+
model_id: null
13+
revision: null
14+
15+
train_period:
16+
- null
17+
- '2021-12-31'
18+
val_period:
19+
- '2022-01-01'
20+
- '2022-12-31'

configs.example/model/default.yaml

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,32 @@
1-
_target_: pvnet_summation.models.flat_model.DenseModel
1+
_target_: pvnet_summation.training.lightning_module.PVNetSummationLightningModule
22

3-
output_quantiles: null
3+
model:
4+
_target_: pvnet_summation.models.dense_model.DenseModel
45

5-
model_name: "openclimatefix/pvnet_v2"
6-
model_version: "898630f3f8cd4e8506525d813dd61c6d8de86144"
6+
output_quantiles: [0.02, 0.1, 0.25, 0.5, 0.75, 0.9, 0.98]
77

8-
#--------------------------------------------
9-
# Tabular network settings
10-
#--------------------------------------------
118

12-
output_network:
13-
_target_: pvnet.models.late_fusion.linear_networks.networks.ResFCNet
14-
_partial_: True
15-
fc_hidden_features: 128
16-
n_res_blocks: 2
17-
res_block_layers: 2
18-
dropout_frac: 0.0
9+
#--------------------------------------------
10+
# Summation network architecture
11+
#--------------------------------------------
1912

20-
predict_difference_from_sum: False
13+
output_network:
14+
_target_: pvnet.models.late_fusion.linear_networks.networks.ResFCNet
15+
_partial_: True
16+
fc_hidden_features: 128
17+
n_res_blocks: 2
18+
res_block_layers: 2
19+
dropout_frac: 0.1
2120

22-
# ----------------------------------------------
21+
predict_difference_from_sum: True
22+
23+
# ----------------------------------------------
2324

2425
optimizer:
2526
_target_: pvnet_summation.optimizers.AdamWReduceLROnPlateau
2627
lr: 0.0001
2728
weight_decay: 0.25
2829
amsgrad: True
29-
patience: 20
30+
patience: 10
3031
factor: 0.1
3132
threshold: 0.00

configs.example/readme.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)