From 085b5b38e89402b12ec86b8a2b2ef7904335442c Mon Sep 17 00:00:00 2001 From: otaj <6065855+otaj@users.noreply.github.com> Date: Tue, 20 Sep 2022 22:35:40 +0200 Subject: [PATCH] Fixed `TypeError` on 1.7.6 when `torch.distributed` unavailable (#14809) * Fixed TypeError on 1.7.6 when distributed unavailable * changelog --- src/pytorch_lightning/CHANGELOG.md | 1 + src/pytorch_lightning/utilities/types.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pytorch_lightning/CHANGELOG.md b/src/pytorch_lightning/CHANGELOG.md index 702dfafe40..96de80a3ab 100644 --- a/src/pytorch_lightning/CHANGELOG.md +++ b/src/pytorch_lightning/CHANGELOG.md @@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). - Break HPU Graphs into two parts (forward + backward as one and optimizer as another) for better performance ([#14656](https://github.com/Lightning-AI/lightning/pull/14656)) - Fixed torchscript error with ensembles of LightningModules ([#14657](https://github.com/Lightning-AI/lightning/pull/14657), [#14724](https://github.com/Lightning-AI/lightning/pull/14724)) - Fixed an issue with `TensorBoardLogger.finalize` creating a new experiment when none was created during the Trainer's execution ([#14762](https://github.com/Lightning-AI/lightning/pull/14762)) +- Fixed `TypeError` on import when `torch.distributed` is not available ([#14809](https://github.com/Lightning-AI/lightning/pull/14809)) ## [1.7.6] - 2022-09-13 diff --git a/src/pytorch_lightning/utilities/types.py b/src/pytorch_lightning/utilities/types.py index 6fc042a7c0..1681d3ec75 100644 --- a/src/pytorch_lightning/utilities/types.py +++ b/src/pytorch_lightning/utilities/types.py @@ -31,7 +31,7 @@ from typing_extensions import Protocol, runtime_checkable if torch.distributed.is_available(): from torch._C._distributed_c10d import ProcessGroup else: - ProcessGroup = ... # type: ignore[assignment,misc] + ProcessGroup = Any # type: ignore[assignment,misc] _NUMBER = Union[int, float] _METRIC = Union[Metric, Tensor, _NUMBER]