|
18 | 18 | from functools import partial, update_wrapper |
19 | 19 | from pathlib import Path |
20 | 20 | from types import MethodType |
21 | | -from typing import Any, Optional, TypeVar, Union |
| 21 | +from typing import Any, TypeVar |
22 | 22 |
|
23 | 23 | import torch |
24 | 24 | import yaml |
@@ -80,12 +80,12 @@ def __init__(self, optimizer: Optimizer, monitor: str, *args: Any, **kwargs: Any |
80 | 80 |
|
81 | 81 | # LightningCLI requires the ReduceLROnPlateau defined here, thus it shouldn't accept the one from pytorch: |
82 | 82 | LRSchedulerTypeTuple = (LRScheduler, ReduceLROnPlateau) |
83 | | -LRSchedulerTypeUnion = Union[LRScheduler, ReduceLROnPlateau] |
84 | | -LRSchedulerType = Union[type[LRScheduler], type[ReduceLROnPlateau]] |
| 83 | +LRSchedulerTypeUnion = LRScheduler | ReduceLROnPlateau |
| 84 | +LRSchedulerType = type[LRScheduler] | type[ReduceLROnPlateau] |
85 | 85 |
|
86 | 86 |
|
87 | 87 | # Type aliases intended for convenience of CLI developers |
88 | | -ArgsType = Optional[list[str] | dict[str, Any] | Namespace] |
| 88 | +ArgsType = list[str] | dict[str, Any] | Namespace | None |
89 | 89 | OptimizerCallable = Callable[[Iterable], Optimizer] |
90 | 90 | LRSchedulerCallable = Callable[[Optimizer], LRScheduler | ReduceLROnPlateau] |
91 | 91 |
|
@@ -448,7 +448,7 @@ def add_default_arguments_to_parser(self, parser: LightningArgumentParser) -> No |
448 | 448 | """Adds default arguments to the parser.""" |
449 | 449 | parser.add_argument( |
450 | 450 | "--seed_everything", |
451 | | - type=Union[bool, int], |
| 451 | + type=bool | int, |
452 | 452 | default=self.seed_everything_default, |
453 | 453 | help=( |
454 | 454 | "Set to an int to run seed_everything with this value before classes instantiation." |
|
0 commit comments