From 19f0fb978c3c1d5e14fc904d678b10ed9798d5ea Mon Sep 17 00:00:00 2001 From: Federico Berto Date: Wed, 5 Jun 2024 10:12:27 +0900 Subject: [PATCH] Set `_choose_auto_accelerator` to `staticmethod` (#19822) --- src/lightning/fabric/connector.py | 3 ++- .../pytorch/trainer/connectors/accelerator_connector.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/lightning/fabric/connector.py b/src/lightning/fabric/connector.py index f677893100..9fb6625583 100644 --- a/src/lightning/fabric/connector.py +++ b/src/lightning/fabric/connector.py @@ -313,7 +313,8 @@ class _Connector: f" using {accelerator_name} accelerator." ) - def _choose_auto_accelerator(self) -> str: + @staticmethod + def _choose_auto_accelerator() -> str: """Choose the accelerator type (str) based on availability when ``accelerator='auto'``.""" if XLAAccelerator.is_available(): return "tpu" diff --git a/src/lightning/pytorch/trainer/connectors/accelerator_connector.py b/src/lightning/pytorch/trainer/connectors/accelerator_connector.py index 1c97a223b1..06f3ee366b 100644 --- a/src/lightning/pytorch/trainer/connectors/accelerator_connector.py +++ b/src/lightning/pytorch/trainer/connectors/accelerator_connector.py @@ -328,7 +328,8 @@ class _AcceleratorConnector: f" using {accelerator_name} accelerator." ) - def _choose_auto_accelerator(self) -> str: + @staticmethod + def _choose_auto_accelerator() -> str: """Choose the accelerator type (str) based on availability.""" if XLAAccelerator.is_available(): return "tpu"