Update deprecated type hinting in platform, plugins, triton_utils, vllm_flash_attn (#18129)

Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
This commit is contained in:
Harry Mellor
2025-05-14 05:28:16 -07:00
committed by GitHub
parent dc372b9c8a
commit c8ea982d9b
6 changed files with 18 additions and 24 deletions
+6 -7
View File
@@ -5,8 +5,7 @@ pynvml. However, it should not initialize cuda context.
import os
from functools import wraps
from typing import (TYPE_CHECKING, Callable, List, Optional, Tuple, TypeVar,
Union)
from typing import TYPE_CHECKING, Callable, Optional, TypeVar, Union
import torch
from typing_extensions import ParamSpec
@@ -56,7 +55,7 @@ class CudaPlatformBase(Platform):
device_control_env_var: str = "CUDA_VISIBLE_DEVICES"
@property
def supported_dtypes(self) -> List[torch.dtype]:
def supported_dtypes(self) -> list[torch.dtype]:
if self.has_device_capability(80):
# Ampere and Hopper or later NVIDIA GPUs.
return [torch.bfloat16, torch.float16, torch.float32]
@@ -93,7 +92,7 @@ class CudaPlatformBase(Platform):
return True
@classmethod
def is_fully_connected(cls, device_ids: List[int]) -> bool:
def is_fully_connected(cls, device_ids: list[int]) -> bool:
raise NotImplementedError
@classmethod
@@ -335,7 +334,7 @@ class NvmlCudaPlatform(CudaPlatformBase):
@with_nvml_context
def has_device_capability(
cls,
capability: Union[Tuple[int, int], int],
capability: Union[tuple[int, int], int],
device_id: int = 0,
) -> bool:
try:
@@ -365,7 +364,7 @@ class NvmlCudaPlatform(CudaPlatformBase):
@classmethod
@with_nvml_context
def is_fully_connected(cls, physical_device_ids: List[int]) -> bool:
def is_fully_connected(cls, physical_device_ids: list[int]) -> bool:
"""
query if the set of gpus are fully connected by nvlink (1 hop)
"""
@@ -430,7 +429,7 @@ class NonNvmlCudaPlatform(CudaPlatformBase):
return device_props.total_memory
@classmethod
def is_fully_connected(cls, physical_device_ids: List[int]) -> bool:
def is_fully_connected(cls, physical_device_ids: list[int]) -> bool:
logger.exception(
"NVLink detection not possible, as context support was"
" not found. Assuming no NVLink available.")