Skip to content

Commit 12b0ec6

Browse files
fix mypy typing errors in pytorch_lightning/strategies/ddp2.py (#13535)
* fix typing in strategies/ddp2.py * Use quotes instead of __future__.annotations for forward references Co-authored-by: Justus Schock <[email protected]>
1 parent f116c2f commit 12b0ec6

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ module = [
6464
"pytorch_lightning.loggers.wandb",
6565
"pytorch_lightning.loops.epoch.training_epoch_loop",
6666
"pytorch_lightning.strategies.ddp",
67-
"pytorch_lightning.strategies.ddp2",
6867
"pytorch_lightning.strategies.ddp_spawn",
6968
"pytorch_lightning.strategies.deepspeed",
7069
"pytorch_lightning.strategies.dp",

src/pytorch_lightning/strategies/ddp2.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
from typing import Any
16+
1517

1618
class DDP2Strategy:
1719
"""DDP2 behaves like DP in one node, but synchronization across nodes behaves like in DDP.
@@ -25,7 +27,7 @@ class DDP2Strategy:
2527

2628
strategy_name = "ddp2"
2729

28-
def __new__(cls, *args, **kwargs) -> None:
30+
def __new__(cls, *args: Any, **kwargs: Any) -> "DDP2Strategy":
2931
raise TypeError(
3032
"The `DDP2Strategy`/`DDP2Plugin` is no longer supported in v1.7 and will be removed completely in v1.8."
3133
" For single-node execution, we recommend the `DDPStrategy` or the `DPStrategy`. If you rely on DDP2, you"

0 commit comments

Comments
 (0)