Skip to content

Commit cc4f609

Browse files
committed
update deprecation message
1 parent 20208c6 commit cc4f609

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
@@ -2034,8 +2034,8 @@ def num_processes(self) -> int:
20342034
@property
20352035
def root_gpu(self) -> Optional[int]:
20362036
rank_zero_deprecation(
2037-
"`Trainer.root_gpu` is deprecated in v1.6 and will be removed in v1.8. Please use "
2038-
"`Trainer.strategy.root_device.index if isinstance(Trainer.accelerator, GPUAccelerator) else None` instead."
2037+
"`Trainer.root_gpu` is deprecated in v1.6 and will be removed in v1.8. "
2038+
"Please use `Trainer.strategy.root_device.index` instead."
20392039
)
20402040
return self.strategy.root_device.index if isinstance(self.accelerator, GPUAccelerator) else None
20412041

tests/deprecated_api/test_remove_1-8.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -904,8 +904,8 @@ def test_root_gpu_property(monkeypatch, gpus, expected_root_gpu, strategy):
904904
monkeypatch.setattr(torch.cuda, "is_available", lambda: True)
905905
monkeypatch.setattr(torch.cuda, "device_count", lambda: 16)
906906
with pytest.deprecated_call(
907-
match="`Trainer.root_gpu` is deprecated in v1.6 and will be removed in v1.8. Please use "
908-
r"`Trainer.strategy.root_device.index if isinstance\(Trainer.accelerator, GPUAccelerator\) else None` instead."
907+
match="`Trainer.root_gpu` is deprecated in v1.6 and will be removed in v1.8. "
908+
"Please use `Trainer.strategy.root_device.index` instead."
909909
):
910910
assert Trainer(gpus=gpus, strategy=strategy).root_gpu == expected_root_gpu
911911

@@ -921,7 +921,7 @@ def test_root_gpu_property(monkeypatch, gpus, expected_root_gpu, strategy):
921921
def test_root_gpu_property_0_passing(monkeypatch, gpus, expected_root_gpu, strategy):
922922
monkeypatch.setattr(torch.cuda, "device_count", lambda: 0)
923923
with pytest.deprecated_call(
924-
match="`Trainer.root_gpu` is deprecated in v1.6 and will be removed in v1.8. Please use "
925-
r"`Trainer.strategy.root_device.index if isinstance\(Trainer.accelerator, GPUAccelerator\) else None` instead."
924+
match="`Trainer.root_gpu` is deprecated in v1.6 and will be removed in v1.8. "
925+
"Please use `Trainer.strategy.root_device.index` instead."
926926
):
927927
assert Trainer(gpus=gpus, strategy=strategy).root_gpu == expected_root_gpu

0 commit comments

Comments
 (0)