[Misc]Use a platform independent interface to obtain the device attributes (#17100)

This commit is contained in:
ponix-j
2025-04-29 14:59:13 +08:00
committed by GitHub
parent ebb3930d28
commit bdb2cddafc
3 changed files with 8 additions and 4 deletions

View File

@ -293,7 +293,8 @@ class HfRunner:
def get_default_device(self):
from vllm.platforms import current_platform
return ("cpu" if current_platform.is_cpu() else "cuda")
return ("cpu"
if current_platform.is_cpu() else current_platform.device_type)
def wrap_device(self, x: _T, device: Optional[str] = None) -> _T:
if x is None or isinstance(x, (bool, )):