Skip to content

Commit c542968

Browse files
committed
apply fixes
1 parent 4f22163 commit c542968

File tree

2 files changed

+6
-6
lines changed
  • src/lightning

2 files changed

+6
-6
lines changed

src/lightning/fabric/accelerators/cpu.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
from typing import List, Union
14+
from typing import Union
1515

1616
import torch
1717
from typing_extensions import override
@@ -45,7 +45,7 @@ def parse_devices(devices: Union[int, str]) -> int:
4545

4646
@staticmethod
4747
@override
48-
def get_parallel_devices(devices: Union[int, str]) -> List[torch.device]:
48+
def get_parallel_devices(devices: Union[int, str]) -> list[torch.device]:
4949
"""Gets parallel devices for the Accelerator."""
5050
devices = _parse_cpu_cores(devices)
5151
return [torch.device("cpu")] * devices

src/lightning/pytorch/accelerators/cpu.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
from typing import Any, Dict, List, Union
14+
from typing import Any, Union
1515

1616
import torch
1717
from lightning_utilities.core.imports import RequirementCache
@@ -38,7 +38,7 @@ def setup_device(self, device: torch.device) -> None:
3838
raise MisconfigurationException(f"Device should be CPU, got {device} instead.")
3939

4040
@override
41-
def get_device_stats(self, device: _DEVICE) -> Dict[str, Any]:
41+
def get_device_stats(self, device: _DEVICE) -> dict[str, Any]:
4242
"""Get CPU stats from ``psutil`` package."""
4343
return get_cpu_stats()
4444

@@ -54,7 +54,7 @@ def parse_devices(devices: Union[int, str]) -> int:
5454

5555
@staticmethod
5656
@override
57-
def get_parallel_devices(devices: Union[int, str]) -> List[torch.device]:
57+
def get_parallel_devices(devices: Union[int, str]) -> list[torch.device]:
5858
"""Gets parallel devices for the Accelerator."""
5959
devices = _parse_cpu_cores(devices)
6060
return [torch.device("cpu")] * devices
@@ -89,7 +89,7 @@ def register_accelerators(cls, accelerator_registry: _AcceleratorRegistry) -> No
8989
_PSUTIL_AVAILABLE = RequirementCache("psutil")
9090

9191

92-
def get_cpu_stats() -> Dict[str, float]:
92+
def get_cpu_stats() -> dict[str, float]:
9393
if not _PSUTIL_AVAILABLE:
9494
raise ModuleNotFoundError(
9595
f"Fetching CPU device stats requires `psutil` to be installed. {str(_PSUTIL_AVAILABLE)}"

0 commit comments

Comments
 (0)