Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix pre-commit regex #97

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,12 @@ repos:
rev: v0.6.9
hooks:
- id: ruff
# Next line if for documenation cod snippets
exclude: '^[^_].*_\.py$'
args:
- --line-length=120
- --fix
- --exit-non-zero-on-fix
- --preview
- --exclude=docs/**/*_.py
- repo: https://github.com/sphinx-contrib/sphinx-lint
rev: v1.0.0
hooks:
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ Keep it human-readable, your future self will thank you!
- Feature: New `Boolean1DMask` class. Enables rollout training for limited area models. [#79](https://github.com/ecmwf/anemoi-training/pulls/79)

### Fixed

- Fix pre-commit regex

### Changed

## [0.2.0 - Feature release](https://github.com/ecmwf/anemoi-training/compare/0.1.0...0.2.0) - 2024-10-16
Expand Down
10 changes: 5 additions & 5 deletions src/anemoi/training/diagnostics/callbacks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ def _plot(

# prepare predicted output tensor for plotting
output_tensor = self.post_processors(
y_pred[self.sample_idx : self.sample_idx + 1, ...].cpu()
y_pred[self.sample_idx : self.sample_idx + 1, ...].cpu(),
).numpy()

fig = plot_predicted_multilevel_flat_sample(
Expand Down Expand Up @@ -457,7 +457,7 @@ def on_validation_epoch_start(self, trainer: pl.Trainer, pl_module: pl.Lightning
epoch = trainer.current_epoch

if model.trainable_data is not None:
data_coords = np.rad2deg(graph[(self._graph_name_data, "to", self._graph_name_data)].ecoords_rad.numpy())
data_coords = np.rad2deg(graph[self._graph_name_data, "to", self._graph_name_data].ecoords_rad.numpy())

self.plot(
trainer,
Expand All @@ -470,7 +470,7 @@ def on_validation_epoch_start(self, trainer: pl.Trainer, pl_module: pl.Lightning

if model.trainable_hidden is not None:
hidden_coords = np.rad2deg(
graph[(self._graph_name_hidden, "to", self._graph_name_hidden)].hcoords_rad.numpy(),
graph[self._graph_name_hidden, "to", self._graph_name_hidden].hcoords_rad.numpy(),
)

self.plot(
Expand Down Expand Up @@ -609,7 +609,7 @@ def _plot(
for rollout_step in range(pl_module.rollout):
y_hat = outputs[1][rollout_step]
y_true = batch[
:, pl_module.multi_step + rollout_step, ..., pl_module.data_indices.internal_data.output.full
:, pl_module.multi_step + rollout_step, ..., pl_module.data_indices.internal_data.output.full,
]
loss = pl_module.loss(y_hat, y_true, squash=False).cpu().numpy()

Expand Down Expand Up @@ -971,7 +971,7 @@ def tracker_metadata(self, trainer: pl.Trainer) -> dict:

return {}

def _remove_checkpoint(self, trainer: "pl.Trainer", filepath: str) -> None:
def _remove_checkpoint(self, trainer: pl.Trainer, filepath: str) -> None:
"""Calls the strategy to remove the checkpoint file."""
super()._remove_checkpoint(trainer, filepath)
trainer.strategy.remove_checkpoint(self._get_inference_checkpoint_filepath(filepath))
Expand Down
Loading