diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1f0273b..dc6596c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,7 +3,7 @@ default_language_version: repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v4.6.0 hooks: # list of supported hooks: https://pre-commit.com/hooks.html - id: trailing-whitespace @@ -12,20 +12,20 @@ repos: - id: detect-private-key # python code formatting/linting - - repo: https://github.com/charliermarsh/ruff-pre-commit + - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: "v0.0.263" + rev: "v0.6.8" hooks: - id: ruff args: [--fix] - repo: https://github.com/psf/black - rev: 23.3.0 + rev: 24.8.0 hooks: - id: black args: [--line-length, "100"] # yaml formatting - repo: https://github.com/pre-commit/mirrors-prettier - rev: v3.0.0-alpha.9-for-vscode + rev: v4.0.0-alpha.8 hooks: - id: prettier types: [yaml] diff --git a/pseudo_labeller/model/__init__.py b/pseudo_labeller/model/__init__.py index 85016a7..ab94d34 100644 --- a/pseudo_labeller/model/__init__.py +++ b/pseudo_labeller/model/__init__.py @@ -1,2 +1,3 @@ """Models""" + from pseudo_labeller.model.idam import PsuedoIrradienceForecastor diff --git a/pseudo_labeller/model/idam.py b/pseudo_labeller/model/idam.py index 5dd9e5e..d70214e 100644 --- a/pseudo_labeller/model/idam.py +++ b/pseudo_labeller/model/idam.py @@ -1,4 +1,5 @@ """Psuedo-irradience forecastor/labeller""" + import einops import torch import torch.nn as nn @@ -68,7 +69,7 @@ def __init__( in_channels=input_channels, out_channels=conv3d_channels, kernel_size=(kernel_size, kernel_size, kernel_size), - padding=(1,0,0), + padding=(1, 0, 0), ) ) for i in range(0, num_layers): @@ -77,7 +78,7 @@ def __init__( in_channels=conv3d_channels, out_channels=conv3d_channels, kernel_size=(kernel_size, kernel_size, kernel_size), - padding=(1,0,0), + padding=(1, 0, 0), ) ) @@ -95,9 +96,7 @@ def __init__( # Small head model to convert from latent space to PV generation for training # Input is per-pixel input data, this will be # reshaped to the same output steps as the latent head - self.pv_meta_input = nn.Linear( - pv_meta_input_channels, out_features=hidden_dim - ) + self.pv_meta_input = nn.Linear(pv_meta_input_channels, out_features=hidden_dim) # Output is forecast steps channels, each channel is a timestep # For labelling, this should be 1, forecasting the middle @@ -142,7 +141,5 @@ def forward(self, x: torch.Tensor, pv_meta: torch.Tensor = None, output_latents: x = torch.cat([x, pv_meta], dim=1) # Get pv_meta_output x = self.pv_meta_output(x) - x = F.relu( - self.pv_meta_output2(x) - ) # Generation can only be positive or 0, so ReLU + x = F.relu(self.pv_meta_output2(x)) # Generation can only be positive or 0, so ReLU return x diff --git a/setup.py b/setup.py index 3f1900f..0e40cc0 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,5 @@ """ Usual setup file for package """ + # read the contents of your README file from pathlib import Path