Skip to content

Commit 5ec12f8

Browse files
NeoKishrohitgr7
andauthored
Remove deprecated trainer.should_rank_save_checkpoint (#14885)
Co-authored-by: Rohit Gupta <[email protected]>
1 parent d386335 commit 5ec12f8

File tree

3 files changed

+1
-18
lines changed

3 files changed

+1
-18
lines changed

src/pytorch_lightning/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
224224

225225
- Removed the deprecated `SimpleProfiler.profile_iterable` and `AdvancedProfiler.profile_iterable` attributes ([#14864](https://github.com/Lightning-AI/lightning/pull/14864))
226226

227+
- Remove the deprecated `Trainer.should_rank_save_checkpoint` ([#14885](https://github.com/Lightning-AI/lightning/pull/14885))
227228

228229
### Fixed
229230

src/pytorch_lightning/trainer/trainer.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1755,16 +1755,6 @@ def world_size(self) -> int:
17551755
# some strategies define a world size
17561756
return getattr(self.strategy, "world_size", 1)
17571757

1758-
@property
1759-
def should_rank_save_checkpoint(self) -> bool:
1760-
rank_zero_deprecation(
1761-
"`Trainer.should_rank_save_checkpoint` is deprecated in v1.6 and will be removed in v1.8.", stacklevel=5
1762-
)
1763-
strategy = self.strategy
1764-
return (
1765-
isinstance(strategy, pl.strategies.TPUSpawnStrategy) and strategy.local_rank == 0 or strategy.is_global_zero
1766-
)
1767-
17681758
@property
17691759
def num_nodes(self) -> int:
17701760
return getattr(self.strategy, "num_nodes", 1)

tests/tests_pytorch/deprecated_api/test_remove_1-8.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,6 @@ def test_v1_8_0_trainer_ckpt_path_attributes(fn_prefix: str):
9191
setattr(trainer, test_attr, "v")
9292

9393

94-
def test_v1_8_0_deprecated_trainer_should_rank_save_checkpoint(tmpdir):
95-
trainer = Trainer()
96-
with pytest.deprecated_call(
97-
match=r"`Trainer.should_rank_save_checkpoint` is deprecated in v1.6 and will be removed in v1.8."
98-
):
99-
_ = trainer.should_rank_save_checkpoint
100-
101-
10294
def test_v1_8_0_trainer_optimizers_mixin():
10395
trainer = Trainer()
10496
model = BoringModel()

0 commit comments

Comments
 (0)