From d05ac813dc9a3ce2752fec61d55b75103090c9ee Mon Sep 17 00:00:00 2001 From: Jirka Borovec Date: Fri, 10 Apr 2020 20:32:56 +0200 Subject: [PATCH] fix deprecated default_save_path (#1449) --- pytorch_lightning/trainer/deprecated_api.py | 14 ++++++++++++++ tests/test_deprecated.py | 1 + 2 files changed, 15 insertions(+) diff --git a/pytorch_lightning/trainer/deprecated_api.py b/pytorch_lightning/trainer/deprecated_api.py index e67bc7be70..d9f461d5d0 100644 --- a/pytorch_lightning/trainer/deprecated_api.py +++ b/pytorch_lightning/trainer/deprecated_api.py @@ -89,6 +89,20 @@ class TrainerDeprecatedAPITillVer0_8(ABC): " and this method will be removed in v0.8.0", DeprecationWarning) self.num_sanity_val_steps = nb + @property + def default_save_path(self): + """Back compatibility, will be removed in v0.8.0""" + rank_zero_warn("Attribute `default_save_path` has renamed to `default_root_dir` since v0.5.x" + " and this method will be removed in v0.8.0", DeprecationWarning) + return self.default_root_dir + + @default_save_path.setter + def default_save_path(self, path): + """Back compatibility, will be removed in v0.8.0""" + rank_zero_warn("Attribute `default_save_path` has renamed to `default_root_dir` since v0.5.x" + " and this method will be removed in v0.8.0", DeprecationWarning) + self.default_root_dir = path + class TrainerDeprecatedAPITillVer0_9(ABC): diff --git a/tests/test_deprecated.py b/tests/test_deprecated.py index fd373e9659..1e8dfa314d 100644 --- a/tests/test_deprecated.py +++ b/tests/test_deprecated.py @@ -34,6 +34,7 @@ def test_tbd_remove_in_v0_8_0_trainer(): 'max_nb_epochs': 'max_epochs', 'min_nb_epochs': 'min_epochs', 'nb_sanity_val_steps': 'num_sanity_val_steps', + 'default_save_path': 'default_root_dir', } # skip 0 since it may be interested as False kwargs = {k: (i + 1) for i, k in enumerate(mapping_old_new)}