From 52460d36ed005a4dbac5eca3020ef225e4b1697d Mon Sep 17 00:00:00 2001 From: Luca Antiga Date: Fri, 20 Dec 2024 23:53:28 +0100 Subject: [PATCH] Revert breaking change in configure_optimizers return type (#20512) --- docs/source-pytorch/conf.py | 4 ++-- src/lightning/pytorch/utilities/types.py | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/source-pytorch/conf.py b/docs/source-pytorch/conf.py index 1a9b15f5cc4ea..680e64d008556 100644 --- a/docs/source-pytorch/conf.py +++ b/docs/source-pytorch/conf.py @@ -464,8 +464,8 @@ def _load_py_module(name: str, location: str) -> ModuleType: ("py:func", "lightning.pytorch.utilities.rank_zero.rank_zero_only"), ("py:class", "lightning.pytorch.utilities.types.LRSchedulerConfig"), ("py:class", "lightning.pytorch.utilities.types.LRSchedulerConfigType"), - ("py:class", "lightning.pytorch.utilities.types.OptimizerConfigType"), - ("py:class", "lightning.pytorch.utilities.types.OptimizerLRSchedulerConfigType"), + ("py:class", "lightning.pytorch.utilities.types.OptimizerConfig"), + ("py:class", "lightning.pytorch.utilities.types.OptimizerLRSchedulerConfig"), ("py:class", "lightning_habana.pytorch.plugins.precision.HPUPrecisionPlugin"), ("py:class", "lightning_habana.pytorch.strategies.HPUDDPStrategy"), ("py:class", "lightning_habana.pytorch.strategies.HPUParallelStrategy"), diff --git a/src/lightning/pytorch/utilities/types.py b/src/lightning/pytorch/utilities/types.py index 3fd80d5e07a9a..6abd8aa952296 100644 --- a/src/lightning/pytorch/utilities/types.py +++ b/src/lightning/pytorch/utilities/types.py @@ -104,11 +104,11 @@ class LRSchedulerConfigType(TypedDict, total=False): strict: bool -class OptimizerConfigType(TypedDict): +class OptimizerConfig(TypedDict): optimizer: Optimizer -class OptimizerLRSchedulerConfigType(TypedDict): +class OptimizerLRSchedulerConfig(TypedDict): optimizer: Optimizer lr_scheduler: Union[LRSchedulerTypeUnion, LRSchedulerConfigType] monitor: NotRequired[str] @@ -119,10 +119,10 @@ class OptimizerLRSchedulerConfigType(TypedDict): Optimizer, Sequence[Optimizer], tuple[Sequence[Optimizer], Sequence[Union[LRSchedulerTypeUnion, LRSchedulerConfig]]], - OptimizerConfigType, - OptimizerLRSchedulerConfigType, - Sequence[OptimizerConfigType], - Sequence[OptimizerLRSchedulerConfigType], + OptimizerConfig, + OptimizerLRSchedulerConfig, + Sequence[OptimizerConfig], + Sequence[OptimizerLRSchedulerConfig], ] ]