Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deprecated Trainer proc_rank #2269

Merged
merged 2 commits into from
Jun 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
* `test_percent_check` in favour of `limit_test_batches`
- Deprecated `ModelCheckpoint`'s attributes `best` and `kth_best_model` ([#1799](https://github.com/PyTorchLightning/pytorch-lightning/pull/1799))
- Dropped official support/testing for older PyTorch versions <1.3 ([#1917](https://github.com/PyTorchLightning/pytorch-lightning/pull/1917))
- Deprecated Trainer `proc_rank` in favour of `global_rank` ([#2166](https://github.com/PyTorchLightning/pytorch-lightning/pull/2166), [#2269](https://github.com/PyTorchLightning/pytorch-lightning/pull/2269))

### Removed

Expand Down
14 changes: 14 additions & 0 deletions pytorch_lightning/trainer/deprecated_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,17 @@ def overfit_pct(self, pct):
rank_zero_warn("Attribute `train_percent_check` is now set by `overfit_batches` since v0.8.0"
" and this method will be removed in v0.10.0", DeprecationWarning)
self.overfit_batches = pct

@property
def proc_rank(self) -> int:
"""Back compatibility, will be removed in v0.10.0"""
rank_zero_warn("Attribute `proc_rank` is now set by `global_rank` since v0.8.0"
" and this method will be removed in v0.10.0", DeprecationWarning)
return self.global_rank

@proc_rank.setter
def proc_rank(self, rank):
"""Back compatibility, will be removed in v0.10.0"""
rank_zero_warn("Attribute `proc_rank` is now set by `global_rank` since v0.8.0"
" and this method will be removed in v0.10.0", DeprecationWarning)
self.global_rank = rank
6 changes: 6 additions & 0 deletions tests/test_deprecated.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ def test_tbd_remove_in_v0_10_0_trainer():
with pytest.deprecated_call(match='v0.10.0'):
assert trainer.test_percent_check == rnd_val

trainer = Trainer()
with pytest.deprecated_call(match='v0.10.0'):
trainer.proc_rank = 0
with pytest.deprecated_call(match='v0.10.0'):
assert trainer.proc_rank == trainer.global_rank


def test_tbd_remove_in_v0_9_0_trainer():
# test show_progress_bar set by progress_bar_refresh_rate
Expand Down