Skip to content

Commit

Permalink
add flushing of val epoch resluts (#256)
Browse files Browse the repository at this point in the history
* add flushing of val epoch resluts

* add docstring back base_model.py

* log to csv only when end of accumbatch
  • Loading branch information
AUdaltsova authored Oct 25, 2024
1 parent c259a1c commit 5360394
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pvnet/models/base_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,8 @@ def validation_step(self, batch: dict, batch_idx):
# Sensor seems to be in batch, station, time order
y = batch[self._target_key][:, -self.forecast_len :, 0]

self._log_validation_results(batch, y_hat, accum_batch_num)
if (batch_idx + 1) % self.trainer.accumulate_grad_batches == 0:
self._log_validation_results(batch, y_hat, accum_batch_num)

# Expand persistence to be the same shape as y
losses = self._calculate_common_losses(y, y_hat)
Expand Down Expand Up @@ -743,6 +744,7 @@ def on_validation_epoch_end(self):
print("Failed to log validation results to wandb")
print(e)

self.validation_epoch_results = []
horizon_maes_dict = self._horizon_maes.flush()

# Create the horizon accuracy curve
Expand Down

0 comments on commit 5360394

Please sign in to comment.