From 114f5d7a1d232e55101c7c7d5910deed24d3b4d6 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 18 Jun 2024 12:49:12 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- README.md | 20 ++++++++++---------- pvnet_summation/__init__.py | 2 +- pvnet_summation/models/base_model.py | 4 ++-- scripts/checkpoint_to_huggingface.py | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 767bf3e..f775c60 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ pip install ".[dev]" ## Getting started with running PVNet summation -In order to run PVNet summation, we assume that you are already set up with +In order to run PVNet summation, we assume that you are already set up with [PVNet](https://github.com/openclimatefix/PVNet) and have met all the requirements there. Before running any code, copy the example configuration to a @@ -34,15 +34,15 @@ You will be making local amendments to these configs. ### Datasets -The datasets required are the same as documented in -[PVNet](https://github.com/openclimatefix/PVNet). The only addition is that you will need PVLive +The datasets required are the same as documented in +[PVNet](https://github.com/openclimatefix/PVNet). The only addition is that you will need PVLive data for the national sum i.e. GSP ID 0. ## Generating pre-made concurrent batches of data for PVNet -It is required that you preprepare batches using the `save_concurrent_batches.py` script from -PVNet. This saves the batches as required by the PVNet model to make predictions for all GSPs for +It is required that you preprepare batches using the `save_concurrent_batches.py` script from +PVNet. This saves the batches as required by the PVNet model to make predictions for all GSPs for a single forecast init time. Seen the PVNet package for more details on this. @@ -50,19 +50,19 @@ a single forecast init time. Seen the PVNet package for more details on this. The concurrent batches created in the step above will be augmented with a few additional pieces of -data required for the summation model. Within your copy of `PVNet_summation/configs` make sure you +data required for the summation model. Within your copy of `PVNet_summation/configs` make sure you have replaced all of the items marked with `PLACEHOLDER` ### Training PVNet_summation -How PVNet_summation is run is determined by the extensive configuration in the config files. The -configs stored in `PVNet/configs.example` should work with batches created using the steps and +How PVNet_summation is run is determined by the extensive configuration in the config files. The +configs stored in `PVNet/configs.example` should work with batches created using the steps and batch creation config mentioned above. Make sure to update the following config files before training your model: 1. In `configs/datamodule/default.yaml`: - - update `batch_dir` to point to the directory you stored your concurrent batches in during + - update `batch_dir` to point to the directory you stored your concurrent batches in during batch creation. - update `gsp_zarr_path` to point to the PVLive data containing the national estimate 2. In `configs/model/default.yaml`: @@ -74,7 +74,7 @@ Make sure to update the following config files before training your model: 4. In `configs.config.yaml`: - It is recommended that you set `presave_pvnet_outputs` to `True`. This means that the concurrent batches that you create will only be run through the PVNet model once before - training and their outputs saved, rather than being run on the fly on each batch throughout + training and their outputs saved, rather than being run on the fly on each batch throughout training. This can speed up training significantly. diff --git a/pvnet_summation/__init__.py b/pvnet_summation/__init__.py index ff51c01..7ef08ab 100644 --- a/pvnet_summation/__init__.py +++ b/pvnet_summation/__init__.py @@ -1,2 +1,2 @@ """PVNet_summation""" -__version__ = "0.1.4" \ No newline at end of file +__version__ = "0.1.4" diff --git a/pvnet_summation/models/base_model.py b/pvnet_summation/models/base_model.py index caec670..5629bc0 100644 --- a/pvnet_summation/models/base_model.py +++ b/pvnet_summation/models/base_model.py @@ -91,7 +91,7 @@ def __init__( ) else: self.pvnet_output_shape = (317, self.pvnet_model.forecast_len) - + self.use_weighted_loss = False def predict_pvnet_batch(self, batch): @@ -186,7 +186,7 @@ def validation_step(self, batch: dict, batch_idx): losses = self._calculate_common_losses(y, y_hat) losses.update(self._calculate_val_losses(y, y_hat)) - + # Store these to make horizon accuracy plot self._horizon_maes.append( {i: losses[f"MAE_horizon/step_{i:03}"].cpu().numpy() for i in range(self.forecast_len)} diff --git a/scripts/checkpoint_to_huggingface.py b/scripts/checkpoint_to_huggingface.py index 9004762..71a5e3e 100644 --- a/scripts/checkpoint_to_huggingface.py +++ b/scripts/checkpoint_to_huggingface.py @@ -1,5 +1,5 @@ """Command line tool to push locally save model checkpoints to huggingface - + use: python checkpoint_to_huggingface.py "path/to/model/checkpoints" \ --local-path="~/tmp/this_model" \