Skip to content

Commit

Permalink
added save_top_k to deprecated config options
Browse files Browse the repository at this point in the history
  • Loading branch information
Lilferrit committed Aug 7, 2024
1 parent e488e02 commit 8b7c6fe
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions casanovo/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
_config_deprecated = dict(
every_n_train_steps="val_check_interval",
max_iters="cosine_schedule_period_iters",
save_top_k=None,
)


Expand Down Expand Up @@ -95,10 +96,22 @@ def __init__(self, config_file: Optional[str] = None):
# Remap deprecated config entries.
for old, new in _config_deprecated.items():
if old in self._user_config:
self._user_config[new] = self._user_config.pop(old)
warning_msg = (
f"Depreciated config option '{old}' "
"is no longer in use"
)

if new is not None:
self._user_config[new] = self._user_config.pop(old)
warning_msg = (
f"Deprecated config option '{old}' "
f"remapped to '{new}'"
)
else:
del self._user_config[old]

warnings.warn(
f"Deprecated config option '{old}' remapped to "
f"'{new}'",
warning_msg,
DeprecationWarning,
)
# Check for missing entries in config file.
Expand Down

0 comments on commit 8b7c6fe

Please sign in to comment.