From d0697747a6f8dc78964568a01f481262e186cd4d Mon Sep 17 00:00:00 2001 From: James Fulton Date: Fri, 22 Dec 2023 11:05:04 +0000 Subject: [PATCH 1/2] little bugs --- pvnet/models/base_model.py | 5 ++++- pvnet/training.py | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/pvnet/models/base_model.py b/pvnet/models/base_model.py index 3d26174f..34eb76ac 100644 --- a/pvnet/models/base_model.py +++ b/pvnet/models/base_model.py @@ -370,7 +370,10 @@ def _calculate_val_losses(self, y, y_hat): # Take median value for remaining metric calculations y_hat = self._quantiles_to_prediction(y_hat) - common_metrics_each_step = common_metrics(predictions=y_hat.numpy(), target=y.numpy()) + common_metrics_each_step = common_metrics( + predictions=y_hat.cpu().numpy(), + target=y.cpu().numpy() + ) mse_each_step = common_metrics_each_step["rmse"] ** 2 mae_each_step = common_metrics_each_step["mae"] diff --git a/pvnet/training.py b/pvnet/training.py index 08b40354..5f28215e 100644 --- a/pvnet/training.py +++ b/pvnet/training.py @@ -103,6 +103,8 @@ def train(config: DictConfig) -> Optional[float]: for callback in callbacks: log.info(f"{callback}") if isinstance(callback, ModelCheckpoint): + # Need to call the .experiment property to initialise the logger + wandb_logger.experiment callback.dirpath = "/".join( callback.dirpath.split("/")[:-1] + [wandb_logger.version] ) From 298e10c67430b30556f6339466ece01965a8a68f Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 22 Dec 2023 11:07:49 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- pvnet/models/base_model.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pvnet/models/base_model.py b/pvnet/models/base_model.py index 34eb76ac..b056a90c 100644 --- a/pvnet/models/base_model.py +++ b/pvnet/models/base_model.py @@ -371,8 +371,7 @@ def _calculate_val_losses(self, y, y_hat): y_hat = self._quantiles_to_prediction(y_hat) common_metrics_each_step = common_metrics( - predictions=y_hat.cpu().numpy(), - target=y.cpu().numpy() + predictions=y_hat.cpu().numpy(), target=y.cpu().numpy() ) mse_each_step = common_metrics_each_step["rmse"] ** 2 mae_each_step = common_metrics_each_step["mae"]