[TPU] make ptxla not imported when using tpu_commons (#23081)

Signed-off-by: Chengji Yao <chengjiyao@gmail.com>
Signed-off-by: Chengji Yao <chengjiyao@google.com>
Co-authored-by: Chengji Yao <chengjiyao@gmail.com>
This commit is contained in:
Chengji Yao
2025-08-19 11:46:42 +08:00
committed by GitHub
co-authored by Chengji Yao
parent a4454e9401
commit e9d6a3db69
6 changed files with 94 additions and 78 deletions
+3
View File
@@ -24,6 +24,8 @@ else:
logger = init_logger(__name__)
USE_TPU_COMMONS = False
class TpuPlatform(Platform):
_enum = PlatformEnum.TPU
@@ -201,6 +203,7 @@ class TpuPlatform(Platform):
try:
from tpu_commons.platforms import TpuPlatform as TpuCommonsPlatform
TpuPlatform = TpuCommonsPlatform # type: ignore
USE_TPU_COMMONS = True
except ImportError:
logger.info("tpu_commons not found, using vLLM's TpuPlatform")
pass