Skip to content

Commit 1525abe

Browse files
committed
update deprecation message
1 parent f75d052 commit 1525abe

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

pytorch_lightning/trainer/trainer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2017,8 +2017,8 @@ def num_processes(self) -> int:
20172017
@property
20182018
def root_gpu(self) -> Optional[int]:
20192019
rank_zero_deprecation(
2020-
"`Trainer.root_gpu` is deprecated in v1.6 and will be removed in v1.8. Please use "
2021-
"`Trainer.strategy.root_device.index if isinstance(Trainer.accelerator, GPUAccelerator) else None` instead."
2020+
"`Trainer.root_gpu` is deprecated in v1.6 and will be removed in v1.8. "
2021+
"Please use `Trainer.strategy.root_device.index` instead."
20222022
)
20232023
return self.strategy.root_device.index if isinstance(self.accelerator, GPUAccelerator) else None
20242024

tests/deprecated_api/test_remove_1-8.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -895,8 +895,8 @@ def test_root_gpu_property(monkeypatch, gpus, expected_root_gpu, strategy):
895895
monkeypatch.setattr(torch.cuda, "is_available", lambda: True)
896896
monkeypatch.setattr(torch.cuda, "device_count", lambda: 16)
897897
with pytest.deprecated_call(
898-
match="`Trainer.root_gpu` is deprecated in v1.6 and will be removed in v1.8. Please use "
899-
r"`Trainer.strategy.root_device.index if isinstance\(Trainer.accelerator, GPUAccelerator\) else None` instead."
898+
match="`Trainer.root_gpu` is deprecated in v1.6 and will be removed in v1.8. "
899+
"Please use `Trainer.strategy.root_device.index` instead."
900900
):
901901
assert Trainer(gpus=gpus, strategy=strategy).root_gpu == expected_root_gpu
902902

@@ -912,7 +912,7 @@ def test_root_gpu_property(monkeypatch, gpus, expected_root_gpu, strategy):
912912
def test_root_gpu_property_0_passing(monkeypatch, gpus, expected_root_gpu, strategy):
913913
monkeypatch.setattr(torch.cuda, "device_count", lambda: 0)
914914
with pytest.deprecated_call(
915-
match="`Trainer.root_gpu` is deprecated in v1.6 and will be removed in v1.8. Please use "
916-
r"`Trainer.strategy.root_device.index if isinstance\(Trainer.accelerator, GPUAccelerator\) else None` instead."
915+
match="`Trainer.root_gpu` is deprecated in v1.6 and will be removed in v1.8. "
916+
"Please use `Trainer.strategy.root_device.index` instead."
917917
):
918918
assert Trainer(gpus=gpus, strategy=strategy).root_gpu == expected_root_gpu

0 commit comments

Comments
 (0)