diff --git a/pvnet/__init__.py b/pvnet/__init__.py index cd9a7d9e..ac8b826d 100644 --- a/pvnet/__init__.py +++ b/pvnet/__init__.py @@ -1,2 +1,3 @@ """PVNet""" + __version__ = "3.0.40" diff --git a/pvnet/callbacks.py b/pvnet/callbacks.py index 0455d774..14cc15bf 100644 --- a/pvnet/callbacks.py +++ b/pvnet/callbacks.py @@ -1,5 +1,6 @@ """Custom callbacks """ + from lightning.pytorch import Trainer from lightning.pytorch.callbacks import BaseFinetuning, EarlyStopping, LearningRateFinder from lightning.pytorch.trainer.states import TrainerFn diff --git a/pvnet/data/__init__.py b/pvnet/data/__init__.py index 5d763df0..7f3aa89f 100644 --- a/pvnet/data/__init__.py +++ b/pvnet/data/__init__.py @@ -1,2 +1,3 @@ """Data parts""" + from .utils import BatchSplitter diff --git a/pvnet/data/base.py b/pvnet/data/base.py index b53c4ee8..43019876 100644 --- a/pvnet/data/base.py +++ b/pvnet/data/base.py @@ -1,4 +1,5 @@ """ Data module for pytorch lightning """ + from datetime import datetime from lightning.pytorch import LightningDataModule diff --git a/pvnet/data/pv_site_datamodule.py b/pvnet/data/pv_site_datamodule.py index 4c45eaec..1c5deb3f 100644 --- a/pvnet/data/pv_site_datamodule.py +++ b/pvnet/data/pv_site_datamodule.py @@ -1,4 +1,5 @@ """ Data module for pytorch lightning """ + import glob from ocf_datapipes.batch import BatchKey, batch_to_tensor, stack_np_examples_into_batch diff --git a/pvnet/data/utils.py b/pvnet/data/utils.py index b4441c14..5a942ec6 100644 --- a/pvnet/data/utils.py +++ b/pvnet/data/utils.py @@ -1,4 +1,5 @@ """Utils common between Wind and PV datamodules""" + from ocf_datapipes.batch import BatchKey, unstack_np_batch_into_examples from torch.utils.data import IterDataPipe, functional_datapipe diff --git a/pvnet/data/wind_datamodule.py b/pvnet/data/wind_datamodule.py index 0c11d31d..a6df2712 100644 --- a/pvnet/data/wind_datamodule.py +++ b/pvnet/data/wind_datamodule.py @@ -1,4 +1,5 @@ """ Data module for pytorch lightning """ + import glob from ocf_datapipes.batch import BatchKey, batch_to_tensor, stack_np_examples_into_batch diff --git a/pvnet/load_model.py b/pvnet/load_model.py index ba6de363..e38ed639 100644 --- a/pvnet/load_model.py +++ b/pvnet/load_model.py @@ -1,4 +1,5 @@ """ Load a model from its checkpoint directory """ + import glob import os diff --git a/pvnet/models/base_model.py b/pvnet/models/base_model.py index 46706c00..5e15cbfe 100644 --- a/pvnet/models/base_model.py +++ b/pvnet/models/base_model.py @@ -1,4 +1,5 @@ """Base model for all PVNet submodels""" + import json import logging import os diff --git a/pvnet/models/baseline/single_value.py b/pvnet/models/baseline/single_value.py index 980feb95..44ac2061 100644 --- a/pvnet/models/baseline/single_value.py +++ b/pvnet/models/baseline/single_value.py @@ -1,4 +1,5 @@ """Average value model""" + import torch from ocf_datapipes.batch import BatchKey from torch import nn diff --git a/pvnet/models/ensemble.py b/pvnet/models/ensemble.py index ef90d8fb..85e88835 100644 --- a/pvnet/models/ensemble.py +++ b/pvnet/models/ensemble.py @@ -1,4 +1,5 @@ """Model which uses mutliple prediction heads""" + from typing import Optional import torch diff --git a/pvnet/models/multimodal/encoders/basic_blocks.py b/pvnet/models/multimodal/encoders/basic_blocks.py index 2173267e..db641e6c 100644 --- a/pvnet/models/multimodal/encoders/basic_blocks.py +++ b/pvnet/models/multimodal/encoders/basic_blocks.py @@ -1,4 +1,5 @@ """Basic blocks for image sequence encoders""" + from abc import ABCMeta, abstractmethod import torch diff --git a/pvnet/models/multimodal/encoders/encoders3d.py b/pvnet/models/multimodal/encoders/encoders3d.py index b0df28ab..91f3a517 100644 --- a/pvnet/models/multimodal/encoders/encoders3d.py +++ b/pvnet/models/multimodal/encoders/encoders3d.py @@ -1,5 +1,6 @@ """Encoder modules for the satellite/NWP data based on 3D concolutions. """ + from typing import List, Union import torch diff --git a/pvnet/models/multimodal/linear_networks/basic_blocks.py b/pvnet/models/multimodal/linear_networks/basic_blocks.py index c115c9fb..084b585a 100644 --- a/pvnet/models/multimodal/linear_networks/basic_blocks.py +++ b/pvnet/models/multimodal/linear_networks/basic_blocks.py @@ -1,4 +1,5 @@ """Basic blocks for the lienar networks""" + from abc import ABCMeta, abstractmethod from collections import OrderedDict diff --git a/pvnet/models/multimodal/linear_networks/networks.py b/pvnet/models/multimodal/linear_networks/networks.py index 0009afa0..b52c0201 100644 --- a/pvnet/models/multimodal/linear_networks/networks.py +++ b/pvnet/models/multimodal/linear_networks/networks.py @@ -1,4 +1,5 @@ """Linear networks used for the fusion model""" + from torch import nn from pvnet.models.multimodal.linear_networks.basic_blocks import ( diff --git a/pvnet/models/multimodal/multimodal_base.py b/pvnet/models/multimodal/multimodal_base.py index dbab8556..60daa473 100644 --- a/pvnet/models/multimodal/multimodal_base.py +++ b/pvnet/models/multimodal/multimodal_base.py @@ -1,4 +1,5 @@ """Base model class for multimodal model and unimodal teacher""" + from ocf_datapipes.batch import BatchKey, NWPBatchKey from torchvision.transforms.functional import center_crop diff --git a/pvnet/models/multimodal/site_encoders/basic_blocks.py b/pvnet/models/multimodal/site_encoders/basic_blocks.py index b20835f1..66f4fb46 100644 --- a/pvnet/models/multimodal/site_encoders/basic_blocks.py +++ b/pvnet/models/multimodal/site_encoders/basic_blocks.py @@ -1,4 +1,5 @@ """Basic blocks for PV-site encoders""" + from abc import ABCMeta, abstractmethod from torch import nn diff --git a/pvnet/training.py b/pvnet/training.py index cc5f3c43..0b2339b9 100644 --- a/pvnet/training.py +++ b/pvnet/training.py @@ -1,4 +1,5 @@ """Training""" + import os import shutil from typing import Optional diff --git a/pvnet/utils.py b/pvnet/utils.py index b2c4d99a..2fc5c513 100644 --- a/pvnet/utils.py +++ b/pvnet/utils.py @@ -1,4 +1,5 @@ """Utils""" + import logging import warnings from collections.abc import Sequence diff --git a/scripts/save_batches.py b/scripts/save_batches.py index 953e7244..ebda1da5 100644 --- a/scripts/save_batches.py +++ b/scripts/save_batches.py @@ -20,6 +20,7 @@ ``` if wanting to override these values for example """ + # This is needed to get multiprocessing/multiple workers to behave try: import torch.multiprocessing as mp diff --git a/scripts/save_concurrent_batches.py b/scripts/save_concurrent_batches.py index a0252258..5c3284e5 100644 --- a/scripts/save_concurrent_batches.py +++ b/scripts/save_concurrent_batches.py @@ -13,6 +13,7 @@ ``` """ + # This is needed to get multiprocessing/multiple workers to behave try: import torch.multiprocessing as mp