Set `_choose_auto_accelerator` to `staticmethod` (#19822)

This commit is contained in:
Federico Berto 2024-06-05 10:12:27 +09:00 committed by GitHub
parent 351bec7625
commit 19f0fb978c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 2 deletions

View File

@ -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"

View File

@ -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"