Skip to content

Commit

Permalink
Merge pull request #469 from WenjieDu/(fix)model_saving
Browse files Browse the repository at this point in the history
Fix saving failed when the strategy is 'better'
  • Loading branch information
WenjieDu authored Jul 21, 2024
2 parents e226073 + 3755fde commit 5f1baa6
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pypots/classification/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ def _train_model(

# save the model if necessary
self._auto_save_model_if_necessary(
confirm_saving=mean_loss < self.best_loss,
confirm_saving=self.best_epoch == epoch,
saving_name=f"{self.__class__.__name__}_epoch{epoch}_loss{mean_loss}",
)

Expand Down
2 changes: 1 addition & 1 deletion pypots/clustering/crli/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ def _train_model(

# save the model if necessary
self._auto_save_model_if_necessary(
confirm_saving=mean_loss < self.best_loss,
confirm_saving=self.best_epoch == epoch,
saving_name=f"{self.__class__.__name__}_epoch{epoch}_loss{mean_loss:.4f}",
)

Expand Down
2 changes: 1 addition & 1 deletion pypots/clustering/vader/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ def _train_model(

# save the model if necessary
self._auto_save_model_if_necessary(
confirm_saving=mean_loss < self.best_loss,
confirm_saving=self.best_epoch == epoch,
saving_name=f"{self.__class__.__name__}_epoch{epoch}_loss{mean_loss}",
)

Expand Down
2 changes: 1 addition & 1 deletion pypots/forecasting/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ def _train_model(

# save the model if necessary
self._auto_save_model_if_necessary(
confirm_saving=mean_loss < self.best_loss,
confirm_saving=self.best_epoch == epoch,
saving_name=f"{self.__class__.__name__}_epoch{epoch}_loss{mean_loss}",
)

Expand Down
2 changes: 1 addition & 1 deletion pypots/forecasting/csdi/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ def _train_model(

# save the model if necessary
self._auto_save_model_if_necessary(
confirm_saving=mean_loss < self.best_loss,
confirm_saving=self.best_epoch == epoch,
saving_name=f"{self.__class__.__name__}_epoch{epoch}_loss{mean_loss}",
)

Expand Down
2 changes: 1 addition & 1 deletion pypots/imputation/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ def _train_model(

# save the model if necessary
self._auto_save_model_if_necessary(
confirm_saving=mean_loss < self.best_loss,
confirm_saving=self.best_epoch == epoch,
saving_name=f"{self.__class__.__name__}_epoch{epoch}_loss{mean_loss}",
)

Expand Down
2 changes: 1 addition & 1 deletion pypots/imputation/csdi/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ def _train_model(

# save the model if necessary
self._auto_save_model_if_necessary(
confirm_saving=mean_loss < self.best_loss,
confirm_saving=self.best_epoch == epoch,
saving_name=f"{self.__class__.__name__}_epoch{epoch}_loss{mean_loss}",
)

Expand Down
2 changes: 1 addition & 1 deletion pypots/imputation/gpvae/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ def _train_model(

# save the model if necessary
self._auto_save_model_if_necessary(
confirm_saving=mean_loss < self.best_loss,
confirm_saving=self.best_epoch == epoch,
saving_name=f"{self.__class__.__name__}_epoch{epoch}_loss{mean_loss}",
)

Expand Down
2 changes: 1 addition & 1 deletion pypots/imputation/usgan/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ def _train_model(

# save the model if necessary
self._auto_save_model_if_necessary(
confirm_saving=mean_loss < self.best_loss,
confirm_saving=self.best_epoch == epoch,
saving_name=f"{self.__class__.__name__}_epoch{epoch}_loss{mean_loss}",
)

Expand Down

0 comments on commit 5f1baa6

Please sign in to comment.